Skip to content

vtk_fortran_pvtk_file ​

Parallel (partioned) VTK file class.

Source: src/lib/vtk_fortran_pvtk_file.f90

Dependencies

Contents ​

Derived Types ​

pvtk_file ​

VTK parallel (partioned) file class.

Components ​

NameTypeAttributesDescription
xml_writerclass(xml_writer_abstract)allocatableXML writer.
xml_readertype(xml_reader)XML reader (initialize(..., action='read')).
is_readinglogicalThe file is open for reading.

Type-Bound Procedures ​

NameAttributesDescription
initializepass(self)Initialize file.
finalizepass(self)Finalize file.

Functions ​

initialize ​

Initialize file: open it for writing (default) or for reading.

@note This function must be the first to be called.

Reading ​

With action='read' only filename is used: the header is read through the xml_reader component (get_info, get_sources, read_piece for the extents of the pieces, get_dataarray_names, get_dataarray_info for the declared arrays, and check_pieces to check the pieces against the header); finalize frees it.

fortran
 type(pvtk_file)               :: pvtk
 character(len=:), allocatable :: sources(:), message
 error = pvtk%initialize(filename='mesh.pvtu', action='read')
 error = pvtk%xml_reader%get_sources(sources)
 error = pvtk%xml_reader%check_pieces(message=message)
 error = pvtk%finalize()

Writing ​

mesh_topology is required.

Supported topologies are: ​

  • PRectilinearGrid;
  • PStructuredGrid;
  • PUnstructuredGrid;
  • PImageData: origin and spacing are required, direction is optional, mesh_kind is not used (the pieces have no points coordinates).
  • PPolyData: mesh_kind (type of the points coordinates of the pieces) is required.

Example of usage ​

fortran
 type(pvtk_file) :: pvtk
 integer(I4P)    :: nx1, nx2, ny1, ny2, nz1, nz2
 ...
 error = pvtk%initialize('XML_RECT_BINARY.pvtr','PRectilinearGrid',nx1=nx1,nx2=nx2,ny1=ny1,ny2=ny2,nz1=nz1,nz2=nz2)
 ...

@note ghost_level is the number of ghost levels (layers of cells shared with the neighbour pieces) of the pieces, default 0. @note The file extension is necessary in the file name. The XML standard has different extensions for each different topologies (e.g. pvtr for rectilinear topology). See the VTK-standard file for more information.

Returns: integer(kind=I4P)

fortran
function initialize(self, filename, mesh_topology, mesh_kind, nx1, nx2, ny1, ny2, nz1, nz2, ghost_level, origin, spacing, direction, action) result(error)

Arguments

NameTypeIntentAttributesDescription
selfclass(pvtk_file)inoutVTK file.
filenamecharacter(len=*)inFile name.
mesh_topologycharacter(len=*)inoptionalMesh topology.
mesh_kindcharacter(len=*)inoptionalKind of points coordinates: Float64, Float32 (not for PImageData).
nx1integer(kind=I4P)inoptionalInitial node of x axis.
nx2integer(kind=I4P)inoptionalFinal node of x axis.
ny1integer(kind=I4P)inoptionalInitial node of y axis.
ny2integer(kind=I4P)inoptionalFinal node of y axis.
nz1integer(kind=I4P)inoptionalInitial node of z axis.
nz2integer(kind=I4P)inoptionalFinal node of z axis.
ghost_levelinteger(kind=I4P)inoptionalNumber of ghost levels of the pieces (default 0).
originreal(kind=R8P)inoptionalOrigin of ImageData: coordinates of the point of indexes (0,0,0).
spacingreal(kind=R8P)inoptionalSpacing of ImageData along each axis.
directionreal(kind=R8P)inoptionalAxes directions of ImageData, row-major 3x3 (default identity).
actioncharacter(len=*)inoptionalAction: write (default) or read, case insensitive.

Call graph

finalize ​

Finalize file: close the writer, or free the reader.

Returns: integer(kind=I4P)

fortran
function finalize(self) result(error)

Arguments

NameTypeIntentAttributesDescription
selfclass(pvtk_file)inoutVTK file.

Call graph

upper_case ​

Return a string in upper case (ASCII letters only).

Attributes: pure

Returns: character(len=len(string))

fortran
function upper_case(string) result(upper)

Arguments

NameTypeIntentAttributesDescription
stringcharacter(len=*)inInput string.

Call graph