Dear Developers and Users,
I am trying to read a .msh binary file in Fortran.
I am able to read the "header" like

$MeshFormat
2.2 1 8
^A^@^@^@             
$EndMeshFormat

After this portion I am getting the wrong values. I am reading the file as 
follows:

      ! If the casefile exists, open the mesh file and read it
      
open(unit=iunit,file=trim(filein)//'.msh',status='old',access='stream', 
iostat=ierr)

      ! Read header $MeshFormat
      read(iunit) header(1:12)
      
      ! Read version number
      read(iunit) header(1:8)

      ! Read integer to check endianess
      read(iunit) endianess
      if(endianess .eq. 1) then
        write(*,*) 'Native endian; nothing to be done.'
      else
        stop
      endif

      ! Read hidden blanck line
      read(iunit) header(1:1)

      ! Read header $EndMeshFormat
      read(iunit) header(1:15)

      ! Read header $Nodes
      read(iunit) header(1:7)

      ! Read number of nodes in a string and convert it to an integer
      read(iunit) header
      read(header,*) n_nodes

       read(iunit) 
(node_ids(i),vx_master(1,i),vx_master(2,i),vx_master(3,i),i = 1,n_nodes)


Clearly I am doing somthing wrong. Any idea?

Thank you


_______________________________________________
gmsh mailing list
[email protected]
http://www.geuz.org/mailman/listinfo/gmsh

Reply via email to