Salome HOME
bd1682aa2b6ba480cd08eec559bbe7c42fae43c0
[modules/med.git] / src / 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 using namespace MED_EN;
12
13 main () {
14   
15   const char * fromFileName  = "fromMesh.med";
16   const char * toFileName    = "toMesh.med";
17   const char * fieldName     = "fieldnodedouble";
18
19   const char * fromMeshName  = "fromMesh";
20   const char * toMeshName    = "toMesh";
21   
22   const int flagConvex = 1;
23   const int interpolationType = 1;
24
25   try {
26     
27     MESH            fromMesh    (MED_DRIVER,fromFileName,fromMeshName);          
28     SUPPORT         fromSupport (&fromMesh,"XsupportX",MED_NODE);                
29     FIELD<double>   fromField   (&fromSupport,MED_DRIVER,fromFileName,fieldName);
30     MESH            toMesh      (MED_DRIVER,toFileName,toMeshName);              
31     
32     INTERPOLATION<3> myInter (fromField,toMesh);
33     
34     FIELD<double>   * toField = myInter.interpolate(interpolationType,flagConvex);
35     
36     toField->addDriver(MED_DRIVER,toFileName,toField->getName()) ;
37
38     toField->write();
39
40
41   } catch (MEDEXCEPTION& ex){
42     MESSAGE(ex.what()) ;
43   }
44 }