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