2 #include <fmt/ranges.h>
3 #include <spdlog/spdlog.h>
6 #include <nlohmann/json.hpp>
38 nlohmann_json_j[
"coordinates"] = *nlohmann_json_t.
coordinates;
40 nlohmann_json_j[
"dimensions"] = nlohmann_json_t.
dimensions;
42 const auto& b = nlohmann_json_t.
cycles;
43 std::array<bool, 3> bs{{b[0], b[1], b[2]}};
44 nlohmann_json_j[
"cycles"] = bs;
49 nlohmann_json_t.
dimensions = nlohmann_json_j[
"dimensions"].get<std::array<int64_t, 3>>();
51 const std::string tiling = nlohmann_json_j[
"tiling"];
60 throw std::runtime_error(fmt::format(
61 "Tiling type was not found, got [{}], expected one of {{[{}]}}",
67 auto& b = nlohmann_json_t.
cycles;
68 const auto& c = nlohmann_json_j[
"cycles"];
69 for (
int j = 0; j < 3; ++j) {
73 if (nlohmann_json_j.contains(
"coordinates")) {
74 if (
const auto& coords = nlohmann_json_j[
"coordinates"]; !coords.is_null()) {
75 if (nlohmann_json_j[
"coordinates"][
"spacing"][0] > 0)
static const std::array< std::string, 2 > tiling_names
std::optional< std::string > get_coordinate_name() const
friend void from_json(const nlohmann::json &nlohmann_json_j, Grid3Options &nlohmann_json_t)
std::array< int64_t, 3 > dimensions
friend void to_json(nlohmann::json &nlohmann_json_j, const Grid3Options &nlohmann_json_t)
std::optional< Coordinates > coordinates
NLOHMANN_DEFINE_TYPE_INTRUSIVE(Coordinates, name, spacing)
std::array< double, 3 > spacing