27 std::fstream fileStream;
30 std::vector<std::string> cPathSplit;
34 bool useCodecOnUint8{
false};
43 void OpenFile(
const std::string &fName,
bool read)
override;
46 void CreatePath(
const std::string &p)
override;
47 void GoToPath(
const std::string &p)
override;
55 void WriteInt(
const std::string &name,
int v)
override;
58 void WriteString(
const std::string &name,
const std::string &
v)
override;
73 void ReadInt(
const std::string &name,
int &
v)
override;
76 void ReadString(
const std::string &name, std::string &
v)
override;
JSON-to-Eigen conversion utilities and nlohmann_json helper macros.
Base types and abstract interface for array serialization.
Describes one rank's window into a globally-distributed dataset.
Abstract interface for reading/writing scalars, vectors, and byte arrays.
Per-rank JSON file serializer; each MPI rank writes its own .json file.
void CloseFileNonVirtual()
void ReadIndexVector(const std::string &name, std::vector< index > &v, ArrayGlobalOffset &offset) override
void ReadSharedIndexVector(const std::string &name, ssp< host_device_vector< index > > &v, ArrayGlobalOffset &offset) override
void ReadString(const std::string &name, std::string &v) override
Read a UTF-8 string into v.
void ReadRealVector(const std::string &name, std::vector< real > &v, ArrayGlobalOffset &offset) override
std::set< std::string > ListCurrentPath() override
Names of direct children of the current path.
std::string GetCurrentPath() override
String form of the current path.
void CloseFile() override
Close the backing file, flushing buffers.
void WriteSharedRowsizeVector(const std::string &name, const ssp< host_device_vector< rowsize > > &v, ArrayGlobalOffset offset) override
Write a shared rowsize vector; deduplicated across multiple writes.
~SerializerJSON() override
void WriteString(const std::string &name, const std::string &v) override
Write a UTF-8 string under name.
void WriteIndexVectorPerRank(const std::string &name, const std::vector< index > &v) override
Write a per-rank index vector (replicated name, independent values).
void OpenFile(const std::string &fName, bool read) override
Open a backing file (H5 file or JSON file depending on subclass).
void WriteSharedIndexVector(const std::string &name, const ssp< host_device_vector< index > > &v, ArrayGlobalOffset offset) override
Write a shared index vector; deduplicated across multiple writes that share the same shared_ptr.
void ReadInt(const std::string &name, int &v) override
Read a scalar int into v.
void ReadUint8Array(const std::string &name, uint8_t *data, index &size, ArrayGlobalOffset &offset) override
Two-pass byte array read.
void CreatePath(const std::string &p) override
Create a sub-path (H5 group / JSON object) at the current location.
void WriteRowsizeVector(const std::string &name, const std::vector< rowsize > &v, ArrayGlobalOffset offset) override
Write a rowsize vector (collective for H5).
void SetDeflateLevel(int v)
void WriteInt(const std::string &name, int v) override
Write a scalar int under name at the current path.
void WriteIndexVector(const std::string &name, const std::vector< index > &v, ArrayGlobalOffset offset) override
Write an index vector (collective for H5). offset carries the distribution mode (ArrayGlobalOffset_Pa...
void WriteUint8Array(const std::string &name, const uint8_t *data, index size, ArrayGlobalOffset offset) override
Write a raw byte buffer under name. offset.isDist() = true means the caller provides the exact per-ra...
int GetMPIRank() override
Rank index cached by the serializer (relevant for collective I/O).
void ReadSharedRowsizeVector(const std::string &name, ssp< host_device_vector< rowsize > > &v, ArrayGlobalOffset &offset) override
bool IsPerRank() override
Whether this serializer is per-rank (JSON-file-per-rank) or collective (shared H5 file)....
void ReadIndex(const std::string &name, index &v) override
Read a scalar index into v.
void WriteRealVector(const std::string &name, const std::vector< real > &v, ArrayGlobalOffset offset) override
Write a real vector (collective for H5).
void WriteReal(const std::string &name, real v) override
Write a scalar real under name.
void ReadRowsizeVector(const std::string &name, std::vector< rowsize > &v, ArrayGlobalOffset &offset) override
void WriteIndex(const std::string &name, index v) override
Write a scalar index under name.
void SetUseCodecOnUint8(bool v)
const MPIInfo & getMPI() override
MPI context the serializer was opened with.
int GetMPISize() override
Rank count cached by the serializer.
void GoToPath(const std::string &p) override
Navigate to an existing path. Supports / -separated segments.
void ReadReal(const std::string &name, real &v) override
Read a scalar real into v.
Host + optional device vector of trivially copyable T.
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
std::shared_ptr< T > ssp
Shortened alias for std::shared_ptr used pervasively in DNDSR.
double real
Canonical floating-point scalar used throughout DNDSR (double precision).
Lightweight bundle of an MPI communicator and the calling rank's coordinates.
Eigen::Matrix< real, 5, 1 > v