3 #include <fmt/ranges.h>
4 #include <spdlog/spdlog.h>
8 #include <nlohmann/json.hpp>
34 nlohmann_json_j[
"coordinates"] = *nlohmann_json_t.
coordinates;
36 nlohmann_json_j[
"dimensions"] = nlohmann_json_t.
dimensions;
38 const auto& b = nlohmann_json_t.
cycles;
39 std::array<bool, 2> bs{{b[0], b[1]}};
40 nlohmann_json_j[
"cycles"] = bs;
45 nlohmann_json_t.
dimensions = nlohmann_json_j[
"dimensions"].get<std::array<int64_t, 2>>();
48 const std::string tiling = nlohmann_json_j[
"tiling"];
57 throw std::runtime_error(fmt::format(
58 "Tiling type was not found, got [{}], expected one of {{[{}]}}",
64 auto& b = nlohmann_json_t.
cycles;
65 const auto& c = nlohmann_json_j[
"cycles"];
66 for (
int j = 0; j < 2; ++j) {
70 if (
const auto& coords = nlohmann_json_j[
"coordinates"]; !coords.is_null()) {
71 if (nlohmann_json_j[
"coordinates"][
"spacing"][0] > 0)
std::optional< std::string > get_coordinate_name() const
friend void from_json(const nlohmann::json &nlohmann_json_j, Grid2Options &nlohmann_json_t)
friend void to_json(nlohmann::json &nlohmann_json_j, const Grid2Options &nlohmann_json_t)
std::optional< Coordinates > coordinates
std::array< int64_t, 2 > dimensions
static const std::array< std::string, 2 > tiling_names
NLOHMANN_DEFINE_TYPE_INTRUSIVE(Coordinates, name, spacing)
std::array< double, 2 > spacing