12#include <AMReX_REAL.H>
14#include <AMReX_iMultiFab.H>
56 explicit HDF5Reader(
const std::string& filename,
const std::string& hdf5dataset);
82 bool readFile(
const std::string& filename,
const std::string& hdf5dataset);
98 void threshold(
double raw_threshold, amrex::iMultiFab& mf)
const;
117 void threshold(
double raw_threshold,
int value_if_true,
int value_if_false,
118 amrex::iMultiFab& mf)
const;
126 amrex::Box
box()
const;
142 std::string
getAttribute(
const std::string& attr_name)
const;
159 return m_native_type;
166 template <
typename T_Native>
168 int value_if_false,
const amrex::Box&
box,
169 amrex::IArrayBox& fab)
const;
178 bool readMetadataInternal();
181 std::string m_filename;
182 std::string m_hdf5dataset;
186 bool m_is_read =
false;
187 H5::DataType m_native_type;
HDF5Reader(const HDF5Reader &)=delete
void readAndThresholdFab(H5::DataSet &dataset, double raw_threshold, int value_if_true, int value_if_false, const amrex::Box &box, amrex::IArrayBox &fab) const
Definition HDF5Reader.cpp:266
void threshold(double raw_threshold, amrex::iMultiFab &mf) const
Reads data chunk-by-chunk into an iMultiFab based on thresholding.
Definition HDF5Reader.cpp:444
std::map< std::string, std::string > getAllAttributes() const
Reads all attributes from the HDF5 dataset. Attempts to read attribute values as strings.
Definition HDF5Reader.cpp:230
H5::DataType getNativeDataType() const
Get the native HDF5 data type detected in the dataset.
Definition HDF5Reader.H:158
virtual ~HDF5Reader()=default
Virtual default destructor.
std::string getAttribute(const std::string &attr_name) const
Reads a specific string attribute from the HDF5 dataset.
Definition HDF5Reader.cpp:213
HDF5Reader & operator=(const HDF5Reader &)=delete
bool isRead() const
Check if metadata has been successfully read.
Definition HDF5Reader.H:153
int width() const
Get width (X-dimension) of the dataset in pixels/voxels.
Definition HDF5Reader.cpp:193
HDF5Reader()
Default constructor. Creates an empty reader. Use readFile() later.
Definition HDF5Reader.cpp:82
int depth() const
Get depth (Z-dimension) of the dataset in pixels/voxels.
Definition HDF5Reader.cpp:199
int height() const
Get height (Y-dimension) of the dataset in pixels/voxels.
Definition HDF5Reader.cpp:196
HDF5Reader(HDF5Reader &&)=default
HDF5Reader & operator=(HDF5Reader &&)=default
amrex::Box box() const
Returns the index space Box covering the entire image domain [0, w-1] x [0, h-1] x [0,...
Definition HDF5Reader.cpp:202
bool readFile(const std::string &filename, const std::string &hdf5dataset)
Reads metadata (dimensions, datatype) from the specified HDF5 file and dataset.
Definition HDF5Reader.cpp:101
Definition CathodeWrite.cpp:12