Skip to content

API Reference ​

Auto-generated from Fortran source doc comments using FORMAL.

src/lib ​

Key type-bound procedures ​

vtk_file / pvtk_file ​

ProcedureDescription
%initialize(format, filename, mesh_topology, ...)Open the file, select the writer, write the XML header; for ImageData/PImageData also origin, spacing (required) and direction; header_type='UInt64' for binary arrays larger than 2 GiB; compressor='zlib' to compress binary data (vtk_file only)
%initialize(filename=..., action='read')Open a file for reading through %xml_reader: a serial file (vtk_file) or a parallel header (pvtk_file), see below
%finalize()Flush and close the file (or free the reader)
%get_xml_volatile(xml_volatile), %free()Return the file written with is_volatile=.true. as a string, then free its memory (vtk_file only)
%xml_writer%write_fielddata(...)Write global FieldData: scalars, rank-1 arrays (all kinds), strings and arrays of strings
%xml_writer%write_piece(...)Open or close a Piece element (extents, np/nc, or np/nverts/nlines/nstrips/npolys for PolyData; counts I4P or I8P)
%xml_writer%write_geo(...)Write geometry (coordinates; unstructured np/nc counts I4P or I8P)
%xml_writer%write_connectivity(...)Write unstructured connectivity, offsets, and cell types (ids I4P or I8P)
%xml_writer%write_polydata_cells(...)Write the cell blocks of PolyData: vertices, lines, triangle strips, polygons (ids I4P or I8P)
%xml_writer%write_dataarray(...)Write a data array (overloaded for all kinds and ranks)
%xml_writer%write_dataarray_unsigned(data_name, x)Write a rank-1 integer array as unsigned (I1P…I8P as UInt8…UInt64)
%xml_writer%write_parallel_geo(...)Write a <P*> geometry piece reference (pvtk_file only)
%xml_writer%write_parallel_dataarray(...)Write a parallel data array descriptor (pvtk_file only)

vtk_file reading (%xml_reader) ​

ProcedureDescription
%xml_reader%get_info(...)Dataset type, number of pieces, header type, compressor; whole extent; ImageData origin, spacing, direction
%xml_reader%read_piece(...)Counts (I8P) and extent of a piece
%xml_reader%read_geo(x, y, z, piece)Point coordinates, or the axes coordinates of a RectilinearGrid (R8P or R4P)
%xml_reader%read_connectivity(...)Connectivity, offsets, cell types and polyhedra faces of an UnstructuredGrid (ids I4P or I8P)
%xml_reader%read_polydata_cells(block, connectivity, offset, piece)One block of PolyData cells: verts, lines, strips or polys (ids I4P or I8P)
%xml_reader%get_dataarray_names(location, names, piece)Names of the arrays of a location (node, cell, field)
%xml_reader%get_dataarray_info(...)VTK type, components and tuples of an array
%xml_reader%read_dataarray(location, data_name, x, piece)Values of an array: rank 1 or (components, tuples), all kinds; strings
%xml_reader%get_sources(sources)Files of the pieces of a parallel header
%xml_reader%check_pieces(message)Check the pieces of a parallel header against it: type, coordinates, declared arrays (error 7 and message on mismatch)

vtm_file ​

ProcedureDescription
%initialize(filename)Create the .vtm wrapper file
%initialize(filename, action='read')Open a .vtm file for reading
%get_entries(level, kind, index, name, file)Blocks and datasets of a file read, flattened depth first
%write_block(filenames, names, name, action)Add a named block of files; action='open'/'close' to nest blocks, 'write' to add datasets to the current block (filenames and names as arrays or blank-separated strings)
%finalize()Close the .vtm file

pvd_file ​

ProcedureDescription
%initialize(filename, action)Create the .pvd collection (action='new', default), reopen it to add steps (action='append') or read it (action='read')
%get_datasets(timestep, part, group, name, file)Datasets of a collection read
%write_dataset(filename, timestep, part, group, name)Add a dataset (file) with its time step; the collection is valid after each call
%finalize()Close the .pvd file

write_xml_volatile ​

A module-level function (not a type-bound procedure), write_xml_volatile(xml_volatile, filename): it writes to disk a file held in memory, as returned by get_xml_volatile. Useful for parallel workflows where only one process accesses the file system, see Volatile XML output.