To read a mesh from a MED file simply invoke
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadMeshFromFile_1
:end-before: UG_ReadMeshFromFile_1
You can access to a precise mesh by doing
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadMeshFromFile_2
:end-before: UG_ReadMeshFromFile_2
Read field from file
--------------------
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadField_1
:end-before: UG_ReadField_1
To know all fields in "file.med" either you read exception thrown or you can invoke
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadField_2
:end-before: UG_ReadField_2
When you have the fieldName you can safely invoke.
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadField_3
:end-before: UG_ReadField_3
To retrieve list of time step of a field invoke
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadField_4
:end-before: UG_ReadField_4
To read a field "Field1" at time step defined by pair "(ts0,ts1)"
you can invoke
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadField_5
:end-before: UG_ReadField_5
You can check this by invoking:
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadMeshFromFile_3
:end-before: UG_ReadMeshFromFile_3
If *m* is well numbered, you can dump it into a file by doing :
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadMeshFromFile_0
:end-before: UG_ReadMeshFromFile_0
If *f* is a valid MEDCouplingFieldDouble you can dump it into a MED file by simply :
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadField_0
:end-before: UG_ReadField_0
.. WARNING:: All meshes of elements in *fs* are expected to be the same
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadField_6
:end-before: UG_ReadField_6
First of all we populate a MEDFileUMesh with meshes (MEDCouplingUMesh) of different dimensions, if present:
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadMeshFromFile_4
:end-before: UG_ReadMeshFromFile_4
If cells are not yet sorted by geometric type, we can pass True as the third argument of setMeshAtLevel to make them sorted:
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadMeshFromFile_9
:end-before: UG_ReadMeshFromFile_9
We can change point coordinates as soon as all meshes are added:
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadMeshFromFile_5
:end-before: UG_ReadMeshFromFile_5
To define groups we call, for example:
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadMeshFromFile_6
:end-before: UG_ReadMeshFromFile_6
It is possible to change name of a group or a family by calling:
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadMeshFromFile_7
:end-before: UG_ReadMeshFromFile_7
Finally we write all data added to *mm* to a file:
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_ReadMeshFromFile_8
:end-before: UG_ReadMeshFromFile_8
.. _MEDFileField1TS: ../../developer/classMEDCoupling_1_1MEDFileField1TS.html
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_RWFieldAdv_0
:end-before: UG_RWFieldAdv_0
If there is a need to write a field lying only on a part of a mesh, the following code gives an example of this:
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_RWFieldAdv_1
:end-before: UG_RWFieldAdv_1
MEDFileField1TS also can be used to read a field:
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_RWFieldAdv_2
:end-before: UG_RWFieldAdv_2
*level* of a field, if unknown, can be defined by calling:
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_RWFieldAdv_3
:end-before: UG_RWFieldAdv_3
.. _MEDFileFieldMultiTS: ../../developer/classMEDCoupling_1_1MEDFileFieldMultiTS.html
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_RWFieldAdv_4
:end-before: UG_RWFieldAdv_4
To read a time step with a known *iteration* and *order* MEDFileField1TS can be used as shown above. To iterate through all time steps, use MEDFileFieldMultiTS as following:
-.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest.py
+.. literalinclude:: ../../../src/MEDLoader/Swig/UsersGuideExamplesTest_ML.py
:start-after: UG_RWFieldAdv_5
:end-before: UG_RWFieldAdv_5