Salome HOME
DCQ : Merge with Ecole Ete a6.
[modules/med.git] / src / MEDMEM / INTERPOLATION / UseCaseInterpolationwots.cxx
1 #include "MEDMEM_Exception.hxx"
2 #include "MEDMEM_define.hxx"
3
4 #include "MEDMEM_Field.hxx"
5 #include "MEDMEM_Mesh.hxx"
6 #include "MEDMEM_Interpolation.hxx"
7
8 #include "stdio.h"
9
10 using namespace MEDMEM;
11
12 main () {
13   
14   const char * fromFileName  = "fromMesh.med";
15   const char * toFileName    = "toMesh.med";
16   const char * fieldName     = "fieldnodedouble";
17
18   const char * fromMeshName  = "fromMesh";
19   const char * toMeshName    = "toMesh";
20   
21   const int flagConvex = 1;
22   const int interpolationType = 1;
23
24   try {
25     
26     MESH            fromMesh    (MED_DRIVER,fromFileName,fromMeshName);          
27     SUPPORT         fromSupport (&fromMesh,"XsupportX",MED_NODE);                
28     FIELD<double>   fromField   (&fromSupport,MED_DRIVER,fromFileName,fieldName);
29     MESH            toMesh      (MED_DRIVER,toFileName,toMeshName);              
30     
31     INTERPOLATION<3> myInter (fromField,toMesh);
32     
33     FIELD<double>   * toField = myInter.interpolate(interpolationType,flagConvex);
34     
35     toField->addDriver(MED_DRIVER,toFileName,toField->getName()) ;
36
37     toField->write();
38
39
40   } catch (MEDEXCEPTION& ex){
41     MESSAGE(ex.what()) ;
42   }
43 }