<div dir="ltr">Dear Developers and Users,<br>I am trying to read a .msh binary file in Fortran.<br>I am able to read the "header" like<br><br><pre>$MeshFormat
2.2 1 8
^A^@^@^@
$EndMeshFormat<br><br>After this portion I am getting the wrong values. I am reading the file as follows:<br><br></pre> ! If the casefile exists, open the mesh file and read it<br> open(unit=iunit,file=trim(filein)//'.msh',status='old',access='stream', iostat=ierr)<br><br> ! Read header $MeshFormat<br> read(iunit) header(1:12)<br> <br> ! Read version number<br> read(iunit) header(1:8)<br><br> ! Read integer to check endianess<br> read(iunit) endianess<br> if(endianess .eq. 1) then<br> write(*,*) 'Native endian; nothing to be done.'<br> else<br> stop<br> endif<br><br> ! Read hidden blanck line<br> read(iunit) header(1:1)<br><br> ! Read header $EndMeshFormat<br> read(iunit) header(1:15)<br><br> ! Read header $Nodes<br> read(iunit) header(1:7)<br><br> ! Read number of nodes in a string and convert it to an integer<br> read(iunit) header<br> read(header,*) n_nodes<br><br> read(iunit) (node_ids(i),vx_master(1,i),vx_master(2,i),vx_master(3,i),i = 1,n_nodes)<br><br><br><pre>Clearly I am doing somthing wrong. Any idea?<br><br>Thank you<br></pre><br></div>