Appearance
vtk_fortran_vtk_file_xml_reader
VTK file XML reader.
The reader indexes the file when it is initialized: one pass over the XML that records the elements and attributes and the positions of the data, without loading them (the scan stops at the appended data). Each read then decodes only the data asked for: the memory used is about the size of the dataarray read, not of the file.
It reads the serial XML formats (ImageData, RectilinearGrid, StructuredGrid, UnstructuredGrid, PolyData) written by VTKFortran or by VTK, in every format (ascii, binary, raw and base64 appended), uncompressed or zlib compressed (vtkZLibDataCompressor), with UInt32 or UInt64 headers. BigEndian files and other compressors are not supported.
It reads the parallel headers too (PImageData, PRectilinearGrid, PStructuredGrid, PUnstructuredGrid, PPolyData): their information, the declared arrays (get_dataarray_names, get_dataarray_info), the pieces (get_sources, read_piece for their extents) and the check of the pieces against the header (check_pieces). They hold no data.
All procedures return an error status:
| Error | Meaning |
|---|---|
| 0 | success |
| 1 | the file cannot be read |
| 2 | the file is not a VTK XML file (malformed XML, no VTKFile element or dataset element) |
| 3 | unsupported feature (BigEndian, compressor, parallel or unknown dataset type, encoding) |
| 4 | not found (piece, data array, geometry or cells absent), or the reader is not initialized |
| 5 | the output kind cannot hold the values of the data array |
| 6 | the data do not decode (inconsistent sizes, malformed base64, zlib failure) |
| 7 | the pieces of a parallel header do not match it (see check_pieces) |
Source: src/lib/vtk_fortran_vtk_file_xml_reader.f90
Dependencies
Contents
- xml_reader
- finalize
- b64_decode_bytes
- piece_counts
- initialize
- get_info
- read_piece
- get_dataarray_names
- get_dataarray_info
- read_dataarray_strings
- read_geo_R8P
- read_geo_R4P
- read_connectivity_I8P
- read_connectivity_I4P
- read_polydata_cells_I8P
- read_polydata_cells_I4P
- get_sources
- check_pieces
- dataarray_bytes
- find_dataarray
- geometry_dataarrays
- piece_element
- read_ids
- read_named_dataarray
- read_dataarray_rank1_R8P
- read_dataarray_rank1_R4P
- read_dataarray_rank1_I8P
- read_dataarray_rank1_I4P
- read_dataarray_rank1_I2P
- read_dataarray_rank1_I1P
- read_dataarray_rank2_R8P
- read_dataarray_rank2_R4P
- read_dataarray_rank2_I8P
- read_dataarray_rank2_I4P
- read_dataarray_rank2_I2P
- read_dataarray_rank2_I1P
- read_coordinate_R8P
- read_coordinate_R4P
- read_appended_raw
- read_appended_base64
- polydata_section
- find_marker
- read_chars
- read_bytes
- to_I4P
- is_dataarray
- lower_case
Derived Types
xml_reader
VTK file XML reader.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
filename | character(len=:) | allocatable | File name. |
xml | type(xml_scanner) | Index of the XML elements. | |
mesh_topology | character(len=:) | allocatable | Dataset type. |
word_size | integer(kind=I8P) | Size of the binary header words: 4 (UInt32) or 8 (UInt64). | |
is_compressed | logical | The binary data are zlib compressed. | |
is_initialized | logical | The reader is initialized. | |
dataset | integer(kind=I4P) | Index of the dataset element. | |
pieces_number | integer(kind=I4P) | Number of pieces. | |
is_appended_raw | logical | The appended data are raw (base64 otherwise). | |
appended_start | integer(kind=I8P) | Position of the first byte of the appended data, 0 if none. | |
is_parallel | logical | The file is a parallel header (P* dataset type). |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
check_pieces | pass(self) | Check the pieces of a parallel header against it. |
finalize | pass(self) | Finalize the reader (free memory). |
get_dataarray_info | pass(self) | Return the type, components and tuples of a dataarray. |
get_dataarray_names | pass(self) | Return the names of the dataarrays of a location. |
get_info | pass(self) | Return the information of the dataset. |
get_sources | pass(self) | Return the files of the pieces of a parallel header. |
initialize | pass(self) | Initialize the reader: index the file. |
read_connectivity | Read the cells. | |
read_dataarray | Read a dataarray. | |
read_geo | Read the geometry. | |
read_piece | pass(self) | Read the counts and extent of a piece. |
read_polydata_cells | Read polydata cells. | |
dataarray_bytes | pass(self) | Return the bytes of a dataarray element. |
find_dataarray | pass(self) | Return the index of a named dataarray element. |
geometry_dataarrays | pass(self) | Return the indexes of the geometry dataarray elements. |
piece_element | pass(self) | Return the index of a piece element. |
read_connectivity_I4P | pass(self) | Read the cells (I4P). |
read_connectivity_I8P | pass(self) | Read the cells (I8P). |
read_dataarray_rank1_R8P | pass(self) | Read a dataarray (rank 1, R8P). |
read_dataarray_rank1_R4P | pass(self) | Read a dataarray (rank 1, R4P). |
read_dataarray_rank1_I8P | pass(self) | Read a dataarray (rank 1, I8P). |
read_dataarray_rank1_I4P | pass(self) | Read a dataarray (rank 1, I4P). |
read_dataarray_rank1_I2P | pass(self) | Read a dataarray (rank 1, I2P). |
read_dataarray_rank1_I1P | pass(self) | Read a dataarray (rank 1, I1P). |
read_dataarray_rank2_R8P | pass(self) | Read a dataarray (rank 2, R8P). |
read_dataarray_rank2_R4P | pass(self) | Read a dataarray (rank 2, R4P). |
read_dataarray_rank2_I8P | pass(self) | Read a dataarray (rank 2, I8P). |
read_dataarray_rank2_I4P | pass(self) | Read a dataarray (rank 2, I4P). |
read_dataarray_rank2_I2P | pass(self) | Read a dataarray (rank 2, I2P). |
read_dataarray_rank2_I1P | pass(self) | Read a dataarray (rank 2, I1P). |
read_dataarray_strings | pass(self) | Read a dataarray of strings. |
read_geo_R8P | pass(self) | Read the geometry (R8P). |
read_geo_R4P | pass(self) | Read the geometry (R4P). |
read_ids | pass(self) | Read a dataarray of ids (I8P) of a piece section. |
read_named_dataarray | pass(self) | Return the bytes of a named dataarray. |
read_polydata_cells_I4P | pass(self) | Read polydata cells (I4P). |
read_polydata_cells_I8P | pass(self) | Read polydata cells (I8P). |
Subroutines
finalize
Finalize the reader (free memory).
Attributes: elemental
fortran
subroutine finalize(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | inout | XML reader. |
Call graph
b64_decode_bytes
Decode a base64 code into bytes.
fortran
subroutine b64_decode_bytes(code, bytes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
code | character(len=*) | in | Base64 code. | |
bytes | integer(kind=I1P) | inout | Bytes, of the decoded size. |
Call graph
piece_counts
Return the counts (points, cells, verts, lines, strips, polys) and the extent of a piece element.
fortran
subroutine piece_counts(element, mesh_topology, counts, extent, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
element | type(xml_element) | in | Piece element. | |
mesh_topology | character(len=*) | in | Dataset type. | |
counts | integer(kind=I8P) | out | Points, cells, verts, lines, strips, polys. | |
extent | integer(kind=I4P) | out | Extent. | |
error | integer(kind=I4P) | out | Error status. |
Call graph
Functions
initialize
Initialize the reader: index the file.
Returns: integer(kind=I4P)
fortran
function initialize(self, filename) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | inout | XML reader. | |
filename | character(len=*) | in | File name. |
Call graph
get_info
Return the information of the dataset.
The whole extent (nx1...nz2) is returned for the structured topologies (ImageData, RectilinearGrid, StructuredGrid); origin, spacing and direction for ImageData (direction is the identity when the file has none); ghost_level for parallel headers (0 when the file has none).
Returns: integer(kind=I4P)
fortran
function get_info(self, mesh_topology, npieces, header_type, compressor, nx1, nx2, ny1, ny2, nz1, nz2, origin, spacing, direction, ghost_level) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
mesh_topology | character(len=:) | out | allocatable, optional | Dataset type, e.g. UnstructuredGrid. |
npieces | integer(kind=I4P) | out | optional | Number of pieces. |
header_type | character(len=:) | out | allocatable, optional | Header of the binary data: UInt32 or UInt64. |
compressor | character(len=:) | out | allocatable, optional | Compressor of the binary data: none or zlib. |
nx1 | integer(kind=I4P) | out | optional | Initial node of x axis. |
nx2 | integer(kind=I4P) | out | optional | Final node of x axis. |
ny1 | integer(kind=I4P) | out | optional | Initial node of y axis. |
ny2 | integer(kind=I4P) | out | optional | Final node of y axis. |
nz1 | integer(kind=I4P) | out | optional | Initial node of z axis. |
nz2 | integer(kind=I4P) | out | optional | Final node of z axis. |
origin | real(kind=R8P) | out | optional | Origin of ImageData. |
spacing | real(kind=R8P) | out | optional | Spacing of ImageData. |
direction | real(kind=R8P) | out | optional | Axes directions of ImageData (row-major). |
ghost_level | integer(kind=I4P) | out | optional | Number of ghost levels of a parallel header. |
Call graph
read_piece
Read the counts and the extent of a piece.
For the structured topologies the counts are computed from the extent of the piece. For PolyData nc is the number of all the cells (vertices, lines, strips and polygons).
Returns: integer(kind=I4P)
fortran
function read_piece(self, piece, np, nc, nx1, nx2, ny1, ny2, nz1, nz2, nverts, nlines, nstrips, npolys) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1). |
np | integer(kind=I8P) | out | optional | Number of points. |
nc | integer(kind=I8P) | out | optional | Number of cells. |
nx1 | integer(kind=I4P) | out | optional | Initial node of x axis. |
nx2 | integer(kind=I4P) | out | optional | Final node of x axis. |
ny1 | integer(kind=I4P) | out | optional | Initial node of y axis. |
ny2 | integer(kind=I4P) | out | optional | Final node of y axis. |
nz1 | integer(kind=I4P) | out | optional | Initial node of z axis. |
nz2 | integer(kind=I4P) | out | optional | Final node of z axis. |
nverts | integer(kind=I8P) | out | optional | Number of vertices (PolyData). |
nlines | integer(kind=I8P) | out | optional | Number of lines (PolyData). |
nstrips | integer(kind=I8P) | out | optional | Number of strips (PolyData). |
npolys | integer(kind=I8P) | out | optional | Number of polygons (PolyData). |
Call graph
get_dataarray_names
Return the names of the dataarrays of a location (node, cell or field), in the order of the file.
The names are blank padded to the length of the longest one; a location without dataarrays returns no names.
Returns: integer(kind=I4P)
fortran
function get_dataarray_names(self, location, names, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
names | character(len=:) | out | allocatable | Names of the dataarrays. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
Call graph
get_dataarray_info
Return the VTK type, the number of components and the number of tuples of a dataarray, without reading it.
The number of tuples is the NumberOfTuples attribute when present, otherwise the number of points or cells of the piece; -1 when unknown (field data without NumberOfTuples, arrays declared by a parallel header).
Returns: integer(kind=I4P)
fortran
function get_dataarray_info(self, location, data_name, piece, data_type, n_components, n_tuples) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
data_type | character(len=:) | out | allocatable, optional | VTK type, e.g. Float64, Int32, UInt8, String. |
n_components | integer(kind=I4P) | out | optional | Number of components. |
n_tuples | integer(kind=I8P) | out | optional | Number of tuples. |
Call graph
read_dataarray_strings
Read a dataarray of strings (type String, as field data strings are written).
Returns: integer(kind=I4P)
fortran
function read_dataarray_strings(self, location, data_name, x, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
x | character(len=:) | out | allocatable | Strings, blank padded to the longest one. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
Call graph
read_geo_R8P
Read the geometry of a piece (R8P): the coordinates of the points, or the coordinates along each axis of a RectilinearGrid. ImageData have no stored geometry (see get_info): the error is 4.
Returns: integer(kind=I4P)
fortran
function read_geo_R8P(self, x, y, z, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
x | real(kind=R8P) | out | allocatable | X coordinates. |
y | real(kind=R8P) | out | allocatable | Y coordinates. |
z | real(kind=R8P) | out | allocatable | Z coordinates. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1). |
Call graph
read_geo_R4P
Read the geometry of a piece (R4P): the coordinates of the points, or the coordinates along each axis of a RectilinearGrid. ImageData have no stored geometry (see get_info): the error is 4.
Returns: integer(kind=I4P)
fortran
function read_geo_R4P(self, x, y, z, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
x | real(kind=R4P) | out | allocatable | X coordinates. |
y | real(kind=R4P) | out | allocatable | Y coordinates. |
z | real(kind=R4P) | out | allocatable | Z coordinates. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1). |
Call graph
read_connectivity_I8P
Read the cells of an UnstructuredGrid piece (I8P): connectivity, offsets, types and, if present, polyhedra faces.
The ids can be of any integer type in the file. Asking for face/faceoffset when the file has none is an error 4.
Returns: integer(kind=I4P)
fortran
function read_connectivity_I8P(self, connectivity, offset, cell_type, face, faceoffset, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
connectivity | integer(kind=I8P) | out | allocatable | Connectivity. |
offset | integer(kind=I8P) | out | allocatable | Offsets: end of each cell in the connectivity. |
cell_type | integer(kind=I1P) | out | allocatable, optional | VTK cell types. |
face | integer(kind=I8P) | out | allocatable, optional | Faces stream of the polyhedra. |
faceoffset | integer(kind=I8P) | out | allocatable, optional | End of the faces of each cell, -1 if none. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1). |
Call graph
read_connectivity_I4P
Read the cells of an UnstructuredGrid piece (I4P): connectivity, offsets, types and, if present, polyhedra faces.
The ids can be of any integer type in the file (VTK writes Int64): values that do not fit I4P are an error 5.
Returns: integer(kind=I4P)
fortran
function read_connectivity_I4P(self, connectivity, offset, cell_type, face, faceoffset, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
connectivity | integer(kind=I4P) | out | allocatable | Connectivity. |
offset | integer(kind=I4P) | out | allocatable | Offsets: end of each cell in the connectivity. |
cell_type | integer(kind=I1P) | out | allocatable, optional | VTK cell types. |
face | integer(kind=I4P) | out | allocatable, optional | Faces stream of the polyhedra. |
faceoffset | integer(kind=I4P) | out | allocatable, optional | End of the faces of each cell, -1 if none. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1). |
Call graph
read_polydata_cells_I8P
Read one block of cells of a PolyData piece (I8P): block is verts, lines, strips or polys (case insensitive).
A block absent from the file, with no cells in the piece, returns empty arrays.
Returns: integer(kind=I4P)
fortran
function read_polydata_cells_I8P(self, block, connectivity, offset, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
block | character(len=*) | in | Block of cells: verts, lines, strips or polys. | |
connectivity | integer(kind=I8P) | out | allocatable | Connectivity. |
offset | integer(kind=I8P) | out | allocatable | Offsets: end of each cell in the connectivity. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1). |
Call graph
read_polydata_cells_I4P
Read one block of cells of a PolyData piece (I4P): block is verts, lines, strips or polys (case insensitive).
A block absent from the file, with no cells in the piece, returns empty arrays. Values that do not fit I4P are an error 5.
Returns: integer(kind=I4P)
fortran
function read_polydata_cells_I4P(self, block, connectivity, offset, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
block | character(len=*) | in | Block of cells: verts, lines, strips or polys. | |
connectivity | integer(kind=I4P) | out | allocatable | Connectivity. |
offset | integer(kind=I4P) | out | allocatable | Offsets: end of each cell in the connectivity. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1). |
Call graph
get_sources
Return the files of the pieces of a parallel header (the Source attributes), as written in the file.
Relative paths are relative to the directory of the header. The names are blank padded to the length of the longest one. The extents of the pieces of structured grids are returned by read_piece(piece, nx1, ...).
Returns: integer(kind=I4P)
fortran
function get_sources(self, sources) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
sources | character(len=:) | out | allocatable | Files of the pieces. |
Call graph
check_pieces
Check the pieces of a parallel header against it.
Each piece file is read (its index only, not its data) and must be a dataset of the type of the header (e.g. an UnstructuredGrid for a PUnstructuredGrid), with points or coordinates of the declared type (PPoints, PCoordinates) and, in every one of its pieces, every array declared by PPointData and PCellData with the same type and number of components (a piece can hold more arrays). VTK readers otherwise drop arrays, fill them with zeros or fail.
The error is 0 when all the pieces match, 7 when one does not, or the error of reading a piece (1, 2, 3); message then describes the first mismatch found.
Returns: integer(kind=I4P)
fortran
function check_pieces(self, message) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
message | character(len=:) | out | allocatable, optional | Description of the first mismatch, empty if none. |
Call graph
dataarray_bytes
Return the bytes (native byte order), the VTK type and the number of components of a dataarray element.
Returns: integer(kind=I4P)
fortran
function dataarray_bytes(self, id, bytes, data_type, n_components) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
id | integer(kind=I4P) | in | Index of the dataarray element. | |
bytes | integer(kind=I1P) | out | allocatable | Bytes of the dataarray. |
data_type | character(len=:) | out | allocatable | VTK type. |
n_components | integer(kind=I4P) | out | Number of components. |
Call graph
find_dataarray
Return the index of a named dataarray element of a location, and of the location element (0 if absent).
Returns: integer(kind=I4P)
fortran
function find_dataarray(self, location, data_name, piece, id, section) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
id | integer(kind=I4P) | out | Index of the dataarray element, 0 if not found. | |
section | integer(kind=I4P) | out | Index of the location element, 0 if not found. |
Call graph
geometry_dataarrays
Return the indexes of the geometry dataarray elements of a piece: Points (n=1) or the 3 Coordinates (n=3).
Returns: integer(kind=I4P)
fortran
function geometry_dataarrays(self, piece, id, n) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1). |
id | integer(kind=I4P) | out | Indexes of the geometry dataarray elements. | |
n | integer(kind=I4P) | out | Number of geometry dataarray elements. |
Call graph
piece_element
Return the index of a piece element.
Returns: integer(kind=I4P)
fortran
function piece_element(self, piece, id) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1). |
id | integer(kind=I4P) | out | Index of the piece element. |
Call graph
read_ids
Read a dataarray of ids (any integer type) of a section of a piece (e.g. Cells, Polys) into I8P.
Returns: integer(kind=I4P)
fortran
function read_ids(self, piece, section, data_name, ids) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1). |
section | character(len=*) | in | Name of the section element. | |
data_name | character(len=*) | in | Name of the dataarray. | |
ids | integer(kind=I8P) | out | allocatable | Ids. |
Call graph
read_named_dataarray
Return the bytes, the VTK type and the number of components of a named dataarray of a location.
Returns: integer(kind=I4P)
fortran
function read_named_dataarray(self, location, data_name, piece, bytes, data_type, n_components) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
bytes | integer(kind=I1P) | out | allocatable | Bytes of the dataarray. |
data_type | character(len=:) | out | allocatable | VTK type. |
n_components | integer(kind=I4P) | out | Number of components. |
Call graph
read_dataarray_rank1_R8P
Read a dataarray, flattened (components interleaved), into an array (R8P).
Returns: integer(kind=I4P)
fortran
function read_dataarray_rank1_R8P(self, location, data_name, x, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
x | real(kind=R8P) | out | allocatable | Values. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
Call graph
read_dataarray_rank1_R4P
Read a dataarray, flattened (components interleaved), into an array (R4P).
Returns: integer(kind=I4P)
fortran
function read_dataarray_rank1_R4P(self, location, data_name, x, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
x | real(kind=R4P) | out | allocatable | Values. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
Call graph
read_dataarray_rank1_I8P
Read a dataarray, flattened (components interleaved), into an array (I8P).
Returns: integer(kind=I4P)
fortran
function read_dataarray_rank1_I8P(self, location, data_name, x, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
x | integer(kind=I8P) | out | allocatable | Values. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
Call graph
read_dataarray_rank1_I4P
Read a dataarray, flattened (components interleaved), into an array (I4P).
Returns: integer(kind=I4P)
fortran
function read_dataarray_rank1_I4P(self, location, data_name, x, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
x | integer(kind=I4P) | out | allocatable | Values. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
Call graph
read_dataarray_rank1_I2P
Read a dataarray, flattened (components interleaved), into an array (I2P).
Returns: integer(kind=I4P)
fortran
function read_dataarray_rank1_I2P(self, location, data_name, x, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
x | integer(kind=I2P) | out | allocatable | Values. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
Call graph
read_dataarray_rank1_I1P
Read a dataarray, flattened (components interleaved), into an array (I1P).
Returns: integer(kind=I4P)
fortran
function read_dataarray_rank1_I1P(self, location, data_name, x, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
x | integer(kind=I1P) | out | allocatable | Values. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
Call graph
read_dataarray_rank2_R8P
Read a dataarray into an array of shape (number of components, number of tuples) (R8P).
Returns: integer(kind=I4P)
fortran
function read_dataarray_rank2_R8P(self, location, data_name, x, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
x | real(kind=R8P) | out | allocatable | Values. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
Call graph
read_dataarray_rank2_R4P
Read a dataarray into an array of shape (number of components, number of tuples) (R4P).
Returns: integer(kind=I4P)
fortran
function read_dataarray_rank2_R4P(self, location, data_name, x, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
x | real(kind=R4P) | out | allocatable | Values. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
Call graph
read_dataarray_rank2_I8P
Read a dataarray into an array of shape (number of components, number of tuples) (I8P).
Returns: integer(kind=I4P)
fortran
function read_dataarray_rank2_I8P(self, location, data_name, x, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
x | integer(kind=I8P) | out | allocatable | Values. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
Call graph
read_dataarray_rank2_I4P
Read a dataarray into an array of shape (number of components, number of tuples) (I4P).
Returns: integer(kind=I4P)
fortran
function read_dataarray_rank2_I4P(self, location, data_name, x, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
x | integer(kind=I4P) | out | allocatable | Values. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
Call graph
read_dataarray_rank2_I2P
Read a dataarray into an array of shape (number of components, number of tuples) (I2P).
Returns: integer(kind=I4P)
fortran
function read_dataarray_rank2_I2P(self, location, data_name, x, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
x | integer(kind=I2P) | out | allocatable | Values. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
Call graph
read_dataarray_rank2_I1P
Read a dataarray into an array of shape (number of components, number of tuples) (I1P).
Returns: integer(kind=I4P)
fortran
function read_dataarray_rank2_I1P(self, location, data_name, x, piece) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
location | character(len=*) | in | Location: node, cell or field. | |
data_name | character(len=*) | in | Name of the dataarray. | |
x | integer(kind=I1P) | out | allocatable | Values. |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1, ignored for field data). |
Call graph
read_coordinate_R8P
Read a geometry dataarray element into R8P, checking its number of components (default 1).
Returns: integer(kind=I4P)
fortran
function read_coordinate_R8P(self, id, x, n_components) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
id | integer(kind=I4P) | in | Index of the dataarray element. | |
x | real(kind=R8P) | out | allocatable | Values. |
n_components | integer(kind=I4P) | in | optional | Expected number of components. |
Call graph
read_coordinate_R4P
Read a geometry dataarray element into R4P, checking its number of components (default 1).
Returns: integer(kind=I4P)
fortran
function read_coordinate_R4P(self, id, x, n_components) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
id | integer(kind=I4P) | in | Index of the dataarray element. | |
x | real(kind=R4P) | out | allocatable | Values. |
n_components | integer(kind=I4P) | in | optional | Expected number of components. |
Call graph
read_appended_raw
Read the data of a dataarray from raw appended data: the bytes count (or the compressed data header) and the data.
Returns: integer(kind=I4P)
fortran
function read_appended_raw(self, pos, bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
pos | integer(kind=I8P) | in | Position of the dataarray in the file. | |
bytes | integer(kind=I1P) | out | allocatable | Data bytes. |
Call graph
read_appended_base64
Read the data of a dataarray from base64 appended data (offsets count characters).
The length of the code of a dataarray is computed from its header: the bytes count (uncompressed, one base64 stream with the data) or the header of the compressed data (a base64 stream of its own, followed by the blocks).
Returns: integer(kind=I4P)
fortran
function read_appended_base64(self, pos, bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
pos | integer(kind=I8P) | in | Position of the dataarray in the file. | |
bytes | integer(kind=I1P) | out | allocatable | Data bytes. |
Call graph
polydata_section
Return the name of the element of a block of polydata cells, empty if the block is absent and has no cells.
Returns: integer(kind=I4P)
fortran
function polydata_section(self, block, piece, section) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(xml_reader) | in | XML reader. | |
block | character(len=*) | in | Block of cells: verts, lines, strips or polys. | |
piece | integer(kind=I4P) | in | optional | Piece, from 1 (default 1). |
section | character(len=:) | out | allocatable | Name of the block element. |
Call graph
find_marker
Return the position following the '_' marker of the appended data, searched from a position (0 if not found).
Returns: integer(kind=I8P)
fortran
function find_marker(filename, pos) result(start)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
filename | character(len=*) | in | File name. | |
pos | integer(kind=I8P) | in | Position where the search starts. |
Call graph
read_chars
Read the characters of a file between two positions (none if last < first).
Returns: integer(kind=I4P)
fortran
function read_chars(filename, first, last, chars) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
filename | character(len=*) | in | File name. | |
first | integer(kind=I8P) | in | First position. | |
last | integer(kind=I8P) | in | Last position. | |
chars | character(len=:) | out | allocatable | Characters read. |
Call graph
read_bytes
Read bytes of a file from a position.
Returns: integer(kind=I4P)
fortran
function read_bytes(filename, pos, n, bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
filename | character(len=*) | in | File name. | |
pos | integer(kind=I8P) | in | First position. | |
n | integer(kind=I8P) | in | Number of bytes. | |
bytes | integer(kind=I1P) | out | allocatable | Bytes read. |
Call graph
to_I4P
Convert ids into I4P, checking that they fit.
Returns: integer(kind=I4P)
fortran
function to_I4P(ids, x) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ids | integer(kind=I8P) | in | Ids. | |
x | integer(kind=I4P) | out | allocatable | Ids, I4P. |
Call graph
is_dataarray
Return .true. if an element name is a data array: DataArray, Array (field data strings) or PDataArray (parallel).
Attributes: elemental
Returns: logical
fortran
function is_dataarray(name) result(is_array)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
name | character(len=*) | in | Element name. |
Call graph
lower_case
Return a string in lower case (ASCII letters only).
Attributes: pure
Returns: character(len=len(string))
fortran
function lower_case(string) result(lower)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
string | character(len=*) | in | Input string. |
Call graph