1 // MED MEDMEM : MED files in memory
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : test_MEDMEM_Array.cxx
28 #include "utilities.h"
29 #include "MEDMEM_Array.hxx"
31 int main (int argc, char ** argv) {
33 int SpaceDimension = 3 ;
34 int NumberOfNodes = 4 ;
35 MEDARRAY<int> * myArray = new MEDARRAY<int>(SpaceDimension,NumberOfNodes,MED_FULL_INTERLACE) ;
37 //const int * value = myArray->get(MED_FULL_INTERLACE) ;
38 for (int i=1; i<=NumberOfNodes; i++)
39 for (int j=1; j<=SpaceDimension; j++)
40 myArray->setIJ(i,j,i) ;
43 MESSAGE("Show all 1 :");
44 numberof = myArray->getLeadingValue() ;
45 for (int i=1; i<=myArray->getLengthValue() ; i++) {
46 //int * node = myArray->getI(MED_FULL_INTERLACE,i) ;
47 const int * node = myArray->getRow(i) ;
49 for (int j=0;j<numberof;j++)
50 cout << node[j] << " " ;
53 MESSAGE("Show all 2 :");
54 numberof = myArray->getLengthValue() ;
55 for (int i=1; i<=myArray->getLeadingValue() ; i++) {
56 //int * node = myArray->getJ(MED_NO_INTERLACE,i) ;
57 const int * node = myArray->getColumn(i) ;
59 for (int j=0;j<numberof;j++)
60 cout << node[j] << " " ;
63 MESSAGE("Show all 3 :");
64 numberof = myArray->getLeadingValue() ;
65 for (int i=1; i<=myArray->getLengthValue() ; i++) {
67 for (int j=1;j<numberof+1;j++)
68 cout << myArray->getIJ(i,j) << " " ;
72 MESSAGE("Show all 0 :");
73 numberof = myArray->getLeadingValue() ;
74 int length = myArray->getLengthValue() ;
75 const int * NoInterlaceArray = myArray->get(MED_NO_INTERLACE) ;
76 for (int i=0; i<length ; i++) {
78 for (int j=0;j<numberof;j++)
79 cout << NoInterlaceArray[j*length+i] << " " ;