Personal tools
You are here: Home Forum Use med file / MED library : names of entities

med file / MED library : names of entities

Up to Use

med file / MED library : names of entities

Posted by Philippe Leveque at October 17. 2012

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 

 

Re: med file / MED library : names of entities

Posted by Anthony GEAY at October 17. 2012

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

 

Re: med file / MED library : names of entities

Posted by Philippe Leveque at October 18. 2012

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

 

 

Re: med file / MED library : names of entities

Posted by Anthony GEAY at October 26. 2012

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,

Re: med file / MED library : names of entities

Posted by Philippe Leveque at October 26. 2012

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,

 

Powered by Ploneboard
Document Actions