OGS
MeshLib::IO::HdfData Struct Referencefinal

Detailed Description

Definition at line 26 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 45 of file HdfData.cpp.

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

References chunk_space, data_space, 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 36 of file HdfData.h.

Referenced by HdfData().

◆ data_space

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

Definition at line 33 of file HdfData.h.

Referenced by HdfData().

◆ data_start

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

Definition at line 32 of file HdfData.h.

◆ data_type

int64_t MeshLib::IO::HdfData::data_type

Definition at line 38 of file HdfData.h.

Referenced by HdfData().

◆ file_space

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

Definition at line 35 of file HdfData.h.

Referenced by HdfData().

◆ name

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

Definition at line 37 of file HdfData.h.

Referenced by HdfData().

◆ offsets

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

Definition at line 34 of file HdfData.h.

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


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