OGS
MeshLib::IO::HdfData Struct Referencefinal

Detailed Description

Definition at line 17 of file HdfData.h.

#include <HdfData.h>

Public Member Functions

 HdfData (void const *data_start, std::size_t size_partitioned_dim, std::size_t size_tuple, std::string const &name, MeshPropertyDataType mesh_property_data_type, unsigned int n_files, unsigned int chunk_size_bytes)

Public Attributes

void const * data_start
std::vector< Hdf5DimTypedata_space
std::vector< Hdf5DimTypeoffsets
std::vector< Hdf5DimTypefile_space
std::vector< Hdf5DimTypechunk_space
std::string name
int64_t data_type

Constructor & Destructor Documentation

◆ HdfData()

MeshLib::IO::HdfData::HdfData ( void const * data_start,
std::size_t size_partitioned_dim,
std::size_t size_tuple,
std::string const & name,
MeshPropertyDataType mesh_property_data_type,
unsigned int n_files,
unsigned int chunk_size_bytes )

Definition at line 39 of file HdfData.cpp.

45{
46 data_type = meshPropertyType2HdfType(mesh_property_data_type);
47
48 auto const& partition_info =
49 getPartitionInfo(size_partitioned_dim, n_files);
50 auto const& offset_partitioned_dim = partition_info.local_offset;
51 offsets = {offset_partitioned_dim, 0};
52
53 std::size_t const unified_length = partition_info.local_length;
54 int const type_size = H5Tget_size(data_type);
55 std::size_t const space =
56 (chunk_size_bytes > 0)
57 ? std::min(std::size_t(std::lround(float(chunk_size_bytes) /
58 (size_tuple * type_size) +
59 0.5)),
60 partition_info.global_length)
61 : partition_info.longest_local_length;
62
63 if (chunk_size_bytes > 0 && space == partition_info.global_length)
64 {
65 INFO("HDF5: Using a single chunk for dataset {:s} .", name);
66 }
67
68 chunk_space = (size_tuple > 1) ? std::vector<Hdf5DimType>{space, size_tuple}
69 : std::vector<Hdf5DimType>{space};
70
71 data_space = (size_tuple > 1)
72 ? std::vector<Hdf5DimType>{unified_length, size_tuple}
73 : std::vector<Hdf5DimType>{unified_length};
75 (size_tuple > 1)
76 ? std::vector<Hdf5DimType>{partition_info.global_length, size_tuple}
77 : std::vector<Hdf5DimType>{partition_info.global_length};
78
79 DBUG(
80 "HDF: dataset name: {:s}, offset: {:d}, data_space: {:d}, chunk_space "
81 "{:d}, file_space: {:d}, tuples: {:d}",
82 name, partition_info.local_offset, data_space[0], chunk_space[0],
83 file_space[0], size_tuple);
84}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:28
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
static hid_t meshPropertyType2HdfType(MeshPropertyDataType const ogs_data_type)
Definition HdfData.cpp:16
PartitionInfo getPartitionInfo(std::size_t const size, unsigned int const n_files)
std::vector< Hdf5DimType > file_space
Definition HdfData.h:26
std::vector< Hdf5DimType > offsets
Definition HdfData.h:25
std::vector< Hdf5DimType > chunk_space
Definition HdfData.h:27
std::string name
Definition HdfData.h:28
std::vector< Hdf5DimType > data_space
Definition HdfData.h:24
void const * data_start
Definition HdfData.h:23

References chunk_space, data_space, data_start, data_type, DBUG(), file_space, MeshLib::IO::getPartitionInfo(), INFO(), MeshLib::IO::meshPropertyType2HdfType(), name, and offsets.

Member Data Documentation

◆ chunk_space

std::vector<Hdf5DimType> MeshLib::IO::HdfData::chunk_space

Definition at line 27 of file HdfData.h.

Referenced by HdfData().

◆ data_space

std::vector<Hdf5DimType> MeshLib::IO::HdfData::data_space

Definition at line 24 of file HdfData.h.

Referenced by HdfData().

◆ data_start

void const* MeshLib::IO::HdfData::data_start

Definition at line 23 of file HdfData.h.

Referenced by HdfData().

◆ data_type

int64_t MeshLib::IO::HdfData::data_type

Definition at line 29 of file HdfData.h.

Referenced by HdfData().

◆ file_space

std::vector<Hdf5DimType> MeshLib::IO::HdfData::file_space

Definition at line 26 of file HdfData.h.

Referenced by HdfData().

◆ name

std::string MeshLib::IO::HdfData::name

Definition at line 28 of file HdfData.h.

Referenced by HdfData().

◆ offsets

std::vector<Hdf5DimType> MeshLib::IO::HdfData::offsets

Definition at line 25 of file HdfData.h.

Referenced by HdfData(), and MeshLib::IO::XdmfHdfWriter::XdmfHdfWriter().


The documentation for this struct was generated from the following files: