::
import MEDLoader as ml
- from MEDLoader import MEDLoader
# Mesh creation
targetCoords = [-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 ]
targetConn = [0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4]
targetMesh.insertNextCell(ml.NORM_QUAD4,4,targetConn[0:4])
targetMesh.insertNextCell(ml.NORM_QUAD4,4,targetConn[10:14])
targetMesh.insertNextCell(ml.NORM_QUAD4,4,targetConn[14:18])
- targetMesh.finishInsertingCells()
myCoords = ml.DataArrayDouble(targetCoords,9,2)
myCoords.setInfoOnComponents(["X [km]","YY [mm]"])
targetMesh.setCoords(myCoords)
#
f = ml.MEDCouplingFieldDouble(ml.ON_CELLS, ml.ONE_TIME)
f.setTime(5.6,7,8)
- f.setArray(targetMesh.getBarycenterAndOwner())
+ f.setArray(targetMesh.computeCellCenterOfMass())
f.setMesh(targetMesh)
f.setName("AFieldName")
# Prepare field for writing
#
fMEDFileRead2 = ml.MEDFileField1TS("TargetMesh2.med",fPart.getName(),7,8)
fPartRead, pflRead = fMEDFileRead2.getFieldWithProfile(ml.ON_CELLS,0,meshMEDFileRead)
- print "Is the partial field correclty read?", fPartRead.isEqualWithoutConsideringStr(fPart.getArray(),1e-12)
+ print "Is the partial field correctly read?", fPartRead.isEqualWithoutConsideringStr(fPart.getArray(),1e-12)
print "Is the list of cell identifiers matching?", pflRead.isEqualWithoutConsideringStr(pfl)