Salome HOME
e52eaaa0007b1f6b4fe65b682870bf6746810976
[tools/medcoupling.git] / doc / MEDMEM / MESHcoordinates.cxx
1 #include "MEDMEM_Mesh.hxx"
2
3 using namespace MEDMEM ;
4 using namespace MED_EN ;
5
6 int main (int argc, char ** argv) {
7
8   const string MedFile = "pointe.med" ;
9   const string MeshName = "maa1" ;
10   MESH myMesh(MED_DRIVER,MedFile,MeshName) ;
11
12   cout << "Mesh name : " << myMesh.getName()  << endl << endl ; 
13
14   int SpaceDimension = myMesh.getSpaceDimension() ;
15   int NumberOfNodes = myMesh.getNumberOfNodes() ;
16   cout << "Space dimension  : " << SpaceDimension << endl << endl ; 
17   cout << "Number of nodes  : " << NumberOfNodes  << endl << endl ; 
18
19   cout << "Show Nodes Coordinates : " << endl ;
20
21   // coordinates names :
22   cout << "Name :" << endl ;
23   const string * CoordinatesNames = myMesh.getCoordinatesNames() ;
24   for(int i=0; i<SpaceDimension ; i++) {
25     cout << " - " << CoordinatesNames[i] << endl ;
26   }
27   // coordinates unit :
28   cout << "Unit :" << endl ;
29   const string * CoordinatesUnits = myMesh.getCoordinatesUnits() ;
30   for(int i=0; i<SpaceDimension ; i++) {
31     cout << " - " << CoordinatesUnits[i] << endl ;
32   }
33   // coordinates value
34   const double * Coordinates = 
35     myMesh.getCoordinates(MED_FULL_INTERLACE) ;
36   for(int i=0; i<NumberOfNodes ; i++) {
37     cout << "Nodes " << i+1 << " : " ;
38     for (int j=0; j<SpaceDimension ; j++)
39       cout << Coordinates[i*SpaceDimension+j] << " " ;
40     cout << endl ;
41   }
42   
43   return 0 ;
44 }