Skip to content
Stefano Zaghi edited this page Jan 22, 2015 · 2 revisions

Presently, the available functions for VTM-XML standard files are:

The complete signature of each functions can be found on the API documentation.

For a more complete examples of usage of these functions refer to the Testing-Program documentation. In the following a pseudo callings sequences are reported for different scenario.

Structured mesh

This example demonstrate the creation of multi-block vtkMultiBlockDataSet (wrapper) file (.vtm). The mesh is composed by 4 subset of data organized into 2 blocks. All the subsets are simple StructuredGrid prisms shifted along x direction.

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

vts files creation
do b=1,4 ! loop over blocks
  E_IO = VTK_INI_XML(cf=mf(b),output_format='binary', filename='XML_M-STRG_part.'//trim(str(.true.,b-1))//'.vts', &
                     mesh_topology='StructuredGrid', nx1=nx1, nx2=nx2, ny1=ny1, ny2=ny2, nz1=nz1, nz2=nz2)
  if (b>1) then
    x = x + nx2*1._R8P
    v = b
  endif
  E_IO = VTK_GEO_XML(cf=mf(b),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/)))
  E_IO = VTK_DAT_XML(cf=mf(b),var_location = 'node', var_block_action = 'open')
  E_IO = VTK_VAR_XML(cf=mf(b),NC_NN = nn, varname = 'node_value', var = reshape(v(nx1:nx2,:,:),(/nn/)))
  E_IO = VTK_DAT_XML(cf=mf(b),var_location = 'node', var_block_action = 'close')
  E_IO = VTK_GEO_XML(cf=mf(b))
  E_IO = VTK_END_XML()
enddo
vtm file initialization
E_IO = VTM_INI_XML('XML_M-STRG.vtm')
saving the first block (2 vts subsets) files list
E_IO = VTM_BLK_XML(block_action='open')
E_IO = VTM_WRF_XML(flist=(/('XML_M-STRG_part.'//trim(str(.true.,b-1))//'.vts',b=1,2)/))
E_IO = VTM_BLK_XML(block_action='close')
saving the second block (2 vts subsets) files list
E_IO = VTM_BLK_XML(block_action='open')
E_IO = VTM_WRF_XML(flist=(/('XML_M-STRG_part.'//trim(str(.true.,b-1))//'.vts',b=3,4)/))
E_IO = VTM_BLK_XML(block_action='close')
file finalization
E_IO = VTM_END_XML()