File indexing completed on 2025-01-30 09:15:17
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::InternalNavigationDelegate createUpdater(
0039 grid_type&& grid,
0040 const std::array<Acts::AxisDirection, grid_type::DIM>& bv,
0041 const Acts::Transform3& transform) {
0042 Acts::Experimental::IndexedSurfacesNavigation<grid_type> indexedSurfaces(
0043 std::forward<grid_type>(grid), bv, transform);
0044
0045
0046 Acts::Experimental::AllPortalsNavigation allPortals;
0047
0048
0049 using DelegateType =
0050 Acts::Experimental::IndexedSurfacesAllPortalsNavigation<
0051 grid_type, Acts::Experimental::IndexedSurfacesNavigation>;
0052 auto indexedSurfacesAllPortals = std::make_unique<const DelegateType>(
0053 std::tie(allPortals, indexedSurfaces));
0054
0055
0056 Acts::Experimental::InternalNavigationDelegate nStateUpdater;
0057 nStateUpdater.connect<&DelegateType::update>(
0058 std::move(indexedSurfacesAllPortals));
0059
0060 return nStateUpdater;
0061 }
0062 };
0063
0064 }
0065
0066 Acts::Experimental::InternalNavigationDelegate
0067 Acts::IndexedSurfacesJsonConverter::fromJson(
0068 const nlohmann::json& jSurfaceNavigation) {
0069 if (!jSurfaceNavigation.is_null()) {
0070
0071 auto sfCandidates = IndexedGridJsonHelper::generateFromJson<
0072 Experimental::InternalNavigationDelegate, IndexedSurfacesGenerator>(
0073 jSurfaceNavigation, "IndexedSurfaces");
0074 if (sfCandidates.connected()) {
0075 return sfCandidates;
0076 }
0077 }
0078
0079 return Experimental::tryAllPortalsAndSurfaces();
0080 }