leapIO_h5hut Module

Module that defines objects and methods to write/read files in the H5HUT format. It uses LEAP's HDF5 IO tool, and is provided for backward compatibility with earlier versions of LEAP that used H5HUT exclusively.

This is essentially a revamped and updated clone of the original H5HUT library, which seems to be abandoned by its creators.



Uses

  • module~~leapio_h5hut~~UsesGraph module~leapio_h5hut leapIO_h5hut module~leapio_hdf5 leapIO_hdf5 module~leapio_h5hut->module~leapio_hdf5 module~leapkinds leapKinds module~leapio_h5hut->module~leapkinds module~leapparallel leapParallel module~leapio_h5hut->module~leapparallel module~leapio_hdf5->module~leapkinds module~leapio_hdf5->module~leapparallel hdf5 hdf5 module~leapio_hdf5->hdf5 module~leaputils leapUtils module~leapio_hdf5->module~leaputils iso_fortran_env iso_fortran_env module~leapkinds->iso_fortran_env module~leapparallel->module~leapkinds module~leapparallel->iso_fortran_env mpi_f08 mpi_f08 module~leapparallel->mpi_f08 module~leaputils->module~leapkinds

Used by

  • module~~leapio_h5hut~~UsedByGraph module~leapio_h5hut leapIO_h5hut module~leapio leapIO module~leapio->module~leapio_h5hut module~cdifs cdifs module~cdifs->module~leapio module~leapbc leapBC module~cdifs->module~leapbc module~leapeulerian leapEulerian module~cdifs->module~leapeulerian module~leapsolver leapSolver module~cdifs->module~leapsolver module~particles_resolved particles_resolved module~cdifs->module~particles_resolved module~collisions collisions module~cdifs->module~collisions module~immersed_boundaries immersed_boundaries module~cdifs->module~immersed_boundaries module~leapdiffop leapDiffOp module~cdifs->module~leapdiffop module~leaphypre leapHypre module~cdifs->module~leaphypre module~grans grans module~grans->module~leapio module~grans->module~leapbc module~grans->module~leapeulerian module~grans->module~leapsolver module~particles_point particles_point module~grans->module~particles_point module~grans->module~particles_resolved module~grans->module~collisions module~grans->module~immersed_boundaries module~grans->module~leapdiffop module~grans->module~leaphypre module~immersed_boundaries_markers immersed_boundaries_markers module~immersed_boundaries_markers->module~leapio module~immersed_boundaries_markers->module~leapbc module~immersed_boundaries_markers->module~leapeulerian module~leaplagrangian leapLagrangian module~immersed_boundaries_markers->module~leaplagrangian module~immersed_boundaries_markers->module~leapdiffop module~immersed_boundaries_markers->module~leaphypre module~immersed_boundaries_solids immersed_boundaries_solids module~immersed_boundaries_solids->module~leapio module~immersed_boundaries_solids->module~immersed_boundaries_markers module~immersed_boundaries_solids->module~leapeulerian module~immersed_boundaries_solids->module~leaplagrangian module~leapbc->module~leapio module~leapbc->module~leapeulerian module~leapeulerian->module~leapio module~leaplagrangian->module~leapio module~leapsolver->module~leapio module~particles_point->module~leapio module~particles_point->module~leapeulerian module~particles_point->module~leaplagrangian module~particles_point->module~immersed_boundaries module~particles_point->module~leapdiffop module~particles_resolved->module~leapio module~particles_resolved->module~leapbc module~particles_resolved->module~leapeulerian module~particles_resolved->module~leaplagrangian module~particles_resolved->module~immersed_boundaries module~particles_resolved->module~leapdiffop program~main main program~main->module~leapio program~main->module~cdifs program~main->module~grans program~main->module~leapsolver module~cdifs_advancesolution_smod cdifs_AdvanceSolution_smod module~cdifs_advancesolution_smod->module~cdifs module~cdifs_monitor_smod cdifs_Monitor_smod module~cdifs_monitor_smod->module~cdifs module~cdifs_preparesolver_smod cdifs_PrepareSolver_smod module~cdifs_preparesolver_smod->module~cdifs module~cdifs_writeoutputdata_smod cdifs_WriteOutputData_smod module~cdifs_writeoutputdata_smod->module~cdifs module~cdifs_writerestartdata_smod cdifs_WriteRestartData_smod module~cdifs_writerestartdata_smod->module~cdifs module~collisions->module~particles_point module~collisions->module~particles_resolved module~collisions->module~immersed_boundaries module~grans_advancesolution_smod grans_AdvanceSolution_smod module~grans_advancesolution_smod->module~grans module~grans_module_smod grans_module_smod module~grans_module_smod->module~grans module~grans_preparesolver_smod grans_PrepareSolver_smod module~grans_preparesolver_smod->module~grans module~grans_writeoutputdata_smod grans_WriteOutputData_smod module~grans_writeoutputdata_smod->module~grans module~grans_writerestartdata_smod grans_WriteRestartData_smod module~grans_writerestartdata_smod->module~grans module~immersed_boundaries->module~immersed_boundaries_markers module~immersed_boundaries->module~immersed_boundaries_solids module~leapdiffop->module~leapbc module~leapdiffop->module~leapeulerian module~leaphypre->module~leapeulerian proc~bc_set_buildmask bc_set%bc_set_BuildMask proc~bc_set_buildmask->module~leapeulerian proc~cdifs_obj_preparesolverbodyforce cdifs_obj_PrepareSolverBodyforce proc~cdifs_obj_preparesolverbodyforce->module~leapbc proc~cdifs_obj_preparesolveroperators cdifs_obj_PrepareSolverOperators proc~cdifs_obj_preparesolveroperators->module~leapbc proc~cdifs_obj_preparesolveroperatorsdiv cdifs_obj_PrepareSolverOperatorsDIV proc~cdifs_obj_preparesolveroperatorsdiv->module~leapbc proc~cdifs_obj_preparesolveroperatorspgrad cdifs_obj_PrepareSolverOperatorsPGRAD proc~cdifs_obj_preparesolveroperatorspgrad->module~leapbc proc~cdifs_obj_preparesolveroperatorsvlap cdifs_obj_PrepareSolverOperatorsVLAP proc~cdifs_obj_preparesolveroperatorsvlap->module~leapbc proc~grans_obj_preparesolveroperators grans_obj_PrepareSolverOperators proc~grans_obj_preparesolveroperators->module~leapdiffop proc~marker_set_computesolidvolfrac marker_set%marker_set_ComputeSolidVolFrac proc~marker_set_computesolidvolfrac->module~leapdiffop

Derived Types

type, public ::  h5hut_obj

A utility to read/write files in HDF5 using H5hut

Components

Type Visibility Attributes Name Initial
logical, private :: block_group_exists = .false.

Flag to determine if block group has already been created

character(len=str64), private :: filename

file to read/write

type(hdf5_obj), private :: hdf5

HDF5 object

integer, private :: nsteps

Number of steps in file

type(parallel_obj), private, pointer :: parallel => null()

Associated parallel structure

character(len=str64), private :: step_name

Group name for step being worked on

Type-Bound Procedures

procedure, public :: Finalize => h5hut_obj_Final
procedure, public :: GetNFields => h5hut_obj_GetNFields
procedure, public :: GetNPoints => h5hut_obj_GetNPoints
procedure, public :: GetNSteps => h5hut_obj_GetNSteps
procedure, public :: Initialize => h5hut_obj_Init
procedure, public :: JumpToStep => h5hut_obj_JumpToStep
procedure, public :: LastTimeStep => h5hut_obj_LastTimeStep
procedure, public :: NewTimeStep => h5hut_obj_NewTimeStep
generic, public :: Read => h5hut_obj_Read1D, h5hut_obj_Read3D
generic, public :: ReadAttributes => h5hut_obj_ReadAttributes0D, h5hut_obj_ReadAttributes1D
procedure, public :: SetStep => h5hut_obj_SetStep
procedure, public :: StepCount => h5hut_obj_StepCount
generic, public :: Write => h5hut_obj_Write1D, h5hut_obj_Write3D
generic, public :: WriteAttributes => h5hut_obj_WriteAttributes0D, h5hut_obj_WriteAttributes1D
procedure, public :: WriteGrid => h5hut_obj_WriteGrid
procedure, private :: h5hut_obj_Read1D
procedure, private :: h5hut_obj_Read3D
procedure, private :: h5hut_obj_ReadAttributes0D
procedure, private :: h5hut_obj_ReadAttributes1D
procedure, private :: h5hut_obj_Write1D
procedure, private :: h5hut_obj_Write3D
procedure, private :: h5hut_obj_WriteAttributes0D
procedure, private :: h5hut_obj_WriteAttributes1D

Functions

private impure function h5hut_obj_GetNSteps(this) result(val)

Counts and returns number of steps in file.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

Return Value integer

Number of steps in file

private impure function h5hut_obj_StepCount(this) result(val)

Returns number of steps.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

Return Value integer

Number of steps


Subroutines

private impure subroutine h5hut_obj_Final(this)

Finalizes object and frees memeory.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

private impure subroutine h5hut_obj_GetNFields(this, nfields)

Gets number of fields in step.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

integer, intent(out) :: nfields

Number of fields

private impure subroutine h5hut_obj_GetNPoints(this, npoints)

Gets number of data points in step. H5HUT assumes that all datasets have the same number of points, thus we return the number of points of the first dataset we find.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

integer, intent(out) :: npoints

Number of data points

private impure subroutine h5hut_obj_Init(this, filename, access_flag, parallel)

Initializes structure.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

character(len=*), intent(in) :: filename

File to read/write

character(len=*), intent(in) :: access_flag

File access mode

type(parallel_obj), intent(in), target :: parallel

Parallel structure to link with

private impure subroutine h5hut_obj_JumpToStep(this, step, iter, time, label_iter, label_time)

Jumps to a specific step.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

integer, intent(in) :: step

Step in H5HUT file

integer, intent(out) :: iter

Iteration at this step

real(kind=wp), intent(out) :: time

Time at this step

character(len=*), intent(in), optional :: label_iter

Optional iteration label

character(len=*), intent(in), optional :: label_time

Optional time label

private impure subroutine h5hut_obj_LastTimeStep(this, iter, time, label_iter, label_time)

Gets information about the last step.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

integer, intent(out) :: iter

Iteration at last step

real(kind=WP), intent(out) :: time

Time at last step

character(len=*), intent(in), optional :: label_iter

Optional iteration label

character(len=*), intent(in), optional :: label_time

Optional time label

private impure subroutine h5hut_obj_NewTimeStep(this, iter, time, label_iter, label_time)

Creates a new step and updates attributes.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

integer, intent(in) :: iter

iteration counter

real(kind=WP), intent(in) :: time

Time value

character(len=*), intent(in), optional :: label_iter

Optional iteration label

character(len=*), intent(in), optional :: label_time

Optional time label

private impure subroutine h5hut_obj_Read1D(this, name, array, offset)

Reads Lagrangian/1D data fom a h5hut file. If no offset is provided, uses default h5hut file view. Otherwise, sets file view manually.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

character(len=*), intent(in) :: name

Variable name

class(*), intent(out) :: array(:)

1-D data array

integer, intent(in), optional :: offset

Indicates number of elements to skip before reading

private impure subroutine h5hut_obj_Read3D(this, name, array, lo, hi)

Reads Eulerian/3D data from a h5hut file.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

character(len=*), intent(in) :: name

Variable name

class(*), intent(out) :: array(:,:,:)

3-D data array

integer, intent(in) :: lo(3)

Low bounds

integer, intent(in) :: hi(3)

High bounds

private impure subroutine h5hut_obj_ReadAttributes0D(this, label, val)

Reads scalar attributes.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

character(len=*), intent(in) :: label

Attribute label

class(*), intent(out) :: val

Value associated with attribute

private impure subroutine h5hut_obj_ReadAttributes1D(this, label, val)

Reads an array of attributes.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

character(len=*), intent(in) :: label

Attribute label

class(*), intent(out) :: val(:)

Value associated with attribute

private impure subroutine h5hut_obj_SetStep(this, step)

Sets the current step in file, and possibly create a new one, if this step does not exist yet.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

integer, intent(in) :: step

Step to select

private impure subroutine h5hut_obj_Write1D(this, name, array)

Writes Lagrangian/1D data to a h5hut file.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

character(len=*), intent(in) :: name

Variable name

class(*), intent(in) :: array(:)

1-D data array

private impure subroutine h5hut_obj_Write3D(this, name, array, lo, hi)

Writes Eulerian/3D data to a h5hut file.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

character(len=*), intent(in) :: name

Variable name

class(*), intent(in) :: array(:,:,:)

3-D data array

integer, intent(in) :: lo(3)

Low bounds

integer, intent(in) :: hi(3)

High bounds

private impure subroutine h5hut_obj_WriteAttributes0D(this, label, val)

Writes scalar attributes.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

character(len=*), intent(in) :: label

Attribute label

class(*), intent(in) :: val

Value associated with attribute

private impure subroutine h5hut_obj_WriteAttributes1D(this, label, val)

Writes an array of attributes.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

character(len=*), intent(in) :: label

attribute label

class(*), intent(in) :: val(:)

Value associated with attribute

private impure subroutine h5hut_obj_WriteGrid(this, name, xlo, dx)

Writes grid attributes.

Arguments

Type IntentOptional Attributes Name
class(h5hut_obj), intent(inout) :: this

A H5hut object

character(len=*), intent(in) :: name

Variable name

real(kind=wp), intent(in) :: xlo(3)

Coordinate of the low bound

real(kind=wp), intent(in) :: dx(3)

Grid spacing