// This file is part of the ACTS project. // // Copyright (C) 2016 CERN for the benefit of the ACTS project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. #include "Acts/Propagator/AtlasStepper.hpp" #include "Acts/Propagator/EigenStepper.hpp" #include "Acts/Propagator/Navigator.hpp" #include "Acts/Propagator/Propagator.hpp" #include "Acts/Propagator/StraightLineStepper.hpp" #include "Acts/Propagator/SympyStepper.hpp" #include "Acts/Utilities/Logger.hpp" #include "ActsPython/Utilities/Helpers.hpp" #include "ActsPython/Utilities/Macros.hpp" #include #include #include namespace py = pybind11; using namespace pybind11::literals; using namespace Acts; namespace ActsPython { template void addPropagator(py::module_& m, const std::string& prefix) { using propagator_t = Propagator; py::class_(m, (prefix + "Propagator").c_str()) .def(py::init<>([=](stepper_t stepper, navigator_t navigator, Logging::Level level = Logging::Level::INFO) { return propagator_t{ std::move(stepper), std::move(navigator), getDefaultLogger(prefix + "Propagator", level)}; }), py::arg("stepper"), py::arg("navigator"), py::arg("level") = Logging::INFO); } /// @brief Bind propagation related functions to the Python module /// @param m The Python module to which the functions will be bound void addPropagation(py::module_& m) { { using Config = Navigator::Config; auto nav = py::class_>(m, "Navigator") .def(py::init<>([](const Config& cfg, Logging::Level level = Logging::INFO) { return Navigator{cfg, getDefaultLogger("Navigator", level)}; }), py::arg("cfg"), py::arg("level") = Logging::INFO); auto c = py::class_(nav, "Config").def(py::init<>()); ACTS_PYTHON_STRUCT(c, resolveMaterial, resolvePassive, resolveSensitive, trackingGeometry); } { auto stepper = py::class_(m, "AtlasStepper"); stepper.def(py::init>()); addPropagator(m, "Atlas"); } { auto stepper = py::class_>(m, "EigenStepper"); stepper.def(py::init>()); addPropagator, Navigator>(m, "Eigen"); } { auto stepper = py::class_(m, "StraightLineStepper"); stepper.def(py::init<>()); addPropagator(m, "StraightLine"); } { auto stepper = py::class_(m, "SympyStepper"); stepper.def(py::init>()); addPropagator(m, "Sympy"); } } } // namespace ActsPython