[Gmsh] binary file format - fortran

Christophe Geuzaine cgeuzaine at ulg.ac.be
Wed May 5 11:26:58 CEST 2010

On 05/05/10 08:46, Hossein Talebi wrote:
> Hello,
> First of all thank you for developing and supporting gmsh.
> In short, I have a finite element code in Fortran and I try to use gmsh
> as post processor. I tried dumping files in ASCII format and gmsh was
> able to recognize the dumped file and showed the mesh.
> However, I have problems dumping the Binary format and gmsh cannot read
> my file, or recognize the data structure.
> I think there is something wrong with integer/real/double precision data.
> I use FORTRAN and all my integers have 4 bytes. The real( double
> precision) have 8 bytes.
> In the $MeshFormat I then have to write 20 bytes  (version_number=2.1
> (8), file_type(4),data_size=8 (4) and one_binary=1(4)). However, gmsh
> cannot recognize the binary input.

Hi Hossein - beware that in binary format, the first three fields in 
$MeshFormat are actually written in ASCII (we need to wait until reading 
"1" in binary to detect if the file has the correct endianness):

2.2 1 8
^A^@^@^@              <---- "1" in binary

> Please help. I could be perfect you if I can see some samples done with
> Fortran. Thank you.
> Cheers
> Hossein
> _______________________________________________
> 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