Salome HOME
remove a reference to the $MED_ROOT_DIR in the Makefile.in wich is useless
[modules/med.git] / src / MEDMEM / test_MEDMEM_Array.cxx
1 #include "utilities.h"
2 #include "MEDMEM_Array.hxx"
3
4 #ifdef _DEBUG_
5 #include "LocalTraceCollector.hxx"
6 #endif /* ifdef _DEBUG_*/
7
8 using namespace std;
9 using namespace MEDMEM;
10 int main (int argc, char ** argv) {
11
12 #ifdef _DEBUG_
13   LocalTraceCollector::instance();
14 #endif /* ifdef _DEBUG_*/
15
16   int SpaceDimension = 3 ;
17   int NumberOfNodes = 4 ; 
18   MEDARRAY<int> * myArray = new MEDARRAY<int>(SpaceDimension,NumberOfNodes,MED_EN::MED_FULL_INTERLACE) ;
19
20   //const int * value = myArray->get(MED_FULL_INTERLACE) ;
21   for (int i=1; i<=NumberOfNodes; i++)
22     for (int j=1; j<=SpaceDimension; j++)
23       myArray->setIJ(i,j,i) ;
24   
25   int numberof ;
26   MESSAGE("Show all 1 :");
27   numberof = myArray->getLeadingValue() ;
28   for (int i=1; i<=myArray->getLengthValue() ; i++) {
29     //int * node = myArray->getI(MED_FULL_INTERLACE,i) ;
30     const int * node = myArray->getRow(i) ;
31     cout << " - " ;
32     for (int j=0;j<numberof;j++)
33       cout << node[j] << " " ;
34     cout << endl ;
35   }
36   MESSAGE("Show all 2 :");
37   numberof = myArray->getLengthValue() ;
38   for (int i=1; i<=myArray->getLeadingValue() ; i++) {
39     //int * node = myArray->getJ(MED_NO_INTERLACE,i) ;
40     const int * node = myArray->getColumn(i) ;
41     cout << " - " ;
42     for (int j=0;j<numberof;j++)
43       cout << node[j] << " " ;
44     cout << endl ;
45   }
46   MESSAGE("Show all 3 :");
47   numberof = myArray->getLeadingValue() ;
48   for (int i=1; i<=myArray->getLengthValue() ; i++) {
49     cout << " - " ;
50     for (int j=1;j<numberof+1;j++)
51       cout << myArray->getIJ(i,j) << " " ;
52     cout << endl ;
53   }
54
55   MESSAGE("Show all 0 :");
56   numberof = myArray->getLeadingValue() ;
57   int length = myArray->getLengthValue() ;
58   const int * NoInterlaceArray = myArray->get(MED_EN::MED_NO_INTERLACE) ;
59   for (int i=0; i<length ; i++) {
60     cout << " - " ;
61     for (int j=0;j<numberof;j++)
62       cout << NoInterlaceArray[j*length+i] << " " ;
63     cout << endl ;
64   }
65
66   delete myArray ;
67
68   return 0 ;
69 }