4#ifndef OPENIMPALA_RAW_READER_H
5#define OPENIMPALA_RAW_READER_H
16#include <AMReX_iMultiFab.H>
17#include <AMReX_IntVect.H>
174 amrex::Box
box()
const;
201 double getValue(
int i,
int j,
int k)
const;
226 void threshold(
double threshold_value,
int value_if_true,
int value_if_false,
227 amrex::iMultiFab& mf)
const;
244 void threshold(
double threshold_value, amrex::iMultiFab& mf)
const;
254 bool readRawFileInternal();
261 size_t getBytesPerVoxel()
const;
268 bool isHostLittleEndian()
const;
272 std::string m_filename;
284 std::vector<ByteType> m_raw_bytes;
286 bool m_is_read =
false;
amrex::Box box() const
Gets the index space (bounding box) corresponding to the dataset dimensions.
Definition RawReader.cpp:301
bool isRead() const
Checks if data has been successfully read and the reader is ready.
Definition RawReader.cpp:285
int width() const
Gets the width (X dimension) of the loaded dataset.
Definition RawReader.cpp:288
double getValue(int i, int j, int k) const
Retrieves the numerical value at a specific voxel, converting it to double.
Definition RawReader.cpp:314
bool readFile(const std::string &filename, int width, int height, int depth, RawDataType data_type)
Reads or re-reads data from the specified raw binary file.
Definition RawReader.cpp:100
void threshold(double threshold_value, int value_if_true, int value_if_false, amrex::iMultiFab &mf) const
Fills an AMReX iMultiFab based on thresholding the raw data.
Definition RawReader.cpp:436
RawReader()
Default constructor. Creates an empty reader instance.
Definition RawReader.cpp:79
virtual ~RawReader()=default
Virtual default destructor.
unsigned char ByteType
Type alias for the underlying byte storage.
Definition RawReader.H:76
RawReader(const RawReader &)=delete
int height() const
Gets the height (Y dimension) of the loaded dataset.
Definition RawReader.cpp:291
RawReader(RawReader &&)=default
int depth() const
Gets the depth (Z dimension) of the loaded dataset.
Definition RawReader.cpp:294
RawReader & operator=(RawReader &&)=default
RawReader & operator=(const RawReader &)=delete
RawDataType getDataType() const
Gets the data type and endianness specified when the file was read.
Definition RawReader.cpp:297
Definition CathodeWrite.cpp:12
RawDataType
Specifies the expected primitive data type and endianness of voxels within a raw binary data file.
Definition RawReader.H:33
@ INT32_BE
32-bit signed integer, Big Endian.
Definition RawReader.H:43
@ INT32_LE
32-bit signed integer, Little Endian.
Definition RawReader.H:42
@ UNKNOWN
Default, indicating an uninitialized or invalid type.
Definition RawReader.H:34
@ FLOAT64_LE
64-bit double-precision float (IEEE 754), Little Endian.
Definition RawReader.H:48
@ FLOAT32_BE
32-bit single-precision float (IEEE 754), Big Endian.
Definition RawReader.H:47
@ FLOAT64_BE
64-bit double-precision float (IEEE 754), Big Endian.
Definition RawReader.H:49
@ UINT16_BE
16-bit unsigned integer, Big Endian.
Definition RawReader.H:41
@ UINT32_BE
32-bit unsigned integer, Big Endian.
Definition RawReader.H:45
@ UINT32_LE
32-bit unsigned integer, Little Endian.
Definition RawReader.H:44
@ INT16_BE
16-bit signed integer, Big Endian (most significant byte first).
Definition RawReader.H:39
@ INT16_LE
Definition RawReader.H:37
@ UINT8
8-bit unsigned integer (char, byte). Endianness irrelevant.
Definition RawReader.H:35
@ INT8
8-bit signed integer (signed char). Endianness irrelevant.
Definition RawReader.H:36
@ FLOAT32_LE
32-bit single-precision float (IEEE 754), Little Endian.
Definition RawReader.H:46
@ UINT16_LE
16-bit unsigned integer, Little Endian.
Definition RawReader.H:40