Binary VTK for RECTILINEAR_GRID from fortran code

前端 未结 1 1243
谎友^
谎友^ 2021-01-07 07:50

I am having a fortran code to generate a grid in binary VTK format. This code produces a binary VTK file like this one:

# vtk DataFile Version 3.0
vtk output         


        
相关标签:
1条回答
  • 2021-01-07 08:32

    One issue is, that arrays are specified as [0., 1.], not as (0., 1.), that would be a complex number equal to one imaginary unit i. The same way [0.] instead of (0.). Thanks to Alexander Voigt in binary vtk for Rectilinear_grid from fortran code can not worked by paraview, for pointing out the issue.

    You state that you use FLOAT, but than you store real*8 there. They are not compatible. Either store real*4 (or a more modern real(real32) ) there, or place the text DOUBLE instead of FLOAT in the file.

    Note, the stand conforming access=stream is much better than the non-standard form=binary. Also, convert=BIG_ENDIAN is non-standard and will not work with many compilers (e.g., gfortran, if I recall it correctly). The char(10) is better to be achar(10) but that is a minor issue.

    BTW,

    buffer = 'DIMENSIONS '//str1//str2//str3//lf  ; write(ivtk) trim(buffer)
    

    can just be

    write(ivtk) 'DIMENSIONS '//str1//str2//str3//lf
    
    0 讨论(0)
提交回复
热议问题