This module defines objects and methods to read/write data in the HDF5 format into LEAP.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=*), | public, | parameter | :: | HDF5_EXTENSION | = | '.h5' |
Default file extension |
| integer, | private, | parameter | :: | HDF5_SET_HTBL_SIZE | = | 20 |
Default hash table size |
A utility to read/write files in HDF5 format
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=:), | public, | allocatable | :: | filename |
file to read/write |
||
| type(parallel_obj), | public, | pointer | :: | parallel | => | null() |
Associated parallel structure |
| integer(kind=HID_T), | private | :: | fid |
File identifier |
|||
| logical, | private | :: | is_open | = | .false. |
Switch for when file is open/closed |
|
| integer(kind=HID_T), | private | :: | plistid |
Property list identifier |
|||
| type(hashtbl_obj), | private | :: | tbl |
Hash table |
Function that will append and prepend '/' if missing.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | groupname |
Returns the HDF5 object id of the group.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(in) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Name of region |
Returns the number of points in a dataset given by name under group given by name.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Parent group name |
||
| character(len=*), | intent(in) | :: | name |
Dataset name |
Result
Closes hdf5 file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
Closes an HDF5 group and removes it from the hashtable.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Group to close |
Creates a group (analogous to directory) in an HDF5 file and updates hash table.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Group name |
Finalizes object and frees memory.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
Initializes the hdf5 object.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| type(parallel_obj), | intent(in), | target | :: | parallel |
Parallel structure to point to |
Opens a hdf5 file given by name with mode stated by flag. This can take one of these values: 'R' for read only 'W' for write only (will delete existing file) 'RW' for read-write
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | name |
Filename |
||
| character(len=*), | intent(in) | :: | flag |
Access mode |
Opens a group (analogous to directory) in an HDF5 file and updates hash table.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Group name |
Reads a 1D dataset located under groupname and given by name. If no offset is provided, uses default file view. Otherwise, sets file view manually.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Parent group containing the dataset |
||
| character(len=*), | intent(in) | :: | name |
Dataset name |
||
| class(*), | intent(out), | target | :: | array(:) |
Data array |
|
| integer, | intent(in), | optional | :: | offset |
Indicates number of elements to skip before reading |
Reads a 3D dataset located under groupname and given by name.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Parent group containing the dataset |
||
| character(len=*), | intent(in) | :: | name |
Dataset name |
||
| class(*), | intent(out), | target | :: | array(:,:,:) |
Data array |
|
| integer, | intent(in) | :: | lo(3) |
Low bounds |
||
| integer, | intent(in) | :: | hi(3) |
High bounds |
Read a scalar attribute under a given group.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Groupname |
||
| character(len=*), | intent(in) | :: | label |
Attribute label |
||
| class(*), | intent(out), | target | :: | val |
Attribute value |
Read a 1-D array of attributes under a given group.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Groupname |
||
| character(len=*), | intent(in) | :: | label |
Attribute label |
||
| class(*), | intent(out), | target | :: | val(:) |
Attribute values |
Reads coordinates from HDF5 file. Only the root MPI rank does the reading, and then broadcasts to other MPI ranks.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Groupname |
||
| character(len=*), | intent(in) | :: | name |
Variable name |
||
| class(*), | intent(out), | target | :: | Coord(:) |
1-D Coordinates |
Reads the dataset names under a given base group in an HDF5 file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | basegroup |
Base group to explore |
||
| character(len=str64), | intent(out), | allocatable | :: | names(:) |
Dataset names under the base group |
Reads the groups (i.e., directories) under a given base group in an HDF5 file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | basegroup |
Base group to explore |
||
| character(len=str64), | intent(out), | allocatable | :: | names(:) |
Names of groups under the base group |
Writes an array/1D data to a HDF5 file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Groupname |
||
| character(len=*), | intent(in) | :: | name |
Variable name |
||
| class(*), | intent(in), | target | :: | array(:) |
1-D data array |
Writes Eulerian/3D data to a HDF5 file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Groupname |
||
| character(len=*), | intent(in) | :: | name |
Variable name |
||
| class(*), | intent(in), | target | :: | array(:,:,:) |
3-D data array |
|
| integer, | intent(in) | :: | lo(3) |
Low bounds |
||
| integer, | intent(in) | :: | hi(3) |
High bounds |
Writes a scalar attribute.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Groupname |
||
| character(len=*), | intent(in) | :: | label |
attribute label |
||
| class(*), | intent(in), | target | :: | val |
Attribute label |
Writes an array of attributes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Groupname |
||
| character(len=*), | intent(in) | :: | label |
attribute label |
||
| class(*), | intent(in), | target | :: | val(:) |
Attribute labels |
Writes coordinates to HDF5 file. Only the root MPI rank does the writing.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hdf5_obj), | intent(inout) | :: | this |
A HDF5 object |
||
| character(len=*), | intent(in) | :: | groupname |
Groupname |
||
| character(len=*), | intent(in) | :: | name |
Variable name |
||
| class(*), | intent(in), | target | :: | Coord(:) |
1-D Coordinates |