Skip to content

szaghi/VTKFortran

Repository files navigation

Lib_VTK_IO GitHub tag

Join the chat at https://gitter.im/szaghi/Lib_VTK_IO

License License License License

Status Build Status Coverage Status

Lib_VTK_IO, VTK IO in pure Fortran (2003+)

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.

Table of Contents

Issues

GitHub issues Ready in backlog In Progress Open bugs

Compiler Support

Compiler Compiler Compiler Compiler Compiler Compiler

Main features

VTK features

Exporters

Legacy standard
  • Structured Points;
  • Structured Grid;
  • Unstructured Grid;
  • Polydata;
  • Rectilinear Grid;
  • Field;
XML standard
  • 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.

Importers

The importers are under developing.

Parallel Architectures

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.

Copyrights

Lib_VTK_IO is an open source project, it is distributed under a multi-licensing system:

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

Documentation

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

A taste of Lib_VTK_IO

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.