Appearance
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
| Name | Type | Attributes | Description |
|---|---|---|---|
xml_writer | class(xml_writer_abstract) | allocatable | XML writer. |
xml_reader | type(xml_reader) | XML reader (initialize(..., action='read')). | |
is_reading | logical | The file is open for reading. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
initialize | pass(self) | Initialize file. |
finalize | pass(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:
originandspacingare required,directionis optional,mesh_kindis 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(pvtk_file) | inout | VTK file. | |
filename | character(len=*) | in | File name. | |
mesh_topology | character(len=*) | in | optional | Mesh topology. |
mesh_kind | character(len=*) | in | optional | Kind of points coordinates: Float64, Float32 (not for PImageData). |
nx1 | integer(kind=I4P) | in | optional | Initial node of x axis. |
nx2 | integer(kind=I4P) | in | optional | Final node of x axis. |
ny1 | integer(kind=I4P) | in | optional | Initial node of y axis. |
ny2 | integer(kind=I4P) | in | optional | Final node of y axis. |
nz1 | integer(kind=I4P) | in | optional | Initial node of z axis. |
nz2 | integer(kind=I4P) | in | optional | Final node of z axis. |
ghost_level | integer(kind=I4P) | in | optional | Number of ghost levels of the pieces (default 0). |
origin | real(kind=R8P) | in | optional | Origin of ImageData: coordinates of the point of indexes (0,0,0). |
spacing | real(kind=R8P) | in | optional | Spacing of ImageData along each axis. |
direction | real(kind=R8P) | in | optional | Axes directions of ImageData, row-major 3x3 (default identity). |
action | character(len=*) | in | optional | Action: 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(pvtk_file) | inout | VTK 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
string | character(len=*) | in | Input string. |
Call graph