File indexing completed on 2025-08-05 08:10:18
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Plugins/Json/IndexedSurfacesJsonConverter.hpp"
0010
0011 #include "Acts/Navigation/NavigationStateUpdaters.hpp"
0012 #include "Acts/Plugins/Json/GridJsonConverter.hpp"
0013 #include "Acts/Plugins/Json/IndexedGridJsonHelper.hpp"
0014 #include "Acts/Plugins/Json/UtilitiesJsonConverter.hpp"
0015 #include "Acts/Utilities/GridAxisGenerators.hpp"
0016
0017 #include <array>
0018 #include <memory>
0019 #include <tuple>
0020 #include <vector>
0021
0022 namespace {
0023
0024
0025 struct IndexedSurfacesGenerator {
0026 using value_type = std::vector<std::size_t>;
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 template <typename grid_type>
0038 Acts::Experimental::SurfaceCandidatesUpdater createUpdater(
0039 grid_type&& grid,
0040 const std::array<Acts::BinningValue, grid_type::DIM>& bv,
0041 const Acts::Transform3& transform) {
0042 Acts::Experimental::IndexedSurfacesImpl<grid_type> indexedSurfaces(
0043 std::move(grid), bv, transform);
0044
0045
0046 Acts::Experimental::AllPortalsImpl allPortals;
0047
0048
0049 using DelegateType = Acts::Experimental::IndexedSurfacesAllPortalsImpl<
0050 grid_type, Acts::Experimental::IndexedSurfacesImpl>;
0051 auto indexedSurfacesAllPortals = std::make_unique<const DelegateType>(
0052 std::tie(allPortals, indexedSurfaces));
0053
0054
0055 Acts::Experimental::SurfaceCandidatesUpdater nStateUpdater;
0056 nStateUpdater.connect<&DelegateType::update>(
0057 std::move(indexedSurfacesAllPortals));
0058
0059 return nStateUpdater;
0060 }
0061 };
0062
0063 }
0064
0065 Acts::Experimental::SurfaceCandidatesUpdater
0066 Acts::IndexedSurfacesJsonConverter::fromJson(
0067 const nlohmann::json& jSurfaceNavigation) {
0068 if (!jSurfaceNavigation.is_null()) {
0069
0070 auto sfCandidates = IndexedGridJsonHelper::generateFromJson<
0071 Experimental::SurfaceCandidatesUpdater, IndexedSurfacesGenerator>(
0072 jSurfaceNavigation, "IndexedSurfaces");
0073 if (sfCandidates.connected()) {
0074 return sfCandidates;
0075 }
0076 }
0077
0078 return Experimental::tryAllPortalsAndSurfaces();
0079 }