]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
MEDCouplingFieldInt should always be filled with DAInt32 ... abn/portability
authorabn <adrien.bruneton@cea.fr>
Mon, 28 Sep 2020 09:49:17 +0000 (11:49 +0200)
committerabn <adrien.bruneton@cea.fr>
Mon, 28 Sep 2020 09:49:17 +0000 (11:49 +0200)
src/MEDLoader/Swig/MEDLoaderDataForTest.py
src/MEDLoader/Swig/MEDLoaderTest1.py
src/MEDLoader/Test/MEDLoaderTest.cxx

index 3fd2f7b384eb29930af2eb2d8000617824543ef6..348247b38a92bcbe58672dbea5e3ca62ad09d69e 100644 (file)
@@ -415,7 +415,7 @@ class MEDLoaderDataForTest:
         f1=MEDCouplingFieldInt.New(ON_CELLS,ONE_TIME);
         f1.setName("IntVectorFieldOnCells");
         f1.setMesh(mesh);
-        array=DataArrayInt([0,10,20,1,11,21,2,12,22,3,13,23,4,14,24,5,15,25],nbOfCells ,3)
+        array=DataArrayInt32([0,10,20,1,11,21,2,12,22,3,13,23,4,14,24,5,15,25],nbOfCells ,3)
         array.setInfoOnComponent(0,"va1 [MW/m^3]");
         array.setInfoOnComponent(1,"va2 [g/cm^3]");
         array.setInfoOnComponent(2,"val3 [K]");
index 41455fb3cd0949886a2810f29b6912c1d0545784..248b00f56aa592f3e25b1d98f6f4a6026c235c1f 100644 (file)
@@ -114,7 +114,7 @@ class MEDLoaderTest1(unittest.TestCase):
         f2_int=MEDLoader.ReadFieldCell(fileName,f1_int.getMesh().getName(),0,f1_int.getName(),8,9);
         self.assertTrue(f1_int.isEqual(f2_int,1e-12,0));  # exact comparison here
         f2_fl=MEDLoader.ReadFieldCell(fileName,f1_fl.getMesh().getName(),0,f1_fl.getName(),8,9);
-        self.assertTrue(f1_fl.isEqual(f2_fl,1e-12,1e-12));
+        self.assertTrue(f1_fl.isEqual(f2_fl,1e-12,1e-7)); # float comparison here 
         #ON NODES
         f1=MEDLoaderDataForTest.buildVecFieldOnNodes_1();
         fileName2="Pyfile9.med";
index 6a7480ddf7796c08e25afff2efed827eb2382d08..4067c19759fc5ee1d8ba0a9fed3de8524f52a18c 100644 (file)
@@ -158,9 +158,11 @@ void MEDLoaderTest::testFieldRW2()
   MEDCouplingFieldInt *f2_int=dynamic_cast<MEDCouplingFieldInt *>(ReadFieldCell(fileName,f1_int->getMesh()->getName().c_str(),0,f1_int->getName().c_str(),8,9));
   CPPUNIT_ASSERT(f1_int->isEqual(f2_int,1e-12,0)); // exact equality for int values
   f2_int->decrRef();
+  f1_int->decrRef();
   MEDCouplingFieldFloat *f2_fl=dynamic_cast<MEDCouplingFieldFloat *>(ReadFieldCell(fileName,f1_fl->getMesh()->getName().c_str(),0,f1_fl->getName().c_str(),8,9));
-  CPPUNIT_ASSERT(f1_fl->isEqual(f2_fl,1e-12,1e-12));
+  CPPUNIT_ASSERT(f1_fl->isEqual(f2_fl,1e-12,1e-07f));  // float comparison
   f2_fl->decrRef();
+  f1_fl->decrRef();
   //ON NODES
   f1=buildVecFieldOnNodes_1();
   const char fileName2[]="file9.med";
@@ -1408,7 +1410,7 @@ MEDCouplingFieldInt *MEDLoaderTest::buildIntVecFieldOnCells_1()
   MEDCouplingFieldInt *f1=MEDCouplingFieldInt::New(ON_CELLS,ONE_TIME);
   f1->setName("IntVectorFieldOnCells");
   f1->setMesh(mesh);
-  DataArrayInt *array=DataArrayInt::New();
+  DataArrayInt32 *array=DataArrayInt32::New();
   array->alloc(nbOfCells,3);
   array->setInfoOnComponent(0,"val1 [MW/m^3]");
   array->setInfoOnComponent(1,"va2 [g/cm^3]");