From: ageay Date: Thu, 22 Aug 2013 11:20:40 +0000 (+0000) Subject: Add a test of WR of a umesh having no cells but having nodes. X-Git-Tag: B4AnonymousThrow~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=888263d9f9e4e0e485861e549406ebe87cc879c7;p=modules%2Fmed.git Add a test of WR of a umesh having no cells but having nodes. --- 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()