File indexing completed on 2025-12-11 09:40:23
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/GenericCuboidVolumeBounds.hpp"
0013 #include "Acts/Geometry/VolumeBounds.hpp"
0014 #include "ActsPlugins/Json/ActsJson.hpp"
0015
0016 #include <array>
0017 #include <cstddef>
0018 #include <memory>
0019 #include <string>
0020 #include <vector>
0021
0022 #include <nlohmann/json.hpp>
0023
0024
0025
0026 namespace Acts {
0027
0028
0029
0030
0031 void to_json(nlohmann::json& j, const VolumeBounds& bounds);
0032
0033 namespace VolumeBoundsJsonConverter {
0034
0035
0036
0037
0038
0039
0040 nlohmann::json toJson(const VolumeBounds& bounds);
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050 template <typename bounds_t>
0051 std::unique_ptr<bounds_t> fromJson(const nlohmann::json& jVolumeBounds) {
0052 constexpr std::size_t kValues = bounds_t::BoundValues::eSize;
0053 std::array<double, kValues> bValues{};
0054 std::vector<double> bVector = jVolumeBounds["values"];
0055 std::copy_n(bVector.begin(), kValues, bValues.begin());
0056 return std::make_unique<bounds_t>(bValues);
0057 }
0058
0059
0060
0061
0062
0063 std::unique_ptr<VolumeBounds> fromJson(const nlohmann::json& jVolumeBounds);
0064
0065 }
0066
0067
0068 NLOHMANN_JSON_SERIALIZE_ENUM(
0069 VolumeBounds::BoundsType,
0070 {{VolumeBounds::BoundsType::eCone, "Cone"},
0071 {VolumeBounds::BoundsType::eCuboid, "Cuboid"},
0072 {VolumeBounds::BoundsType::eCutoutCylinder, "CutoutCylinder"},
0073 {VolumeBounds::BoundsType::eCylinder, "Cylinder"},
0074 {VolumeBounds::BoundsType::eGenericCuboid, "GenericCuboid"},
0075 {VolumeBounds::BoundsType::eTrapezoid, "Trapezoid"}})
0076
0077 }