64 serializerP = std::make_shared<SerializerJSON>();
65 std::dynamic_pointer_cast<SerializerJSON>(serializerP)->SetUseCodecOnUint8(
jsonUseCodecOnUInt8);
68 else if (
type ==
"H5")
70 serializerP = std::make_shared<SerializerH5>(mpi);
92 std::tuple<std::string, std::string>
ModifyFilePath(std::string fname,
const MPIInfo &mpi, std::string rank_part_fmt =
"%06d",
bool read =
false)
96 std::filesystem::path outPath;
97 outPath = {fname +
".dir"};
99 std::filesystem::create_directories(outPath);
101 std::sprintf(BUF, rank_part_fmt.c_str(), mpi.rank);
105 else if (
type ==
"H5")
109 std::filesystem::path outPath = fname;
111 std::filesystem::create_directories(outPath.parent_path() /
".");
112 return std::make_tuple(fname, fname);
117 return std::make_tuple(std::string(
""), std::string(
""));
pybind11-style configuration registration with macro-based field declaration and namespace-scoped tag...
#define DNDS_FIELD(name_, desc_,...)
Register a field inside a DNDS_DECLARE_CONFIG body.
#define DNDS_assert_info(expr, info)
Debug-only assertion with an extra std::string info message.
JSON-to-Eigen conversion utilities and nlohmann_json helper macros.
Base types and abstract interface for array serialization.
MPI-parallel HDF5 serializer implementing the SerializerBase interface.
Per-rank JSON serializer implementing the SerializerBase interface.
EnumValuesTag enum_values(std::vector< std::string > vals)
Create an enum allowed-values tag.
RangeTag range(double min)
Create a minimum-only range constraint.
ssp< SerializerBase > SerializerBaseSSP
std::string getStringForcePath(const std::filesystem::path::string_type &v)
Portable conversion of a platform-native path string to std::string.
Lightweight bundle of an MPI communicator and the calling rank's coordinates.
Config-backed factory selecting between JSON and HDF5 serializers.
int hdfDeflateLevel
HDF5 gzip deflate level (0 = off, 9 = max).
int hdfChunkSize
HDF5 chunk size (0 = library-chosen auto).
bool hdfCollOnMeta
Use collective HDF5 I/O for metadata (usually safe).
std::string type
Backend selector: "JSON" or "H5".
bool hdfCollOnData
Use collective HDF5 I/O for data arrays.
SerializerBaseSSP BuildSerializer(const MPIInfo &mpi)
Instantiate the selected serializer and apply its tunables.
SerializerFactory(const std::string &_type)
Construct with a specific backend name; other fields stay at defaults.
std::tuple< std::string, std::string > ModifyFilePath(std::string fname, const MPIInfo &mpi, std::string rank_part_fmt="%06d", bool read=false)
Expand a user-supplied base file name into the backend-specific path layout.
int jsonBinaryDeflateLevel
Compression level used by the JSON backend's binary codec.
SerializerFactory()=default
DNDS_DECLARE_CONFIG(SerializerFactory)
bool jsonUseCodecOnUInt8
Whether to apply the byte-codec to uint8 arrays in JSON (faster writes).