22 #include <nlohmann/json.hpp>
32 namespace VolumeBoundsJsonConverter {
49 template <
typename bounds_t>
50 std::unique_ptr<bounds_t>
fromJson(
const nlohmann::json& jVolumeBounds) {
51 constexpr
size_t kValues = bounds_t::BoundValues::eSize;
52 std::array<ActsScalar, kValues> bValues{};
53 std::vector<ActsScalar> bVector = jVolumeBounds[
"values"];
54 std::copy_n(bVector.begin(), kValues, bValues.begin());
55 return std::make_unique<bounds_t>(bValues);
62 std::unique_ptr<VolumeBounds>
fromJson(
const nlohmann::json& jVolumeBounds);
67 NLOHMANN_JSON_SERIALIZE_ENUM(
69 {{VolumeBounds::BoundsType::eCone,
"Cone"},
70 {VolumeBounds::BoundsType::eCuboid,
"Cuboid"},
71 {VolumeBounds::BoundsType::eCutoutCylinder,
"CutoutCylinder"},
72 {VolumeBounds::BoundsType::eCylinder,
"Cylinder"},
73 {VolumeBounds::BoundsType::eGenericCuboid,
"GenericCuboid"},
74 {VolumeBounds::BoundsType::eTrapezoid,
"Trapezoid"}})