[Gmsh] Could not read MED families

Luca Dall'Olio luca.dallolio at alneos.fr
Mon May 21 16:31:36 CEST 2012


Dear Gmsh Team.

Here is as an attached file a small med 3.0.4 file that cannot be
opened in Gmsh 2.5.1-svn. FYI, it can be opened in Salome.
The file was created from an initial med file that Gmsh can read by
applying some algebraic operations on the fields it contains using
MEDLoader (a package in charge of loading from a file or write to a
file in MED format a med data structure).

dimrestriction =0
mesh=MEDLoader.ReadUMeshFromFile(medfilename,meshname,dimrestriction)
p1 = MEDLoader.ReadField(ON_NODES,medfilename,meshname,dimrestriction,fieldname,iteration1,order1)
p2 = MEDLoader.ReadField(ON_NODES,medfilename,meshname,dimrestriction,fieldname,iteration2,order2)
p1.setMesh(mesh)
p2.setMesh(mesh)
result=p2-p1
result.setName(fieldnameresu)
MEDLoader.WriteField(outfile,result,True)

The error raised by Gmsh is "Could not read MED families", that can be
found twice in Gmsh's sources :

Geo/GModelIO_MED.cpp:359:      Msg::Error("Could not read MED families");
Geo/GModelIO_MED.cpp:387:    Msg::Error("Could not read MED families");

#if (MED_MAJOR_NUM == 3)
    if(MEDmeshEntityFamilyNumberRd(fid, meshName, MED_NO_DT,
MED_NO_IT, MED_CELL,
                                   type, &fam[0]) < 0){
#else
    if(MEDfamLire(fid, meshName, &fam[0], numEle, MED_MAILLE, type) < 0){
#endif
      Msg::Error("Could not read MED families");
      return 0;
    }

And then :

  // read family info
  med_int numFamilies = MEDnFam(fid, meshName);
  if(numFamilies < 0){
    Msg::Error("Could not read MED families");
    return 0;
  }


Thank you very much in advance for any help/advice,

Best Regards,

Luca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20120521/7fbea373/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: out.med
Type: application/octet-stream
Size: 255288 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20120521/7fbea373/attachment.med>