From 617e46e41330de1183fa905d85a02c821cc6050f Mon Sep 17 00:00:00 2001 From: ageay Date: Thu, 22 Aug 2013 11:20:40 +0000 Subject: [PATCH] Add a test of WR of a umesh having no cells but having nodes. --- src/MEDLoader/Swig/MEDLoaderTest3.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index 1e259e578..924ce9ca5 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -3334,7 +3334,25 @@ class MEDLoaderTest(unittest.TestCase): f.setArray(vals) f1ts.setFieldProfile(f,mm,0,pfl) pass - + + def testWRMeshWithNoCells(self): + fname="Pyfile71.med" + a=DataArrayDouble(4) ; a.iota() + c=MEDCouplingCMesh() ; c.setCoords(a,a) ; m0=c.buildUnstructured() + m00=MEDCouplingUMesh("mesh",1) ; m00.setCoords(m0.getCoords()) ; m00.allocateCells(0) + m=MEDFileUMesh() + m.setMeshAtLevel(0,m00) + m.setRenumFieldArr(1,DataArrayInt(range(10,26))) + m.setFamilyFieldArr(1,DataArrayInt([-1,-1,-1,-1,-1,-2,-2,-2,-2,-2,-2,0,-1,-3,-3,-3])) + m.write(fname,2) + del m,a,c,m0,m00 + # + m=MEDFileMesh.New(fname) + self.assertEqual((),m.getNonEmptyLevels()) + self.assertTrue(m.getCoords().isEqual(DataArrayDouble([(0,0),(1,0),(2,0),(3,0),(0,1),(1,1),(2,1),(3,1),(0,2),(1,2),(2,2),(3,2),(0,3),(1,3),(2,3),(3,3)]),1e-12)) + self.assertTrue(m.getNumberFieldAtLevel(1).isEqual(DataArrayInt(range(10,26)))) + self.assertTrue(m.getFamilyFieldAtLevel(1).isEqual(DataArrayInt([-1,-1,-1,-1,-1,-2,-2,-2,-2,-2,-2,0,-1,-3,-3,-3]))) + pass pass unittest.main() -- 2.39.2