1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "MEDMEM_Array.hxx"
26 using namespace MEDMEM;
27 int main (int argc, char ** argv) {
29 int SpaceDimension = 3 ;
30 int NumberOfNodes = 4 ;
31 MEDARRAY<int> * myArray = new MEDARRAY<int>(SpaceDimension,NumberOfNodes,MED_EN::MED_FULL_INTERLACE) ;
33 //const int * value = myArray->get(MED_FULL_INTERLACE) ;
34 for (int i=1; i<=NumberOfNodes; i++)
35 for (int j=1; j<=SpaceDimension; j++)
36 myArray->setIJ(i,j,i) ;
39 MESSAGE_MED("Show all 1 :");
40 numberof = myArray->getLeadingValue() ;
41 for (int i=1; i<=myArray->getLengthValue() ; i++) {
42 //int * node = myArray->getI(MED_FULL_INTERLACE,i) ;
43 const int * node = myArray->getRow(i) ;
45 for (int j=0;j<numberof;j++)
46 cout << node[j] << " " ;
49 MESSAGE_MED("Show all 2 :");
50 numberof = myArray->getLengthValue() ;
51 for (int i=1; i<=myArray->getLeadingValue() ; i++) {
52 //int * node = myArray->getJ(MED_NO_INTERLACE,i) ;
53 const int * node = myArray->getColumn(i) ;
55 for (int j=0;j<numberof;j++)
56 cout << node[j] << " " ;
59 MESSAGE_MED("Show all 3 :");
60 numberof = myArray->getLeadingValue() ;
61 for (int i=1; i<=myArray->getLengthValue() ; i++) {
63 for (int j=1;j<numberof+1;j++)
64 cout << myArray->getIJ(i,j) << " " ;
68 MESSAGE_MED("Show all 0 :");
69 numberof = myArray->getLeadingValue() ;
70 int length = myArray->getLengthValue() ;
71 const int * NoInterlaceArray = myArray->get(MED_EN::MED_NO_INTERLACE) ;
72 for (int i=0; i<length ; i++) {
74 for (int j=0;j<numberof;j++)
75 cout << NoInterlaceArray[j*length+i] << " " ;