si ``MEDLoader`` a été chargé. ::
import MEDLoader as ml
- from MEDLoader import MEDLoader
Lecture, écriture d'un maillage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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)
.. note:: Le maillage ``targetMesh`` est ordonné par type géométrique.
Nous construisons ensuite ``targetMesh1`` représentant les sous-constituants (*faces*) du maillage
-``targetMesh`` reduits aux cellules [3,4,7,8]. Cela peut par exemple représenter un ensemble d'intérêt pour un calcul : ::
+``targetMesh``, et nous en extrayons seulement les cellules (donc ici des surfaces) [3,4,7,8].
+Pour plus de détails sur la connectivité descendante,
+consulter la section :ref:`exo-umesh-desc-connec` du deuxième exercise.
+Cet ensemble peut par exemple représenter un ensemble d'intérêt pour un calcul : ::
targetMeshConsti, _, _, _, _ = targetMesh.buildDescendingConnectivity()
targetMesh1 = targetMeshConsti[[3,4,7,8]]
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")
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)
Solution