Skip to contents

Small class to wrap h5 data into the r2ogs6 workflow.

Details

OGS6_h5

NOTE: This is a beta-version and is only guaranteed to work with the current three existing [benchmarks](https://doxygen.opengeosys.org/d9/d28/ogs_file_param__prj__time_loop__output__hdf.html) that contain *.h5 files. More complicated files can always be handled with the method $get_h5 and may refer to the package rhdf5.

Active bindings

h5_path

Getter/setter for private parameter `.h5_path`

Methods


Method new()

This function will be called automatically after a simulation is run to give an overview of the h5 output data.

Usage

OGS6_h5$new(h5_path)

Arguments

h5_path

path to *.h5 file.

Examples

h5_path <- system.file("/extdata/benchmarks/EllipticPETSc",
                       "cube_1e3_np3.h5",
                        package = "r2ogs6")
ogs6_h5 <- OGS6_h5$new(h5_path)


Method print()

Overrides the default print method

Usage

OGS6_h5$print()

Examples

h5_path <- system.file("/extdata/benchmarks/EllipticPETSc",
                       "cube_1e3_np3.h5",
                        package = "r2ogs6")
ogs6_h5 <- OGS6_h5$new(h5_path)
ogs6_h5
\dontrun{ogs6_obj$h5s}


Method get_h5()

return a h5 object for further processing with the rhdf5 package.

Usage

OGS6_h5$get_h5(name = "/", ...)

Arguments

name

Optional: *character* that indicates the element of the h5 file to access. Default *"/"* will return the entire file as a list.

...

Optional: Further arguments to be passed to the function h5read.

Returns

A list of data elements or the element accessed with name

Examples

\dontrun{h5_list <- ogs6_obj$h5s[[1]]$get_h5("/times")}


Method get_df()

Method to retrieve HDF5 output as a tibble assuming a standardized structure of OGS6 HDF5 output. times and geometry are added by default.

Usage

OGS6_h5$get_df(group, names = "geometry")

Arguments

group

*character*

names

*character* names for a hdf5 element such as displayed when printing the OGS5_h5 object, without the leading "/".

Examples

h5_path <- system.file("/extdata/benchmarks/EllipticPETSc",
                       "cube_1e3_np3.h5",
                       package = "r2ogs6")
ogs6_h5 <- OGS6_h5$new(h5_path)
df <- ogs6_h5$get_df("/t_0", "pressure")
\dontrun{df <- ogs6_obj$h5s[[1]]$get_df("/t_0", "pressure")}


Method clone()

The objects of this class are cloneable with this method.

Usage

OGS6_h5$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `OGS6_h5$new`
## ------------------------------------------------

h5_path <- system.file("/extdata/benchmarks/EllipticPETSc",
                       "cube_1e3_np3.h5",
                        package = "r2ogs6")
ogs6_h5 <- OGS6_h5$new(h5_path)

## ------------------------------------------------
## Method `OGS6_h5$print`
## ------------------------------------------------

h5_path <- system.file("/extdata/benchmarks/EllipticPETSc",
                       "cube_1e3_np3.h5",
                        package = "r2ogs6")
ogs6_h5 <- OGS6_h5$new(h5_path)
ogs6_h5
#> OGS6_h5
#> h5 path:
#> /tmp/RtmpMur7Or/temp_libpath1493b34419209/r2ogs6//extdata/benchmarks/EllipticPETSc/cube_1e3_np3.h5 
#> 
#> # h5 file structure ------------------------------------------------------------ 
#>    group                   name       otype  dclass      dim
#> 0      /                    t_0   H5I_GROUP                 
#> 1   /t_0 D1_left_front_N1_right H5I_DATASET   FLOAT     1895
#> 2   /t_0     Linear_1_to_minus1 H5I_DATASET   FLOAT     1895
#> 3   /t_0            MaterialIDs H5I_DATASET INTEGER     1233
#> 4   /t_0               geometry H5I_DATASET   FLOAT 3 x 1895
#> 5   /t_0               pressure H5I_DATASET   FLOAT     1895
#> 6   /t_0               topology H5I_DATASET INTEGER    11097
#> 7   /t_0                      v H5I_DATASET   FLOAT 3 x 1895
#> 8      /                    t_1   H5I_GROUP                 
#> 9   /t_1               pressure H5I_DATASET   FLOAT     1895
#> 10  /t_1                      v H5I_DATASET   FLOAT 3 x 1895
if (FALSE) ogs6_obj$h5s

## ------------------------------------------------
## Method `OGS6_h5$get_h5`
## ------------------------------------------------

if (FALSE) h5_list <- ogs6_obj$h5s[[1]]$get_h5("/times")

## ------------------------------------------------
## Method `OGS6_h5$get_df`
## ------------------------------------------------

h5_path <- system.file("/extdata/benchmarks/EllipticPETSc",
                       "cube_1e3_np3.h5",
                       package = "r2ogs6")
ogs6_h5 <- OGS6_h5$new(h5_path)
df <- ogs6_h5$get_df("/t_0", "pressure")
if (FALSE) df <- ogs6_obj$h5s[[1]]$get_df("/t_0", "pressure")