]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
Add a test of WR of a umesh having no cells but having nodes.
authorageay <ageay>
Thu, 22 Aug 2013 11:20:40 +0000 (11:20 +0000)
committerageay <ageay>
Thu, 22 Aug 2013 11:20:40 +0000 (11:20 +0000)
src/MEDLoader/Swig/MEDLoaderTest3.py

index 1e259e578f4071cf024b77021bc9d56bcb84c6ab..924ce9ca53e36cc77f5b532e454d66ffc64f89ab 100644 (file)
@@ -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()