]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM/test_MEDMEM_SkyLineArray.cxx
Salome HOME
remove a reference to the $MED_ROOT_DIR in the Makefile.in wich is useless
[modules/med.git] / src / MEDMEM / test_MEDMEM_SkyLineArray.cxx
1 #include "utilities.h"
2 #include "MEDMEM_SkyLineArray.hxx"
3
4 #ifdef _DEBUG_
5 #include "LocalTraceCollector.hxx"
6 #endif /* ifdef _DEBUG_*/
7
8 using namespace std;
9 using namespace MEDMEM;
10
11 int main (int argc, char ** argv) {
12 #ifdef _DEBUG_
13   LocalTraceCollector::instance();
14 #endif /* ifdef _DEBUG_*/
15
16   int NumberOfCell = 3 ; // 1 triangle,1 quadrangle,1 triangle
17   int Size = 10 ; // 10 nodes
18
19   int * index = new int[NumberOfCell+1] ;
20   index[0]=1;
21   index[1]=4;
22   index[2]=8;
23   index[3]=11;
24   int * value = new int[Size] ;
25   value[0]=1; // first
26   value[1]=2;
27   value[2]=5;
28   value[3]=2; // second
29   value[4]=3;
30   value[5]=5;
31   value[6]=6;
32   value[7]=3; // thirst
33   value[8]=4;
34   value[9]=6;
35   //  value[]=; // forth
36
37   MEDSKYLINEARRAY * myArray = new MEDSKYLINEARRAY(NumberOfCell,Size,index,value) ;
38
39   cout << "Show all 1 :" << endl ;
40   for (int i=1; i<NumberOfCell+1 ; i++) {
41     const int * cell = myArray->getI(i) ;
42     int numberof = myArray->getNumberOfI(i) ;
43     cout << " - " ;
44     for (int j=0;j<numberof;j++)
45       cout << cell[j] << " " ;
46     cout << endl ;
47   }
48   cout << "Show all 2 :" << endl ;
49   for (int i=1; i<NumberOfCell+1 ; i++) {
50     cout << " - " ;
51     int numberof = myArray->getNumberOfI(i) ;
52     for (int j=1;j<numberof+1;j++)
53       cout << myArray->getIJ(i,j) << " " ;
54     cout << endl ;
55   }
56
57   MEDSKYLINEARRAY * myArray2 = new MEDSKYLINEARRAY(*myArray) ;
58   delete myArray ;
59   
60   cout << "Show all 3 :" << endl ;
61   const int * index2 = myArray2->getIndex() ;
62   for (int i=1; i<=NumberOfCell ; i++) {
63     cout << " - " ;
64     for (int j=index2[i-1];j<index2[i];j++)
65       cout << myArray2->getIndexValue(j) << " " ;
66     cout << endl ;
67   }
68
69   delete myArray2 ;
70   delete[] index ;
71   delete[] value ;
72
73   return 0 ;
74 }
75