A KISS pure Fortran Library to IO data conforming the VTK standard
- Lib_VTK_IO is a pure Fortran library to write and read data conforming the VTK standard;
- Lib_VTK_IO is Fortran 2003+ standard compliant;
- Lib_VTK_IO supports parallel architectures by means OpenMP and MPI paradigms;
- Lib_VTK_IO supports ascii, binary and base64 file formats;
- Lib_VTK_IO is a Free, Open Source Project.
- Structured Points;
- Structured Grid;
- Unstructured Grid;
- Polydata;
- Rectilinear Grid;
- Field;
- serial dataset:
- Image Data;
- Polydata;
- Rectilinear Grid;
- Structured Grid;
- Unstructured Grid;
- parallel (partitioned) dataset:
- Image Data;
- Polydata;
- Rectilinear Grid;
- Structured Grid;
- Unstructured Grid;
- composite dataset:
- vtkMultiBlockDataSet.
The importers are under developing.
Lib_VTK_IO can handle multiple concurrent files and it is \b thread/processor-safe, meaning that it can be safely used into parallel architectures using OpenMP and/or MPI paradigms. Into section [[Parallel-benchmarks]] some more details can be found.
Lib_VTK_IO is an open source project, it is distributed under a multi-licensing system:
- for FOSS projects:
- for closed source/commercial projects:
Anyone is interest to use, to develop or to contribute to Lib_VTK_IO is welcome, feel free to select the license that best matches your soul!
More details can be found on wiki.
Go to Top
Besides this README file the Lib_VTK_IO documentation is contained into its own wiki. Detailed documentation of the API is contained into the GitHub Pages that can also be created locally by means of ford tool.
Go to Top
Let us assume our aim being to save our pure Fortran data into a VTK structured grid file in binary XML form. This is simple as
USE Lib_VTK_IO
...
! dataset dimensions
integer, parameter:: nx1=0,nx2=9,ny1=0,ny2=5,nz1=0,nz2=5
integer, parameter:: nn=(nx2-nx1+1)*(ny2-ny1+1)*(nz2-nz1+1)
! grid coordinates
real, dimension(nx1:nx2,ny1:ny2,nz1:nz2):: x,y,z
! variables associated at grid nodes
real, dimension(nx1:nx2,ny1:ny2,nz1:nz2):: v_R
! auxiliary variables
integer:: E_IO
...
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)
E_IO = VTK_GEO_XML(nx1=nx1,nx2=nx2,ny1=ny1,ny2=ny2,nz1=nz1,nz2=nz2,NN=nn,X=x,Y=y,Z=z)
E_IO = VTK_DAT_XML(var_location='node',var_block_action='open')
E_IO = VTK_VAR_XML(NC_NN=nn,varname='real scalar',var=v_R)
E_IO = VTK_DAT_XML(var_location='node',var_block_action='close')
E_IO = VTK_GEO_XML()
E_IO = VTK_END_XML()
Note that all Lib_VTK_IO functions return an error code (E_IO
) that can be used for sophisticated error trapping algorithms.