_coords=DataArrayDouble::New();
_coords->alloc(nCoords,spaceDim);
double *coordsPtr(_coords->getPointer());
- MEDFILESAFECALLERRD0(MEDmeshNodeCoordinateRd,(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,coordsPtr));
+ if (nCoords)
+ MEDFILESAFECALLERRD0(MEDmeshNodeCoordinateRd,(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,coordsPtr));
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
_fam_coords=DataArrayInt::New();
pass
pass
+ def testEmptyMesh(self):
+ fname = "empty_mesh.med"
+ m = MEDCouplingUMesh('toto', 2)
+ m.setCoords(DataArrayDouble([], 0, 2))
+ m.setConnectivity(DataArrayInt([]), DataArrayInt([0]))
+ mfu = MEDFileUMesh()
+ mfu.setMeshAtLevel(0, m)
+ mfu.write(fname, 2)
+ mfu2 = MEDFileUMesh(fname)
+ self.assertEqual('toto', mfu2.getName())
+ lvl = mfu2.getNonEmptyLevels()
+ self.assertEqual((), lvl)
+
pass
-unittest.main()
+if __name__ == "__main__":
+ unittest.main()