Appearance
vtk_fortran_hdf5
Minimal HDF5 bindings (C API) used by the VTKHDF format: files, groups, links, attributes, datasets (fixed or appendable, optionally deflated, or written by blocks), and their reading back.
The HDF5 C API is bound with iso_c_binding, not through the HDF5 Fortran module: no hdf5.mod (specific to the compiler and to the HDF5 build) is needed, only the C library (-lhdf5, plus the MPI libraries when HDF5 is a parallel build). The predefined types are the C globals behind the HDF5 macros (H5T_NATIVE_DOUBLE is H5T_NATIVE_DOUBLE_g), valid after H5open. Checked with HDF5 1.10.11 and 2.3.0.
The module is always compiled: without VTKFORTRAN_USE_HDF5 the procedures are stubs returning an error, and is_hdf5_enabled is .false..
Datasets are written by the procedure of their kind (h5_dataset_write_R8P, ...), read through the generic h5_dataset_read. Dimensions are given in the Fortran order (the first one varies fastest) and reversed for HDF5 (C order): the array x(nc, ni, nj, nk) is the HDF5 dataset [nk, nj, ni, nc]. An appendable dataset grows along its last Fortran dimension (the first HDF5 one). A dataset written by blocks (h5_dataset_slab_<kind>: in a parallel file, each rank its block of a grid) is created with its whole shape, then each block written where it goes; with append (a time series of a grid) it grows along its last dimension, each block written in the new rows. An appendable or deflated dataset is chunked by whole rows (its last Fortran dimension): as many as fit in the optional chunk_bytes of h5_dataset_write_<kind> (default DEFAULT_CHUNK_BYTES, 1 MiB), at least one, at most the rows written when it is created; h5_dataset_chunk reads the chunk shape back.
Source: src/lib/vtk_fortran_hdf5.F90
Dependencies
Contents
- h5_attribute_write
- h5_attribute_read
- h5_dataset_read
- h5_initialize
- h5_file_create
- h5_mpi_sum
- h5_file_open
- h5_file_flush
- h5_file_close
- h5_group_create
- h5_group_open
- h5_group_close
- h5_link_exists
- h5_link_soft
- h5_link_target
- h5_object_copy
- h5_group_names
- h5_attribute_exists
- h5_attribute_write_string
- h5_attribute_write_I4P
- h5_attribute_write_I8P
- h5_attribute_write_R8P
- h5_attribute_read_string
- h5_attribute_read_I8P
- h5_attribute_read_R8P
- h5_deflate_available
- h5_parallel_filters_available
- h5_dataset_open
- h5_dataset_close
- h5_dataset_dims
- h5_dataset_chunk
- h5_dataset_info
- h5_dataset_read_bytes
- h5_dataset_resize
- h5_dataset_write_R8P
- h5_dataset_write_R4P
- h5_dataset_write_I8P
- h5_dataset_write_strings
- h5_dataset_append_strings
- h5_dataset_write_I4P
- h5_dataset_write_I2P
- h5_dataset_write_I1P
- h5_dataset_slab_R8P
- h5_dataset_slab_R4P
- h5_dataset_slab_I8P
- h5_dataset_slab_I4P
- h5_dataset_slab_I2P
- h5_dataset_slab_I1P
- h5_name_invalid
- h5_mpi_max
- h5_mpi_rank
- h5_mpi_allgather
- h5_dataset_append_R8P
- h5_dataset_append_R4P
- h5_dataset_append_I8P
- h5_dataset_append_I4P
- h5_dataset_append_I2P
- h5_dataset_append_I1P
- h5_dataset_read_R8P
- h5_dataset_read_R4P
- h5_dataset_read_I8P
- h5_dataset_read_I4P
- h5_dataset_read_I2P
- h5_dataset_read_I1P
- is_true
- c_dims
- dataset_size
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
hid_kind | integer | parameter | Kind of the HDF5 identifiers (hid_t, 64-bit since HDF5 1.10). |
is_hdf5_enabled | logical | parameter | The library is built with HDF5 (VTKFORTRAN_USE_HDF5). |
is_mpi_enabled | logical | parameter | The library is built with MPI (VTKFORTRAN_USE_MPI): parallel HDF5 files. |
H5P_DEFAULT | integer(kind=c_int64_t) | parameter | Default property list. |
H5S_ALL | integer(kind=c_int64_t) | parameter | The whole dataspace. |
H5E_DEFAULT | integer(kind=c_int64_t) | parameter | Default error stack. |
H5F_ACC_RDONLY | integer(kind=c_int) | parameter | Open read-only. |
H5F_ACC_RDWR | integer(kind=c_int) | parameter | Open for reading and writing. |
H5F_ACC_TRUNC | integer(kind=c_int) | parameter | Create, overwriting an existing file. |
H5F_SCOPE_LOCAL | integer(kind=c_int) | parameter | Flush scope: this file. |
H5S_SCALAR | integer(kind=c_int) | parameter | Scalar dataspace class. |
H5S_SELECT_SET | integer(kind=c_int) | parameter | Hyperslab selection: replace. |
H5T_STR_NULLPAD | integer(kind=c_int) | parameter | Fixed-length string padded with NULs. |
H5Z_FILTER_DEFLATE | integer(kind=c_int) | parameter | The deflate (zlib) filter. |
H5P_CRT_ORDER_TRACKED | integer(kind=c_int) | parameter | Track the creation order of links. |
H5P_CRT_ORDER_INDEXED | integer(kind=c_int) | parameter | Index the creation order of links. |
H5S_UNLIMITED | integer(kind=c_long_long) | parameter | Unlimited dimension ((hsize_t)-1). |
DEFAULT_CHUNK_BYTES | integer(kind=I8P) | parameter | Bytes of a chunk at most (but one row), default. |
Interfaces
h5_attribute_write
Write an attribute: a string, or a rank-1 array of I4P, I8P or R8P values.
Module procedures: h5_attribute_write_string, h5_attribute_write_I4P, h5_attribute_write_I8P, h5_attribute_write_R8P
h5_attribute_read
Read an attribute: a string, or a rank-1 array of I8P or R8P values (converted from the stored type).
Module procedures: h5_attribute_read_string, h5_attribute_read_I8P, h5_attribute_read_R8P
h5_dataset_read
Read the values of a dataset, converted to the kind of the output.
Module procedures: h5_dataset_read_R8P, h5_dataset_read_R4P, h5_dataset_read_I8P, h5_dataset_read_I4P, h5_dataset_read_I2P, h5_dataset_read_I1P
Functions
h5_initialize
Initialize HDF5 (the predefined types) and silence its automatic error printing: the procedures return errors.
Returns: integer(kind=I4P)
fortran
function h5_initialize() result(error)Call graph
h5_file_create
Create a file (an existing one is overwritten); with comm (a Fortran MPI communicator) a parallel file, created by every rank of it (the library built with MPI, VTKFORTRAN_USE_MPI, and a parallel HDF5).
Returns: integer(kind=I4P)
fortran
function h5_file_create(filename, file_id, comm) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
filename | character(len=*) | in | File name. | |
file_id | integer(kind=hid_kind) | out | File identifier. | |
comm | integer(kind=I4P) | in | optional | MPI communicator (Fortran handle, MPI_Comm%MPI_VAL). |
Call graph
h5_mpi_sum
The sum of n over the ranks of comm (a Fortran MPI communicator); n without MPI.
Returns: integer(kind=I8P)
fortran
function h5_mpi_sum(comm, n) result(total)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
comm | integer(kind=I4P) | in | MPI communicator (Fortran handle). | |
n | integer(kind=I8P) | in | Value of the rank. |
Call graph
h5_file_open
Open an existing file, read-only or (readwrite=.true.) for reading and writing; with comm (a Fortran MPI communicator) as a parallel file, opened by every rank of it (as h5_file_create).
Returns: integer(kind=I4P)
fortran
function h5_file_open(filename, file_id, readwrite, comm) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
filename | character(len=*) | in | File name. | |
file_id | integer(kind=hid_kind) | out | File identifier. | |
readwrite | logical | in | optional | Open for writing too. |
comm | integer(kind=I4P) | in | optional | MPI communicator (Fortran handle). |
Call graph
h5_file_flush
Flush the file to disk.
Returns: integer(kind=I4P)
fortran
function h5_file_flush(file_id) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
file_id | integer(kind=hid_kind) | in | File identifier. |
Call graph
h5_file_close
Close a file.
Returns: integer(kind=I4P)
fortran
function h5_file_close(file_id) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
file_id | integer(kind=hid_kind) | inout | File identifier, -1 once closed. |
Call graph
h5_group_create
Create a group; with track_order=.true. the creation order of its links is tracked and indexed (VTKHDF assemblies).
Returns: integer(kind=I4P)
fortran
function h5_group_create(loc_id, name, group_id, track_order) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Group name. | |
group_id | integer(kind=hid_kind) | out | Group identifier. | |
track_order | logical | in | optional | Track the creation order of the links. |
Call graph
h5_group_open
Open a group.
Returns: integer(kind=I4P)
fortran
function h5_group_open(loc_id, name, group_id) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Group name (or path). | |
group_id | integer(kind=hid_kind) | out | Group identifier. |
Call graph
h5_group_close
Close a group.
Returns: integer(kind=I4P)
fortran
function h5_group_close(group_id) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
group_id | integer(kind=hid_kind) | inout | Group identifier, -1 once closed. |
Call graph
h5_link_exists
Return true if the link (group or dataset) name exists in loc_id.
Returns: logical
fortran
function h5_link_exists(loc_id, name) result(exists)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Link name (one level). |
Call graph
h5_link_soft
Create the soft (symbolic) link name in loc_id, pointing to the path target.
Returns: integer(kind=I4P)
fortran
function h5_link_soft(target, loc_id, name) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
target | character(len=*) | in | Path of the linked object. | |
loc_id | integer(kind=hid_kind) | in | Group of the link. | |
name | character(len=*) | in | Link name. |
Call graph
h5_link_target
Return the path a soft (symbolic) link name of loc_id points to; an error (target empty) for a hard link (a group or dataset) or a missing one.
Returns: integer(kind=I4P)
fortran
function h5_link_target(loc_id, name, target) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Group of the link. | |
name | character(len=*) | in | Link name. | |
target | character(len=:) | out | allocatable | Path of the linked object. |
Call graph
h5_object_copy
Copy the object (group or dataset, with all it holds) src_name of src_loc to dst_name of dst_loc, in the same or another file.
Returns: integer(kind=I4P)
fortran
function h5_object_copy(src_loc, src_name, dst_loc, dst_name) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
src_loc | integer(kind=hid_kind) | in | Source file or group. | |
src_name | character(len=*) | in | Source object. | |
dst_loc | integer(kind=hid_kind) | in | Destination file or group. | |
dst_name | character(len=*) | in | Destination name. |
Call graph
h5_group_names
Return the names of the members (links) of the group group of loc_id, in their creation order when the group tracks it (the groups VTKFortran and VTK write), otherwise in the order of their names; each one followed by a NUL character (achar(0)); empty if the group has none.
Returns: integer(kind=I4P)
fortran
function h5_group_names(loc_id, group, names) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
group | character(len=*) | in | Group name (or path). | |
names | character(len=:) | out | allocatable | Names, each followed by NUL. |
Call graph
h5_attribute_exists
Return true if the attribute name of the object loc_id exists.
Returns: logical
fortran
function h5_attribute_exists(loc_id, name) result(exists)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Object (file, group or dataset). | |
name | character(len=*) | in | Attribute name. |
Call graph
h5_attribute_write_string
Write a string attribute: fixed length, the length of the value, padded with NULs, as VTK writes Type; or, with variable_length, a variable-length string (as h5py writes a str).
Returns: integer(kind=I4P)
fortran
function h5_attribute_write_string(loc_id, name, value, variable_length) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Object (file, group or dataset). | |
name | character(len=*) | in | Attribute name. | |
value | character(len=*) | in | Attribute value. | |
variable_length | logical | in | optional | A variable-length string (default false). |
h5_attribute_write_I4P
Write a rank-1 attribute of I4P values (HDF5 native int32).
Returns: integer(kind=I4P)
fortran
function h5_attribute_write_I4P(loc_id, name, value) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Object (file, group or dataset). | |
name | character(len=*) | in | Attribute name. | |
value | integer(kind=I4P) | in | target | Attribute values. |
h5_attribute_write_I8P
Write a rank-1 attribute of I8P values (HDF5 native int64).
Returns: integer(kind=I4P)
fortran
function h5_attribute_write_I8P(loc_id, name, value) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Object (file, group or dataset). | |
name | character(len=*) | in | Attribute name. | |
value | integer(kind=I8P) | in | target | Attribute values. |
h5_attribute_write_R8P
Write a rank-1 attribute of R8P values (HDF5 native double).
Returns: integer(kind=I4P)
fortran
function h5_attribute_write_R8P(loc_id, name, value) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Object (file, group or dataset). | |
name | character(len=*) | in | Attribute name. | |
value | real(kind=R8P) | in | target | Attribute values. |
h5_attribute_read_string
Read a string attribute: fixed length (trailing NULs dropped) or variable length (as h5py writes a str; the first string of an array of them), ASCII or UTF-8.
Returns: integer(kind=I4P)
fortran
function h5_attribute_read_string(loc_id, name, value) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Object (file, group or dataset). | |
name | character(len=*) | in | Attribute name. | |
value | character(len=:) | out | allocatable | Attribute value. |
h5_attribute_read_I8P
Read a numeric attribute as I8P values.
Returns: integer(kind=I4P)
fortran
function h5_attribute_read_I8P(loc_id, name, value) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Object (file, group or dataset). | |
name | character(len=*) | in | Attribute name. | |
value | integer(kind=I8P) | out | allocatable | Attribute values. |
h5_attribute_read_R8P
Read a numeric attribute as R8P values.
Returns: integer(kind=I4P)
fortran
function h5_attribute_read_R8P(loc_id, name, value) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Object (file, group or dataset). | |
name | character(len=*) | in | Attribute name. | |
value | real(kind=R8P) | out | allocatable | Attribute values. |
h5_deflate_available
Return true if HDF5 has the deflate (zlib) filter.
Returns: logical
fortran
function h5_deflate_available() result(available)Call graph
h5_parallel_filters_available
Return true if the ranks of a communicator can write deflated datasets: the library built with MPI, an HDF5 with the deflate filter and parallel filtered writes (HDF5 1.10.2 or later; the writes are then collective).
Returns: logical
fortran
function h5_parallel_filters_available() result(available)Call graph
h5_dataset_open
Open a dataset (e.g. to write attributes on it).
Returns: integer(kind=I4P)
fortran
function h5_dataset_open(loc_id, name, dset_id) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name (or path). | |
dset_id | integer(kind=hid_kind) | out | Dataset identifier. |
Call graph
h5_dataset_close
Close a dataset.
Returns: integer(kind=I4P)
fortran
function h5_dataset_close(dset_id) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
dset_id | integer(kind=hid_kind) | inout | Dataset identifier, -1 once closed. |
Call graph
h5_dataset_dims
Return the shape of a dataset, in Fortran order (the first dimension varies fastest).
Returns: integer(kind=I4P)
fortran
function h5_dataset_dims(loc_id, name, dims) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name (or path). | |
dims | integer(kind=I8P) | out | allocatable | Shape, Fortran order. |
Call graph
h5_dataset_chunk
Return the chunk shape of a dataset, in Fortran order; empty for a dataset that is not chunked.
Returns: integer(kind=I4P)
fortran
function h5_dataset_chunk(loc_id, name, chunk) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name (or path). | |
chunk | integer(kind=I8P) | out | allocatable | Chunk shape, Fortran order. |
h5_dataset_info
Return the VTK type of a dataset (Float64, Float32, Int64, ..., UInt8; String for a string dataset, fixed or variable length, as vtkHDFWriter writes a vtkStringArray) and its shape (Fortran order).
Returns: integer(kind=I4P)
fortran
function h5_dataset_info(loc_id, name, data_type, dims) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name (or path). | |
data_type | character(len=:) | out | allocatable | VTK type, empty if not a numeric type. |
dims | integer(kind=I8P) | out | allocatable | Shape, Fortran order. |
Call graph
h5_dataset_read_bytes
Read the slice first+1 ... first+count of the last Fortran dimension (the first HDF5 one) of a numeric dataset, all of its other dimensions, as the bytes of its values in the native type of the file's type (see h5_dataset_info); of a string dataset (fixed or variable length), the bytes of its strings, each one followed by a NUL (VTK's String).
Returns: integer(kind=I4P)
fortran
function h5_dataset_read_bytes(loc_id, name, first, count, bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name (or path). | |
first | integer(kind=I8P) | in | Values (rows) skipped along the last dimension. | |
count | integer(kind=I8P) | in | Values (rows) read along the last dimension. | |
bytes | integer(kind=I1P) | out | allocatable | Bytes of the values. |
Call graph
h5_dataset_resize
Resize an appendable dataset along its last Fortran dimension (the first HDF5 one) to n: values past it are dropped, the other dimensions are kept.
Returns: integer(kind=I4P)
fortran
function h5_dataset_resize(loc_id, name, n) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name (or path). | |
n | integer(kind=I8P) | in | New size of the last dimension. |
Call graph
h5_dataset_write_R8P
Create a dataset of R8P values (HDF5 native double), shape dims in Fortran order.
Returns: integer(kind=I4P)
fortran
function h5_dataset_write_R8P(loc_id, name, x, dims, appendable, deflate, comm, chunk_bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | real(kind=R8P) | in | target | Values, any rank (sequence association). |
dims | integer(kind=I8P) | in | Shape, Fortran order. | |
appendable | logical | in | optional | Chunked, unlimited along the last dimension. |
deflate | integer(kind=I4P) | in | optional | Deflate level (1-9), implies chunking. |
comm | integer(kind=I4P) | in | optional | MPI communicator: every rank writes its rows (appendable, collective). |
chunk_bytes | integer(kind=I8P) | in | optional | Bytes of a chunk at most (default 1 MiB), at least 1. |
Call graph
h5_dataset_write_R4P
Create a dataset of R4P values (HDF5 native float), shape dims in Fortran order.
Returns: integer(kind=I4P)
fortran
function h5_dataset_write_R4P(loc_id, name, x, dims, appendable, deflate, comm, chunk_bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | real(kind=R4P) | in | target | Values, any rank (sequence association). |
dims | integer(kind=I8P) | in | Shape, Fortran order. | |
appendable | logical | in | optional | Chunked, unlimited along the last dimension. |
deflate | integer(kind=I4P) | in | optional | Deflate level (1-9), implies chunking. |
comm | integer(kind=I4P) | in | optional | MPI communicator: every rank writes its rows (appendable, collective). |
chunk_bytes | integer(kind=I8P) | in | optional | Bytes of a chunk at most (default 1 MiB), at least 1. |
Call graph
h5_dataset_write_I8P
Create a dataset of I8P values (HDF5 native int64, or uint64 with unsigned=.true.), shape dims in Fortran order.
Returns: integer(kind=I4P)
fortran
function h5_dataset_write_I8P(loc_id, name, x, dims, appendable, deflate, unsigned, comm, chunk_bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | integer(kind=I8P) | in | target | Values, any rank (sequence association). |
dims | integer(kind=I8P) | in | Shape, Fortran order. | |
appendable | logical | in | optional | Chunked, unlimited along the last dimension. |
deflate | integer(kind=I4P) | in | optional | Deflate level (1-9), implies chunking. |
unsigned | logical | in | optional | Store the bits as the unsigned type of the same width. |
comm | integer(kind=I4P) | in | optional | MPI communicator: every rank writes its rows (appendable, collective). |
chunk_bytes | integer(kind=I8P) | in | optional | Bytes of a chunk at most (default 1 MiB), at least 1. |
Call graph
h5_dataset_write_strings
Create a rank-1 dataset of variable-length ASCII strings (as vtkHDFWriter writes a vtkStringArray), one per element of x, its trailing blanks dropped.
Returns: integer(kind=I4P)
fortran
function h5_dataset_write_strings(loc_id, name, x, appendable, chunk_bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | character(len=*) | in | Strings. | |
appendable | logical | in | optional | Chunked, unlimited. |
chunk_bytes | integer(kind=I8P) | in | optional | Bytes of a chunk at most (default 1 MiB), at least 1. |
Call graph
h5_dataset_append_strings
Append variable-length strings (trailing blanks dropped) to an appendable string dataset of h5_dataset_write_strings.
Returns: integer(kind=I4P)
fortran
function h5_dataset_append_strings(loc_id, name, x) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | character(len=*) | in | Strings appended. |
Call graph
h5_dataset_write_I4P
Create a dataset of I4P values (HDF5 native int32, or uint32 with unsigned=.true.), shape dims in Fortran order.
Returns: integer(kind=I4P)
fortran
function h5_dataset_write_I4P(loc_id, name, x, dims, appendable, deflate, unsigned, comm, chunk_bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | integer(kind=I4P) | in | target | Values, any rank (sequence association). |
dims | integer(kind=I8P) | in | Shape, Fortran order. | |
appendable | logical | in | optional | Chunked, unlimited along the last dimension. |
deflate | integer(kind=I4P) | in | optional | Deflate level (1-9), implies chunking. |
unsigned | logical | in | optional | Store the bits as the unsigned type of the same width. |
comm | integer(kind=I4P) | in | optional | MPI communicator: every rank writes its rows (appendable, collective). |
chunk_bytes | integer(kind=I8P) | in | optional | Bytes of a chunk at most (default 1 MiB), at least 1. |
Call graph
h5_dataset_write_I2P
Create a dataset of I2P values (HDF5 native int16, or uint16 with unsigned=.true.), shape dims in Fortran order.
Returns: integer(kind=I4P)
fortran
function h5_dataset_write_I2P(loc_id, name, x, dims, appendable, deflate, unsigned, comm, chunk_bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | integer(kind=I2P) | in | target | Values, any rank (sequence association). |
dims | integer(kind=I8P) | in | Shape, Fortran order. | |
appendable | logical | in | optional | Chunked, unlimited along the last dimension. |
deflate | integer(kind=I4P) | in | optional | Deflate level (1-9), implies chunking. |
unsigned | logical | in | optional | Store the bits as the unsigned type of the same width. |
comm | integer(kind=I4P) | in | optional | MPI communicator: every rank writes its rows (appendable, collective). |
chunk_bytes | integer(kind=I8P) | in | optional | Bytes of a chunk at most (default 1 MiB), at least 1. |
Call graph
h5_dataset_write_I1P
Create a dataset of I1P values (HDF5 native int8, or uint8 with unsigned=.true.), shape dims in Fortran order.
Returns: integer(kind=I4P)
fortran
function h5_dataset_write_I1P(loc_id, name, x, dims, appendable, deflate, unsigned, comm, chunk_bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | integer(kind=I1P) | in | target | Values, any rank (sequence association). |
dims | integer(kind=I8P) | in | Shape, Fortran order. | |
appendable | logical | in | optional | Chunked, unlimited along the last dimension. |
deflate | integer(kind=I4P) | in | optional | Deflate level (1-9), implies chunking. |
unsigned | logical | in | optional | Store the bits as the unsigned type of the same width. |
comm | integer(kind=I4P) | in | optional | MPI communicator: every rank writes its rows (appendable, collective). |
chunk_bytes | integer(kind=I8P) | in | optional | Bytes of a chunk at most (default 1 MiB), at least 1. |
Call graph
h5_dataset_slab_R8P
Write the block count of the values x (R8P; shape mem_dims, the block at mem_start) into the dataset name, at file_start (Fortran order, from 0); with create, the dataset is created first, shape dims (in a parallel file by every rank: collective; the blocks are then written by each rank alone). An empty block writes nothing.
Returns: integer(kind=I4P)
fortran
function h5_dataset_slab_R8P(loc_id, name, x, dims, mem_dims, mem_start, file_start, count, create, append, chunk_bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | real(kind=R8P) | in | target | Values, any rank (sequence association). |
dims | integer(kind=I8P) | in | Shape of the dataset, Fortran order. | |
mem_dims | integer(kind=I8P) | in | Shape of the values, Fortran order. | |
mem_start | integer(kind=I8P) | in | Start of the block in the values, from 0. | |
file_start | integer(kind=I8P) | in | Start of the block in the dataset, from 0. | |
count | integer(kind=I8P) | in | Shape of the block. | |
create | logical | in | Create the dataset first. | |
append | logical | in | optional | Grow along the last dimension (see dataset_slab). |
chunk_bytes | integer(kind=I8P) | in | optional | Bytes of a chunk at most, with append (default 1 MiB). |
Call graph
h5_dataset_slab_R4P
Write the block count of the values x (R4P; shape mem_dims, the block at mem_start) into the dataset name, at file_start (Fortran order, from 0); with create, the dataset is created first, shape dims (in a parallel file by every rank: collective; the blocks are then written by each rank alone). An empty block writes nothing.
Returns: integer(kind=I4P)
fortran
function h5_dataset_slab_R4P(loc_id, name, x, dims, mem_dims, mem_start, file_start, count, create, append, chunk_bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | real(kind=R4P) | in | target | Values, any rank (sequence association). |
dims | integer(kind=I8P) | in | Shape of the dataset, Fortran order. | |
mem_dims | integer(kind=I8P) | in | Shape of the values, Fortran order. | |
mem_start | integer(kind=I8P) | in | Start of the block in the values, from 0. | |
file_start | integer(kind=I8P) | in | Start of the block in the dataset, from 0. | |
count | integer(kind=I8P) | in | Shape of the block. | |
create | logical | in | Create the dataset first. | |
append | logical | in | optional | Grow along the last dimension (see dataset_slab). |
chunk_bytes | integer(kind=I8P) | in | optional | Bytes of a chunk at most, with append (default 1 MiB). |
Call graph
h5_dataset_slab_I8P
Write the block count of the values x (I8P; shape mem_dims, the block at mem_start) into the dataset name, at file_start (Fortran order, from 0); with create, the dataset is created first, shape dims (in a parallel file by every rank: collective; the blocks are then written by each rank alone). An empty block writes nothing.
Returns: integer(kind=I4P)
fortran
function h5_dataset_slab_I8P(loc_id, name, x, dims, mem_dims, mem_start, file_start, count, create, unsigned, append, chunk_bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | integer(kind=I8P) | in | target | Values, any rank (sequence association). |
dims | integer(kind=I8P) | in | Shape of the dataset, Fortran order. | |
mem_dims | integer(kind=I8P) | in | Shape of the values, Fortran order. | |
mem_start | integer(kind=I8P) | in | Start of the block in the values, from 0. | |
file_start | integer(kind=I8P) | in | Start of the block in the dataset, from 0. | |
count | integer(kind=I8P) | in | Shape of the block. | |
create | logical | in | Create the dataset first. | |
unsigned | logical | in | optional | Store the bits as the unsigned type of their width. |
append | logical | in | optional | Grow along the last dimension (see dataset_slab). |
chunk_bytes | integer(kind=I8P) | in | optional | Bytes of a chunk at most, with append (default 1 MiB). |
Call graph
h5_dataset_slab_I4P
Write the block count of the values x (I4P; shape mem_dims, the block at mem_start) into the dataset name, at file_start (Fortran order, from 0); with create, the dataset is created first, shape dims (in a parallel file by every rank: collective; the blocks are then written by each rank alone). An empty block writes nothing.
Returns: integer(kind=I4P)
fortran
function h5_dataset_slab_I4P(loc_id, name, x, dims, mem_dims, mem_start, file_start, count, create, unsigned, append, chunk_bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | integer(kind=I4P) | in | target | Values, any rank (sequence association). |
dims | integer(kind=I8P) | in | Shape of the dataset, Fortran order. | |
mem_dims | integer(kind=I8P) | in | Shape of the values, Fortran order. | |
mem_start | integer(kind=I8P) | in | Start of the block in the values, from 0. | |
file_start | integer(kind=I8P) | in | Start of the block in the dataset, from 0. | |
count | integer(kind=I8P) | in | Shape of the block. | |
create | logical | in | Create the dataset first. | |
unsigned | logical | in | optional | Store the bits as the unsigned type of their width. |
append | logical | in | optional | Grow along the last dimension (see dataset_slab). |
chunk_bytes | integer(kind=I8P) | in | optional | Bytes of a chunk at most, with append (default 1 MiB). |
Call graph
h5_dataset_slab_I2P
Write the block count of the values x (I2P; shape mem_dims, the block at mem_start) into the dataset name, at file_start (Fortran order, from 0); with create, the dataset is created first, shape dims (in a parallel file by every rank: collective; the blocks are then written by each rank alone). An empty block writes nothing.
Returns: integer(kind=I4P)
fortran
function h5_dataset_slab_I2P(loc_id, name, x, dims, mem_dims, mem_start, file_start, count, create, unsigned, append, chunk_bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | integer(kind=I2P) | in | target | Values, any rank (sequence association). |
dims | integer(kind=I8P) | in | Shape of the dataset, Fortran order. | |
mem_dims | integer(kind=I8P) | in | Shape of the values, Fortran order. | |
mem_start | integer(kind=I8P) | in | Start of the block in the values, from 0. | |
file_start | integer(kind=I8P) | in | Start of the block in the dataset, from 0. | |
count | integer(kind=I8P) | in | Shape of the block. | |
create | logical | in | Create the dataset first. | |
unsigned | logical | in | optional | Store the bits as the unsigned type of their width. |
append | logical | in | optional | Grow along the last dimension (see dataset_slab). |
chunk_bytes | integer(kind=I8P) | in | optional | Bytes of a chunk at most, with append (default 1 MiB). |
Call graph
h5_dataset_slab_I1P
Write the block count of the values x (I1P; shape mem_dims, the block at mem_start) into the dataset name, at file_start (Fortran order, from 0); with create, the dataset is created first, shape dims (in a parallel file by every rank: collective; the blocks are then written by each rank alone). An empty block writes nothing.
Returns: integer(kind=I4P)
fortran
function h5_dataset_slab_I1P(loc_id, name, x, dims, mem_dims, mem_start, file_start, count, create, unsigned, append, chunk_bytes) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | integer(kind=I1P) | in | target | Values, any rank (sequence association). |
dims | integer(kind=I8P) | in | Shape of the dataset, Fortran order. | |
mem_dims | integer(kind=I8P) | in | Shape of the values, Fortran order. | |
mem_start | integer(kind=I8P) | in | Start of the block in the values, from 0. | |
file_start | integer(kind=I8P) | in | Start of the block in the dataset, from 0. | |
count | integer(kind=I8P) | in | Shape of the block. | |
create | logical | in | Create the dataset first. | |
unsigned | logical | in | optional | Store the bits as the unsigned type of their width. |
append | logical | in | optional | Grow along the last dimension (see dataset_slab). |
chunk_bytes | integer(kind=I8P) | in | optional | Bytes of a chunk at most, with append (default 1 MiB). |
Call graph
h5_name_invalid
Why name cannot be the name of a VTKHDF array or block, empty if it can: VTKHDF names cannot contain / (the separator of HDF5 paths) nor . (the VTKHDF specification, Limitations), and cannot be empty. HDF5 sets no limit to the length of a name (measured: 200000 characters accepted).
Attributes: pure
Returns: character(len=:)
fortran
function h5_name_invalid(name) result(reason)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
name | character(len=*) | in | Name. |
Call graph
h5_mpi_max
The maximum of n over the ranks of comm (a Fortran MPI communicator, collective); n without MPI.
Returns: integer(kind=I8P)
fortran
function h5_mpi_max(comm, n) result(nmax)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
comm | integer(kind=I4P) | in | MPI communicator (Fortran handle). | |
n | integer(kind=I8P) | in | Value of this rank. |
Call graph
h5_mpi_rank
The rank of this process in comm (a Fortran MPI communicator); 0 without MPI.
Returns: integer(kind=I4P)
fortran
function h5_mpi_rank(comm) result(rank)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
comm | integer(kind=I4P) | in | MPI communicator (Fortran handle). |
Call graph
h5_mpi_allgather
The values of every rank of comm (a Fortran MPI communicator), gathered(:, r) those of the rank r - 1; the values of this rank alone without MPI (and an error).
Returns: integer(kind=I4P)
fortran
function h5_mpi_allgather(comm, values, gathered) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
comm | integer(kind=I4P) | in | MPI communicator (Fortran handle). | |
values | integer(kind=I8P) | in | Values of this rank. | |
gathered | integer(kind=I8P) | out | allocatable | Values of every rank. |
Call graph
h5_dataset_append_R8P
Append R8P values to an appendable dataset; dims is the shape of the values appended, Fortran order.
Returns: integer(kind=I4P)
fortran
function h5_dataset_append_R8P(loc_id, name, x, dims, comm) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | real(kind=R8P) | in | target | Values appended, any rank. |
dims | integer(kind=I8P) | in | Shape of the values appended, Fortran order. | |
comm | integer(kind=I4P) | in | optional | MPI communicator: every rank appends its values, in rank order. |
Call graph
h5_dataset_append_R4P
Append R4P values to an appendable dataset; dims is the shape of the values appended, Fortran order.
Returns: integer(kind=I4P)
fortran
function h5_dataset_append_R4P(loc_id, name, x, dims, comm) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | real(kind=R4P) | in | target | Values appended, any rank. |
dims | integer(kind=I8P) | in | Shape of the values appended, Fortran order. | |
comm | integer(kind=I4P) | in | optional | MPI communicator: every rank appends its values, in rank order. |
Call graph
h5_dataset_append_I8P
Append I8P values to an appendable dataset; dims is the shape of the values appended, Fortran order.
Returns: integer(kind=I4P)
fortran
function h5_dataset_append_I8P(loc_id, name, x, dims, unsigned, comm) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | integer(kind=I8P) | in | target | Values appended, any rank. |
dims | integer(kind=I8P) | in | Shape of the values appended, Fortran order. | |
unsigned | logical | in | optional | The values are the bits of the unsigned type of the same width. |
comm | integer(kind=I4P) | in | optional | MPI communicator: every rank appends its values, in rank order. |
Call graph
h5_dataset_append_I4P
Append I4P values to an appendable dataset; dims is the shape of the values appended, Fortran order.
Returns: integer(kind=I4P)
fortran
function h5_dataset_append_I4P(loc_id, name, x, dims, unsigned, comm) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | integer(kind=I4P) | in | target | Values appended, any rank. |
dims | integer(kind=I8P) | in | Shape of the values appended, Fortran order. | |
unsigned | logical | in | optional | The values are the bits of the unsigned type of the same width. |
comm | integer(kind=I4P) | in | optional | MPI communicator: every rank appends its values, in rank order. |
Call graph
h5_dataset_append_I2P
Append I2P values to an appendable dataset; dims is the shape of the values appended, Fortran order.
Returns: integer(kind=I4P)
fortran
function h5_dataset_append_I2P(loc_id, name, x, dims, unsigned, comm) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | integer(kind=I2P) | in | target | Values appended, any rank. |
dims | integer(kind=I8P) | in | Shape of the values appended, Fortran order. | |
unsigned | logical | in | optional | The values are the bits of the unsigned type of the same width. |
comm | integer(kind=I4P) | in | optional | MPI communicator: every rank appends its values, in rank order. |
Call graph
h5_dataset_append_I1P
Append I1P values to an appendable dataset; dims is the shape of the values appended, Fortran order.
Returns: integer(kind=I4P)
fortran
function h5_dataset_append_I1P(loc_id, name, x, dims, unsigned, comm) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name. | |
x | integer(kind=I1P) | in | target | Values appended, any rank. |
dims | integer(kind=I8P) | in | Shape of the values appended, Fortran order. | |
unsigned | logical | in | optional | The values are the bits of the unsigned type of the same width. |
comm | integer(kind=I4P) | in | optional | MPI communicator: every rank appends its values, in rank order. |
Call graph
h5_dataset_read_R8P
Read all the values of a dataset as R8P, flattened in the order of its elements (the shape: h5_dataset_dims).
Returns: integer(kind=I4P)
fortran
function h5_dataset_read_R8P(loc_id, name, x) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name (or path). | |
x | real(kind=R8P) | out | allocatable | Values. |
Call graph
h5_dataset_read_R4P
Read all the values of a dataset as R4P, flattened in the order of its elements (the shape: h5_dataset_dims).
Returns: integer(kind=I4P)
fortran
function h5_dataset_read_R4P(loc_id, name, x) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name (or path). | |
x | real(kind=R4P) | out | allocatable | Values. |
Call graph
h5_dataset_read_I8P
Read all the values of a dataset as I8P, flattened in the order of its elements (the shape: h5_dataset_dims).
Returns: integer(kind=I4P)
fortran
function h5_dataset_read_I8P(loc_id, name, x) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name (or path). | |
x | integer(kind=I8P) | out | allocatable | Values. |
Call graph
h5_dataset_read_I4P
Read all the values of a dataset as I4P, flattened in the order of its elements (the shape: h5_dataset_dims).
Returns: integer(kind=I4P)
fortran
function h5_dataset_read_I4P(loc_id, name, x) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name (or path). | |
x | integer(kind=I4P) | out | allocatable | Values. |
Call graph
h5_dataset_read_I2P
Read all the values of a dataset as I2P, flattened in the order of its elements (the shape: h5_dataset_dims).
Returns: integer(kind=I4P)
fortran
function h5_dataset_read_I2P(loc_id, name, x) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name (or path). | |
x | integer(kind=I2P) | out | allocatable | Values. |
Call graph
h5_dataset_read_I1P
Read all the values of a dataset as I1P, flattened in the order of its elements (the shape: h5_dataset_dims).
Returns: integer(kind=I4P)
fortran
function h5_dataset_read_I1P(loc_id, name, x) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name (or path). | |
x | integer(kind=I1P) | out | allocatable | Values. |
Call graph
is_true
Return the value of an optional logical, false when absent.
Attributes: pure
Returns: logical
fortran
function is_true(flag) result(is)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
flag | logical | in | optional | Optional flag. |
c_dims
Return a shape in C order (HDF5) from the Fortran order.
Attributes: pure
Returns: integer(kind=c_long_long)
fortran
function c_dims(dims) result(reversed)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
dims | integer(kind=I8P) | in | Shape, Fortran order. |
dataset_size
Return the number of values of a dataset.
Returns: integer(kind=I4P)
fortran
function dataset_size(loc_id, name, n) result(error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
loc_id | integer(kind=hid_kind) | in | Parent (file or group). | |
name | character(len=*) | in | Dataset name (or path). | |
n | integer(kind=I8P) | out | Number of values. |
Call graph