Back to index

salome-med  6.5.0
MEDMEMTest_nArray.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #include "MEDMEMTest.hxx"
00021 #include <cppunit/Message.h>
00022 #include <cppunit/TestAssert.h>
00023 
00024 #include "MEDMEM_nArray.hxx"
00025 #include "MEDMEM_define.hxx"
00026 #include "MEDMEM_ArrayConvert.hxx"
00027 
00028 #include <sstream>
00029 #include <cmath>
00030 
00031 // use this define to enable lines, execution of which leads to Segmentation Fault
00032 //#define ENABLE_FAULTS
00033 
00034 // use this define to enable CPPUNIT asserts and fails, showing bugs
00035 //#define ENABLE_FORCED_FAILURES
00036 
00037 using namespace std;
00038 using namespace MEDMEM;
00039 using namespace MED_EN;
00040 
00081 void MEDMEMTest::testnArray()
00082 {
00083   const int mdim = 2;
00084   const int nbelem1 = 20;
00085   const double EPS = 0.00001;
00086 
00088   // TEST 1  FullInterlace et NoGauss    //
00090   const double * myArray1Ptr = 0;
00091   const double array1Ref[]  = { 11 , 12 , 21 , 22 , 31 , 32 , 41 , 42 , 51 , 52 ,
00092                                61 , 62 , 71 , 72 , 81 , 82 , 91 , 92 , 101 , 102 ,
00093                                111 , 112 , 121 , 122 , 131 , 132 , 141 , 142 ,
00094                                151 , 152 , 161 , 162 , 171 , 172 , 181 , 182 ,
00095                                191 , 192 , 201 , 202 };
00096 
00097   const double array2Ref[] = { 11 , 21 , 31 , 41 , 51 , 61 , 71 , 81 , 91 , 101
00098                                , 111 , 121 , 131 , 141 , 151 , 161 , 171 , 181
00099                                , 191 , 201 ,
00100                                12 , 22 , 32 , 42 , 52 , 62 , 72 , 82 , 92 , 102
00101                                , 112 , 122 , 132 , 142 , 152 , 162 , 172 , 182
00102                                , 192 , 202 };
00103 
00104   //test MEDMEM_Array(int dim, int nbelem)
00105   MEDMEM_Array<double>  myArray1(mdim,nbelem1);
00106   //test getGaussPresence
00107   CPPUNIT_ASSERT( !myArray1.getGaussPresence());
00108 
00109   //test setIJ. Fill array
00110   for (int i =1; i <= nbelem1; i++)
00111     for (int j =1; j <= mdim; j++)
00112     {
00113       CPPUNIT_ASSERT_NO_THROW(myArray1.setIJ(i,j,i*10+j));
00114     }
00115 
00116   //test getPtr
00117   myArray1Ptr = myArray1.getPtr();
00118   for (int i = 0; i < mdim*nbelem1; i++)
00119     CPPUNIT_ASSERT( myArray1Ptr[i] == array1Ref[i] );
00120 
00121   {
00122     //test MEDMEM_Array(ElementType * values, int dim, int nbelem, bool shallowCopy=false, bool ownershipOfValues=false)
00123     MEDMEM_Array<double> myArray1val ((double*)array1Ref, mdim, nbelem1);
00124     myArray1Ptr = myArray1val.getPtr();
00125     for (int i = 0; i < mdim*nbelem1; i++)
00126       CPPUNIT_ASSERT( myArray1Ptr[i] == array1Ref[i] );
00127 
00128     //test MEDMEM_Array(ElementType * values, int dim, int nbelem, bool shallowCopy=true, bool ownershipOfValues=false);
00129     MEDMEM_Array<double> myArray1valsh ((double*)array1Ref, mdim, nbelem1, true);
00130     myArray1Ptr = myArray1valsh.getPtr();
00131     for (int i = 0; i < mdim*nbelem1; i++)
00132       CPPUNIT_ASSERT( myArray1Ptr[i] == array1Ref[i] );
00133 
00134     //test setPtr
00135     double myPtr[10] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, 0};
00136     CPPUNIT_ASSERT_NO_THROW(myArray1valsh.setPtr(myPtr));
00137     //size the array stays the same, only first 10 element are being overwritten
00138     myArray1Ptr = myArray1valsh.getPtr();
00139     for (int i = 0; i < 10; i++)
00140       CPPUNIT_ASSERT_DOUBLES_EQUAL(myArray1Ptr[i], myPtr[i], EPS);
00141   }
00142 
00143   //test MEDMEM_Array(ElementType * values, int dim, int nbelem, bool shallowCopy=true, bool ownershipOfValues=true);
00144   {
00145     double * array1Ref_do_not_delete = new double[40];
00146     for (int i = 0; i < 40; i = i + 2) {
00147       array1Ref_do_not_delete[i  ] = 10.0 * (i+1) + 1;
00148       array1Ref_do_not_delete[i+1] = 10.0 * (i+1) + 2;
00149     }
00150     MEDMEM_Array<double> myArray1valow (array1Ref_do_not_delete, mdim, nbelem1, true, true);
00151   }
00152 
00153   //test MEDMEM_Array(const MEDMEM_Array & array, bool shallowCopy=false)
00154   MEDMEM_Array<double> myArray1bis (myArray1, false);
00155   CPPUNIT_ASSERT(myArray1 == myArray1bis);
00156 
00157   myArray1Ptr = myArray1bis.getPtr();
00158   for (int i =0; i < mdim*nbelem1; i++)
00159     CPPUNIT_ASSERT( myArray1Ptr[i] == array1Ref[i] );
00160 
00161   //test MEDMEM_Array()
00162   MEDMEM_Array<double> myArray1ter;
00163   try
00164   {
00165     myArray1ter = myArray1;
00166     myArray1Ptr = myArray1ter.getPtr();
00167   }
00168   catch ( const std::exception &e )
00169   {
00170     CPPUNIT_FAIL(e.what());
00171   }
00172   catch (...)
00173   {
00174     CPPUNIT_FAIL("Unknown exception");
00175   }
00176 
00177   for (int i =0; i < mdim*nbelem1; i++)
00178     CPPUNIT_ASSERT( myArray1Ptr[i] == array1Ref[i] );
00179 
00180   MEDMEM_Array<double> myArray1qua(mdim,nbelem1);
00181   myArray1Ptr = myArray1qua.getPtr();
00182 
00183   for (int i =1; i <= nbelem1; i++)
00184   {
00185     try {
00186       //test setRow(int i,const ElementType * const value)
00187       myArray1qua.setRow(i,&array1Ref[(i-1)*mdim]);
00188     }
00189     catch (MEDMEM::MEDEXCEPTION &m) {
00190       CPPUNIT_FAIL(m.what());
00191     }
00192     catch (...)
00193     {
00194       CPPUNIT_FAIL("Unknown exception");
00195     }
00196   }
00197 
00198   for (int i =0; i < mdim*nbelem1; i++)
00199     CPPUNIT_ASSERT( myArray1Ptr[i] == array1Ref[i] );
00200 
00201   //test getColumn(int j)
00202   CPPUNIT_ASSERT_THROW(myArray1qua.getColumn(1), MEDEXCEPTION);
00203 
00204   MEDMEM_Array<double,NoInterlaceNoGaussPolicy> * myArray1cin = ArrayConvert(myArray1);
00205   myArray1Ptr = myArray1cin->getPtr();
00206   int elemno = 0;
00207   for (int j=1; j <= mdim; j++)
00208     for (int  i=1; i <= nbelem1 ; i++ ) {
00209       CPPUNIT_ASSERT(  myArray1cin->getIJ(i,j) ==  array2Ref[elemno] );
00210       CPPUNIT_ASSERT(  myArray1Ptr[elemno]     ==  array2Ref[elemno] );
00211       elemno++;
00212     }
00213   delete myArray1cin;
00215   // TEST 2   NoInterlace et NoGauss //
00217   {
00218     const double * myArray2Ptr = 0;
00219     //MEDMEM_Array(int dim, int nbelem)
00220     MEDMEM_Array<double,NoInterlaceNoGaussPolicy> myArray2(mdim,nbelem1);
00221 
00222     for (int i =1; i <= nbelem1; i++) {
00223       for (int j =1; j <= mdim; j++) {
00224         //test setIJ(int i, int j, const ElementType & value)
00225         CPPUNIT_ASSERT_NO_THROW(myArray2.setIJ(i,j,i*10+j));
00226       }
00227     }
00228 
00229     //test getPtr()
00230     myArray2Ptr = myArray2.getPtr();
00231     for (int i =0; i < mdim*nbelem1; i++)
00232       CPPUNIT_ASSERT( myArray2Ptr[i] == array2Ref[i] );
00233 
00234     //test MEDMEM_Array(const MEDMEM_Array & array, bool shallowCopy=false)
00235     MEDMEM_Array<double,NoInterlaceNoGaussPolicy> myArray2bis(myArray2, false);
00236     myArray2Ptr = myArray2bis.getPtr();
00237     for (int i =0; i < mdim*nbelem1; i++)
00238       CPPUNIT_ASSERT( myArray2Ptr[i] == array2Ref[i] );
00239 
00240     //test MEDMEM_Array()
00241     MEDMEM_Array<double,NoInterlaceNoGaussPolicy> myArray2ter;
00242     //test operator=(const MEDMEM_Array & array)
00243     myArray2ter = myArray2;
00244     //test getPtr
00245     myArray2Ptr = myArray2ter.getPtr();
00246     for (int i =0; i < mdim*nbelem1; i++)
00247       CPPUNIT_ASSERT( myArray2Ptr[i] == array2Ref[i] );
00248 
00249     MEDMEM_Array<double,NoInterlaceNoGaussPolicy> myArray2qua(mdim,nbelem1);
00250     myArray2Ptr = myArray2qua.getPtr();
00251 
00252     for (int j = 1; j <= mdim; j++) {
00253       //test setColumn(int j, const ElementType * const value)
00254       CPPUNIT_ASSERT_NO_THROW(myArray2qua.setColumn(j,&array2Ref[nbelem1*(j-1)]));
00255     }
00256 
00257     for (int i =0; i < mdim*nbelem1; i++)
00258       CPPUNIT_ASSERT( myArray2Ptr[i] == array2Ref[i] );
00259 
00260     //test getRow(int i)
00261     CPPUNIT_ASSERT_THROW(myArray2qua.getRow(1), MEDEXCEPTION);
00262 
00263     MEDMEM_Array<double,FullInterlaceNoGaussPolicy> * myArray2cin = ArrayConvert(myArray2);
00264     myArray2Ptr = myArray2cin->getPtr();
00265     elemno = 0;
00266     for (int  i=1; i <= nbelem1 ; i++) {
00267       for (int j=1; j <= mdim; j++) {
00268         CPPUNIT_ASSERT(  myArray2cin->getIJ(i,j) ==  array1Ref[elemno] );
00269         CPPUNIT_ASSERT(  myArray2Ptr[elemno]     ==  array1Ref[elemno] );
00270         elemno++;
00271       }
00272     }
00273     delete myArray2cin;
00274   }
00275 
00277   // TEST 3   FullInterlace et Gauss  //
00279   const int nbelem2 = 5;
00280   const int nbtypegeo = 2;
00281   const int nbelgeoc[nbtypegeo+1]   = {1,3,6};
00282   const int nbgaussgeo[nbtypegeo+1] = {-1,2,3};
00283 
00284   const double * myArray3Ptr = 0;
00285   const double array3Ref[] = {1.11 , 1.12 , 1.21 , 1.22 ,
00286                               2.11 , 2.12 , 2.21 , 2.22 ,
00287                               13.11 , 13.12 , 13.21 , 13.22 , 13.31 , 13.32 ,
00288                               14.11 , 14.12 , 14.21 , 14.22 , 14.31 , 14.32 ,
00289                               15.11 , 15.12 , 15.21 , 15.22 , 15.31 , 15.32 };
00290 
00291   const double array4Ref[] = { 1.11 , 1.21 , 2.11 , 2.21,
00292                                13.11 , 13.21 , 13.31 , 14.11 , 14.21 , 14.31 ,
00293                                15.11 , 15.21 , 15.31 ,
00294                                1.12 , 1.22 , 2.12 , 2.22 ,
00295                                13.12 , 13.22 , 13.32 , 14.12 , 14.22 , 14.32 ,
00296                                15.12 , 15.22 , 15.32 };
00297 
00298   const int array5Ref[] =    { 1 , 1 , 2 , 2,
00299                                13 , 13 , 13 , 14 , 14 , 14 ,
00300                                15 , 15 , 15 ,
00301                                1 , 1 , 2 , 2 ,
00302                                13 , 13 , 13 , 14 , 14 , 14 ,
00303                                15 , 15 , 15 };
00304 
00305   //test MEDMEM_Array(int dim, int nbelem, int nbtypegeo, const int * const  nbelgeoc, const int * const nbgaussgeo)
00306   MEDMEM_Array<double,FullInterlaceGaussPolicy> myArray3(mdim,nbelem2,nbtypegeo,nbelgeoc,nbgaussgeo);
00307 
00308   elemno = 1;
00309    for (int ntyp=1; ntyp <= nbtypegeo; ntyp++ ) {
00310     for (int  i=0; i < (nbelgeoc[ntyp]-nbelgeoc[ntyp-1]) ; i++ ) {
00311       for (int k=1; k <= nbgaussgeo[ntyp]; k++)
00312         for (int j=1; j <= mdim; j++) {
00313           try{
00314             //test setIJK(int i, int j, int k, const ElementType & value)
00315             myArray3.setIJK(elemno,j,k,elemno+(ntyp-1)*10+0.1*k+0.01*j);
00316           }
00317           catch (MEDMEM::MEDEXCEPTION &m) {
00318             CPPUNIT_FAIL(m.what());
00319           }
00320           catch (...)
00321           {
00322             CPPUNIT_FAIL("Unknown exception");
00323           }
00324         }
00325       elemno++;
00326     }
00327   }
00328 
00329   myArray3Ptr = myArray3.getPtr();
00330   for (int i =0; i < myArray3.getArraySize(); i++)
00331     CPPUNIT_ASSERT_DOUBLES_EQUAL(myArray3Ptr[i], array3Ref[i], EPS);
00332 
00333   MEDMEM_Array<double,FullInterlaceGaussPolicy> myArray3bis(myArray3, false);
00334   myArray3Ptr = myArray3bis.getPtr();
00335 
00336   elemno = 0;
00337   for (int  i=1; i < nbelgeoc[nbtypegeo] ; i++ )
00338     for (int k=1; k <= myArray3bis.getNbGauss(i); k++)
00339       for (int j=1; j <= mdim; j++) {
00340           CPPUNIT_ASSERT_DOUBLES_EQUAL( myArray3bis.getIJK(i,j,k), array3Ref[elemno], EPS );
00341           CPPUNIT_ASSERT_DOUBLES_EQUAL( myArray3Ptr[elemno], array3Ref[elemno], EPS );
00342         elemno++;
00343       }
00344 
00345   //test MEDMEM_Array()
00346   MEDMEM_Array<double,FullInterlaceGaussPolicy> myArray3ter;
00347   //test operator=(const MEDMEM_Array & array)
00348   myArray3ter = myArray3;
00349   myArray3Ptr = myArray3ter.getPtr();
00350 
00351   elemno = 0;
00352   for (int  i=1; i < nbelgeoc[nbtypegeo] ; i++ )
00353     for (int k=1; k <= myArray3ter.getNbGauss(i); k++)
00354       for (int j=1; j <= mdim; j++) {
00355          CPPUNIT_ASSERT_DOUBLES_EQUAL( myArray3ter.getIJK(i,j,k), array3Ref[elemno], EPS );
00356          CPPUNIT_ASSERT_DOUBLES_EQUAL( myArray3Ptr[elemno], array3Ref[elemno], EPS );
00357         elemno++;
00358       }
00359 
00360   MEDMEM_Array<double,FullInterlaceGaussPolicy> myArray3qua(mdim,nbelem2,
00361                                                             nbtypegeo,nbelgeoc,nbgaussgeo);
00362   myArray3Ptr = myArray3qua.getPtr();
00363 
00364   int cumul = 0;
00365   for (int i =1; i <= nbelem2; i++){
00366     try{
00367       myArray3qua.setRow(i,&array3Ref[cumul]);
00368       cumul+=myArray3qua.getNbGauss(i)*mdim;
00369     }
00370     catch (MEDMEM::MEDEXCEPTION &m) {
00371       CPPUNIT_FAIL(m.what());
00372     }
00373     catch (...)
00374     {
00375       CPPUNIT_FAIL("Unknown exception");
00376     }
00377   };
00378 
00379   for (int i =0; i < myArray3qua.getArraySize(); i++) {
00380     CPPUNIT_ASSERT_DOUBLES_EQUAL( myArray3Ptr[i], array3Ref[i], EPS );
00381   }
00382 
00383   MEDMEM_Array<double,NoInterlaceGaussPolicy> * myArray3cin = ArrayConvert(myArray3);
00384   myArray3Ptr = myArray3cin->getPtr();
00385   elemno = 0;
00386   for (int j=1; j <= mdim; j++)
00387     for (int  i=1; i < nbelgeoc[nbtypegeo] ; i++ )
00388       for (int k=1; k <= myArray3cin->getNbGauss(i); k++) {
00389         CPPUNIT_ASSERT_DOUBLES_EQUAL( myArray3cin->getIJK(i,j,k), array4Ref[elemno], EPS );
00390         CPPUNIT_ASSERT_DOUBLES_EQUAL(myArray3Ptr[elemno], array4Ref[elemno], EPS );
00391         elemno++;
00392       }
00393   delete myArray3cin;
00395   // TEST 4   NoInterlace et Gauss  //
00397   const double * myArray4Ptr = 0;
00398   //test MEDMEM_Array(int dim, int nbelem, int nbtypegeo, const int * const  nbelgeoc, const int * const nbgaussgeo)
00399   MEDMEM_Array<double,NoInterlaceGaussPolicy> myArray4(mdim,nbelem2,nbtypegeo,nbelgeoc,nbgaussgeo);
00400 
00401   elemno = 1;
00402    for (int ntyp=1; ntyp <= nbtypegeo; ntyp++ ) {
00403     for (int  i=0; i < (nbelgeoc[ntyp]-nbelgeoc[ntyp-1]) ; i++ ) {
00404       for (int k=1; k <= nbgaussgeo[ntyp]; k++)
00405         for (int j=1; j <= mdim; j++) {
00406           try{
00407             //test setIJK(int i, int j, int k, const ElementType & value)
00408             myArray4.setIJK(elemno,j,k,elemno+(ntyp-1)*10+0.1*k+0.01*j);
00409           }
00410           catch (MEDMEM::MEDEXCEPTION &m) {
00411             CPPUNIT_FAIL(m.what());
00412           }
00413           catch (...)
00414           {
00415             CPPUNIT_FAIL("Unknown exception");
00416           }
00417         }
00418       elemno++;
00419     }
00420   }
00421 
00422    //test getPtr()
00423   myArray4Ptr = myArray4.getPtr();
00424   for (int i =0; i < myArray4.getArraySize(); i++) {
00425     CPPUNIT_ASSERT_DOUBLES_EQUAL( myArray4Ptr[i], array4Ref[i], EPS );
00426   }
00427 
00428   //test MEDMEM_Array(const MEDMEM_Array & array, bool shallowCopy=false)
00429   MEDMEM_Array<double,NoInterlaceGaussPolicy> myArray4bis(myArray4, false);
00430   myArray4Ptr = myArray4bis.getPtr();
00431 
00432   elemno = 0;
00433   for (int j=1; j <= mdim; j++)
00434     for (int  i=1; i < nbelgeoc[nbtypegeo] ; i++ )
00435       for (int k=1; k <= myArray4bis.getNbGauss(i); k++) {
00436         CPPUNIT_ASSERT_DOUBLES_EQUAL( myArray4bis.getIJK(i,j,k), array4Ref[elemno], EPS );
00437         CPPUNIT_ASSERT_DOUBLES_EQUAL( myArray4Ptr[elemno], array4Ref[elemno], EPS );
00438         elemno++;
00439       }
00440 
00441   //test MEDMEM_Array()
00442   MEDMEM_Array<double,NoInterlaceGaussPolicy> myArray4ter;
00443   //test operator=(const MEDMEM_Array & array)
00444   myArray4ter = myArray4;
00445   myArray4Ptr = myArray4ter.getPtr();
00446 
00447   elemno = 0;
00448   for (int j=1; j <= mdim; j++)
00449     for (int  i=1; i < nbelgeoc[nbtypegeo] ; i++ )
00450       for (int k=1; k <= myArray4ter.getNbGauss(i); k++) {
00451         CPPUNIT_ASSERT_DOUBLES_EQUAL( myArray4ter.getIJK(i,j,k), array4Ref[elemno], EPS );
00452         CPPUNIT_ASSERT_DOUBLES_EQUAL( myArray4Ptr[elemno], array4Ref[elemno], EPS );
00453         elemno++;
00454       }
00455 
00456   {
00457     MEDMEM_Array<double,NoInterlaceGaussPolicy> myArray4qua (mdim,nbelem2,nbtypegeo,nbelgeoc,nbgaussgeo);
00458     myArray4Ptr = myArray4qua.getPtr();
00459 
00460     for (int j = 1; j <= mdim; j++) {
00461       int k = (myArray4qua.getArraySize() / mdim) * (j - 1);
00462       CPPUNIT_ASSERT_NO_THROW(myArray4qua.setColumn(j, &array4Ref[k]));
00463     }
00464 
00465     for (int i =0; i < myArray4qua.getArraySize(); i++)
00466       CPPUNIT_ASSERT_DOUBLES_EQUAL( myArray4Ptr[i], array4Ref[i], EPS );
00467   }
00468 
00469   {
00470     MEDMEM_Array<double,FullInterlaceGaussPolicy> * myArray4cin = ArrayConvert(myArray4);
00471     myArray4Ptr = myArray4cin->getPtr();
00472     elemno = 0;
00473     for (int  i=1; i < nbelgeoc[nbtypegeo] ; i++ )
00474       for (int k=1; k <= myArray4cin->getNbGauss(i); k++)
00475         for (int j=1; j <= mdim; j++) {
00476           CPPUNIT_ASSERT_DOUBLES_EQUAL( myArray4cin->getIJK(i,j,k), array3Ref[elemno], EPS );
00477           CPPUNIT_ASSERT( myArray4cin->getIJK(i,j,k) == myArray3.getIJK(i,j,k) );
00478           CPPUNIT_ASSERT_DOUBLES_EQUAL( myArray4Ptr[elemno], array3Ref[elemno], EPS );
00479           elemno++;
00480         }
00481     delete myArray4cin;
00482   }
00483 
00484   CPPUNIT_ASSERT(myArray4bis.getInterlacingType() != MED_UNDEFINED_INTERLACE);
00485 
00486   CPPUNIT_ASSERT_THROW(myArray4.getIJ(0,2), MEDEXCEPTION);
00487 
00488   ostringstream os;
00489   //test operator<<(ostream & os, const MEDMEM_Array & array)
00490   os << myArray4;
00491   CPPUNIT_ASSERT(os.str() != "");
00492 
00493   const int * myArray5Ptr = 0;
00494   //test MEDMEM_Array(ElementType * values, int dim, int nbelem, int nbtypegeo,
00495   //                  const int * const  nbelgeoc, const int * const  nbgaussgeo,
00496   //                  bool shallowCopy=false, bool ownershipOfValues=false)
00497   MEDMEM_Array<int, NoInterlaceGaussPolicy> myArray5 ((int*)array5Ref, mdim, nbelem2,
00498                                                       nbtypegeo, nbelgeoc, nbgaussgeo);
00499   //test getGaussPresence
00500   CPPUNIT_ASSERT( myArray5.getGaussPresence());
00501 
00502   myArray5Ptr = myArray5.getPtr();
00503   for (int i =0; i < myArray5.getArraySize(); i++) {
00504     CPPUNIT_ASSERT_EQUAL( myArray5Ptr[i], array5Ref[i]);
00505   }
00506 
00507   //test MEDMEM_Array(const MEDMEM_Array & array, bool shallowCopy=false)
00508   MEDMEM_Array<int,NoInterlaceGaussPolicy> myArray5bis(myArray5, false);
00509   myArray5Ptr = myArray5bis.getPtr();
00510 
00511   elemno = 0;
00512   for (int j=1; j <= mdim; j++)
00513     for (int  i=1; i < nbelgeoc[nbtypegeo] ; i++ )
00514       for (int k=1; k <= myArray5bis.getNbGauss(i); k++) {
00515         CPPUNIT_ASSERT_EQUAL( myArray5bis.getIJK(i,j,k), array5Ref[elemno] );
00516         CPPUNIT_ASSERT_EQUAL( myArray5Ptr[elemno], array5Ref[elemno] );
00517         elemno++;
00518       }
00519 
00520   //MEDMEM_Array()
00521   MEDMEM_Array<int,NoInterlaceGaussPolicy> myArray5ter;
00522   //test setPtr(ElementType * values, bool shallowCopy=false, bool ownershipOfValues=false)
00523   CPPUNIT_ASSERT_NO_THROW(myArray5.setPtr((int*)array5Ref));
00524 
00525   //test getPtr()
00526   myArray5Ptr = myArray5ter.getPtr();
00527   for (int i =0; i < myArray5ter.getArraySize(); i++) {
00528     CPPUNIT_ASSERT_EQUAL( myArray5Ptr[i], array5Ref[i]);
00529   }
00530 }