Salome HOME
DCQ : Merge with Ecole Ete a6.
[modules/med.git] / src / MEDMEM / INTERPOLATION / UseCaseMapping.cxx
1 #include "stdio.h"
2 #include "stdlib.h"
3
4 #include <iostream.h>
5
6 #include "MEDMEM_InterpolationHighLevelObjects.hxx"
7
8 int main (void) 
9 {
10 int i;
11
12 const int DIMENSION = 3;
13
14 const int isConvexFromMesh = 1;
15
16 const char * fromFileName  = "fromMesh.med";
17 const char * fromMeshName  = "fromMesh";
18
19 MESH * fromMesh = new MESH(MED_DRIVER,fromFileName,fromMeshName);
20
21 const char * toFileName    = "toMesh.med";
22 const char * toMeshName    = "toMesh";
23
24 MESH * toMesh   = new MESH(MED_DRIVER,toFileName,toMeshName);
25
26 Meta_Wrapper<DIMENSION> * fromWrapper = new Meta_Wrapper<DIMENSION>
27                                         (
28                                         fromMesh->getNumberOfNodes(),
29                                         const_cast<double *> (fromMesh->getCoordinates(MED_FULL_INTERLACE)),
30                                         const_cast<CONNECTIVITY *> (fromMesh->getConnectivityptr())
31                                         );
32
33 Meta_Wrapper<DIMENSION> * toWrapper   = new Meta_Wrapper<DIMENSION>
34                                         (
35                                         toMesh->getNumberOfNodes(),
36                                         const_cast<double *> (toMesh->getCoordinates(MED_FULL_INTERLACE))
37                                         );
38
39 Meta_Mapping<DIMENSION> * mapping     = new  Meta_Mapping<DIMENSION> (fromWrapper,toWrapper);
40
41 mapping->Cree_Mapping(isConvexFromMesh);
42                                                 
43 vector<int> vectormapping = mapping->Get_Mapping();
44
45 for (i=0;i<vectormapping.size();i++)
46         {
47         cout<<"Le noeud "<<i<<" de "<<toMeshName<<" est contenu dans la maille "<<vectormapping[i]<<" de "<<fromMeshName<<endl; 
48         }
49
50 }