med file / MED library : names of entities
Hello,
I'd like to read/write meshes in Med file format using MEDMEM or MEDCoupling libraries provided by Salome :
med file -> MED mesh data structure -> med file
without losing the information on the names of the mesh entities (indeed, in Med File format, one can store both the number and the name of each entity).
Is there a way to do that ? (the GMESH and MEDCouplingMesh classes don't seem to provide such a feature)
PhL
Hi,
Yes indeed in MEDCoupling/MEDLoader actually there is no way to manipulate names on entity. But numbers on entity are managed by MEDLoader.
Maybe it is possible for you, to store the information of names using families and groups concept.
Furthermore, concerning your question about MEDMEM_Swig on windows (Sorry I've completely forgotten)
The environement is not set properly in windows package. You need
in PYTHONPATH=%MED_ROOT_DIR%/bin/salome ; %MED_ROOT_DIR%/lib/python2.6/site-packages/salome
in PATH = %MED_ROOT_DIR%/lib/salome
For your information, I encourage you to use MEDCoupling/MEDLoader instead of MEDMEM because MEDMEM is planned to be removed for Salome7.
Best regards,
Anthony
Thank you Anthony for the warning about MEDMEM : I need to switch from MEDMEM to MED Coupling/Loader.
But one thing remains not so clear for me : when the user of Salome/SMESH builds a mesh, he can see the numbers of his mesh entities (nodes, cells) on the screen ; but when Salome exports the mesh as a med file, are these numbers stored in the med file ? And if so, can I retrieve these numbers with MED Loader and store them in some MED Coupling data structure ?
At last, just a naive question : the only way to read/write med files from Python is MEDMEM/MED Loader ? (I mean med file team doesn't provide a Python API ?)
Thanks,
PhL
Previously Anthony GEAY wrote:
Hi,
Yes indeed in MEDCoupling/MEDLoader actually there is no way to manipulate names on entity. But numbers on entity are managed by MEDLoader.
Maybe it is possible for you, to store the information of names using families and groups concept.
Furthermore, concerning your question about MEDMEM_Swig on windows (Sorry I've completely forgotten)
The environement is not set properly in windows package. You need
in PYTHONPATH=%MED_ROOT_DIR%/bin/salome ; %MED_ROOT_DIR%/lib/python2.6/site-packages/salome
in PATH = %MED_ROOT_DIR%/lib/salome
For your information, I encourage you to use MEDCoupling/MEDLoader instead of MEDMEM because MEDMEM is planned to be removed for Salome7.
Best regards,
Anthony
Hi Philippe,
Sorry for the delay again. Yes the numbers are in the exported med file of SMESH.
Yes it is possible to handle it under MEDLoader.
########
from MEDLoader import *
m=MEDFileMesh.New("myFileComingFromSMESH.med")
ids0=m.getNumberFieldAtLevel(0) # ids of cells at max level 3D typically
idsM1=m.getNumberFieldAtLevel(-1) # ids of cells at max level-1 2D typically
# ...
To finish the answer to your last question, no there is no lower python API available than those in MEDLoader/MEDMEM.
But the advanced API of MEDLoader allows you to cover a large range of MED file API normally.
Regards,
Thanks Anthony. That's quite clear now.
PhL
Previously Anthony GEAY wrote:
Hi Philippe,
Sorry for the delay again. Yes the numbers are in the exported med file of SMESH.
Yes it is possible to handle it under MEDLoader.
########
from MEDLoader import *
m=MEDFileMesh.New("myFileComingFromSMESH.med")
ids0=m.getNumberFieldAtLevel(0) # ids of cells at max level 3D typically
idsM1=m.getNumberFieldAtLevel(-1) # ids of cells at max level-1 2D typically
# ...
To finish the answer to your last question, no there is no lower python API available than those in MEDLoader/MEDMEM.
But the advanced API of MEDLoader allows you to cover a large range of MED file API normally.
Regards,
