MCAuto<MEDCouplingUMesh> mread(mmuPtr->getMeshAtLevel(m->getMeshDimension()-mm->getMeshDimension()));
if(f2->getTypeOfField()!=ON_NODES)
{
- m->tryToShareSameCoordsPermute(*mread,_EPS_FOR_NODE_COMP);
+ if(!m->getCoords()->isEqualWithoutConsideringStr(*mread->getCoords(),_EPS_FOR_NODE_COMP))
+ m->tryToShareSameCoordsPermute(*mread,_EPS_FOR_NODE_COMP);
+ else
+ mread->setCoords(m->getCoords());
DataArrayInt *part(NULL);
bool b(mread->areCellsIncludedIn(m,_COMP_FOR_CELL,part));
MCAuto<DataArrayInt> partSafe(part);
self.assertRaises(Exception,MEDLoader.ReadField,MEDLoader.ON_CELLS,fname,"mesh",0,"field2",5,5) # invalid time step
pass
+ def testMultiWriteFieldOnMergeableNodesMeshes(self):
+ fname="Pyfile120.med"
+ arr=MEDLoader.DataArrayDouble([(0,0),(1,0),(0,1),(0,0),(1,0),(0,1)])
+ m=MEDLoader.MEDCouplingUMesh("mesh",2)
+ m.setCoords(arr)
+ m.allocateCells()
+ m.insertNextCell(MEDLoader.NORM_TRI3,[0,4,2])
+ m.insertNextCell(MEDLoader.NORM_TRI3,[3,1,5])
+ m.setName("mesh")
+ #
+ f=MEDLoader.MEDCouplingFieldDouble(MEDLoader.ON_CELLS)
+ f.setMesh(m)
+ f.setArray(MEDLoader.DataArrayDouble([5,6]))
+ f.setName("field")
+ #
+ f.setTime(0.,0,0)
+ MEDLoader.WriteField(fname,f,True)
+ f.setTime(1.,1,0)
+ MEDLoader.WriteField(fname,f,False)
+ pass
+
pass
if __name__ == "__main__":