From 08408e2a462ea895b9c6d0d16a23dd68d23cd0c2 Mon Sep 17 00:00:00 2001 From: ageay Date: Wed, 8 Feb 2012 11:12:00 +0000 Subject: [PATCH] Correction of bug. --- src/MEDLoader/Swig/MEDLoaderTest3.py | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index 80d9d6d06..ec772ef66 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -933,6 +933,39 @@ class MEDLoaderTest(unittest.TestCase): g=mm.getGroupArr(0,"g1") self.assertTrue(g.isEqual(g1)); pass + + # bug detected by gauthier + def testMEDLoaderMEDLoaderNSReadFieldDoubleDataInMedFile(self): + fname="Pyfile41.med" + f1=MEDLoaderDataForTest.buildVecFieldOnCells_1(); + m1=f1.getMesh() + mm1=MEDFileUMesh.New() + mm1.setCoords(m1.getCoords()) + mm1.setMeshAtLevel(0,m1) + mm1.write(fname,2) + ff1=MEDFileField1TS.New() + ff1.setFieldNoProfileSBT(f1) + ff1.write(fname,0) + # writing mesh1 and field1, now creation of mesh2 and field2 + f2=f1.deepCpy() + m2=f2.getMesh() + m2.translate([0.5,0.6,0.7]) + m2.setName("3DSurfMesh_2") + f2.getArray()[:]*=2. + f2.setName("VectorFieldOnCells2") + mm2=MEDFileUMesh.New() + mm2.setCoords(m2.getCoords()) + mm2.setMeshAtLevel(0,m2) + mm2.write(fname,0) + ff2=MEDFileField1TS.New() + ff2.setFieldNoProfileSBT(f2) + ff2.write(fname,0) + # + f3=MEDLoader.ReadFieldCell(fname,"3DSurfMesh_1",0,"VectorFieldOnCells",0,1) + self.assertTrue(f3.isEqual(f1,1e-12,1e-12)) + f4=MEDLoader.ReadFieldCell(fname,"3DSurfMesh_2",0,"VectorFieldOnCells2",0,1) + self.assertTrue(f4.isEqual(f2,1e-12,1e-12)) + pass pass unittest.main() -- 2.39.2