Skip to content
Stefano Zaghi edited this page Dec 23, 2014 · 1 revision

This example demonstrate the creation of StructuredGrid file (.vts). The mesh is a simple prism.

Let us assume that all the necessary StructuredGrid variables have been defined and initialized, the following is a pseudo code showing how to create XML file:

file initialization
E_IO = VTK_INI_XML(output_format='binary', filename='XML_STRG.vts', &
                   mesh_topology='StructuredGrid', nx1=nx1, nx2=nx2, ny1=ny1, ny2=ny2, nz1=nz1, nz2=nz2)
global auxiliary data saving
E_IO = VTK_FLD_XML(fld_action='open')
E_IO = VTK_FLD_XML(fld=0._R8P,fname='TIME')
E_IO = VTK_FLD_XML(fld=1_I8P,fname='CYCLE')
E_IO = VTK_FLD_XML(fld_action='close')
mesh saving of the first (unique) piece
E_IO = VTK_GEO_XML(nx1=nx1, nx2=nx2, ny1=ny1, ny2=ny2, nz1=nz1, nz2=nz2, NN=nn, &
                   X=reshape(x(nx1:nx2,:,:),(/nn/)),                            &
                   Y=reshape(y(nx1:nx2,:,:),(/nn/)),                            &
                   Z=reshape(z(nx1:nx2,:,:),(/nn/)))
initializing the file tag data-container for saving data associated to the current piece
E_IO = VTK_DAT_XML(var_location = 'node', var_block_action = 'open')
data saving
E_IO = VTK_VAR_XML(NC_NN = nn, varname = 'node_value', var = reshape(v(nx1:nx2,:,:),(/nn/)))
closing the file tag data-container
E_IO = VTK_DAT_XML(var_location = 'node', var_block_action = 'close')
closing current piece
E_IO = VTK_GEO_XML()
file finalization
E_IO = VTK_END_XML()

This example is contained into Test_Driver.f90, in particular the subroutine test_strg contains all the data and code to run this example.