[Gmsh] Could not read MED families

Christophe Geuzaine cgeuzaine at ulg.ac.be
Mon May 21 17:06:50 CEST 2012


Hi Luca - Can you try again with the latest SVN?
Thanks,
Christophe

On 21 May 2012, at 16:31, Luca Dall'Olio wrote:

> 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
> 
> <out.med>_______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh

-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine