40 static_assert(not detail::has_duplicates_v<extensions...>,
41 "same extension type specified several times");
43 static constexpr
unsigned int nExtensions =
sizeof...(extensions);
45 static_assert(
nExtensions != 0,
"no extension type specified");
67 template <
typename propagator_state_t,
typename stepper_t,
72 const auto bids = std::apply(
73 [&](
const auto&... ext) {
74 return std::array<int, nExtensions>{
75 ext.bid(state, stepper, navigator)...};
81 return (std::find(validExtensions.begin(), validExtensions.end(),
true) !=
82 validExtensions.end());
89 template <
typename propagator_state_t,
typename stepper_t,
93 std::array<double, 4>& kQoP,
const int i,
const double h = 0.,
94 const Vector3& kprev = Vector3::Zero()) {
96 auto impl = [&,
i,
h](
auto intType,
auto& implRef) {
97 constexpr
int N = decltype(intType)::
value;
99 if constexpr (N == 0) {
104 return implRef(std::integral_constant<int, N - 1>{}, implRef);
107 if (std::get<N - 1>(this->
tuple())
108 .
template k(state, stepper, navigator, knew, bField, kQoP, i,
h,
110 return implRef(std::integral_constant<int, N - 1>{}, implRef);
118 return impl(std::integral_constant<int, nExtensions>{}, impl);
125 template <
typename propagator_state_t,
typename stepper_t,
126 typename navigator_t>
127 bool k1(
const propagator_state_t& state,
const stepper_t& stepper,
128 const navigator_t& navigator,
Vector3& knew,
const Vector3& bField,
129 std::array<double, 4>& kQoP) {
130 return k(state, stepper, navigator, knew, bField, kQoP, 0);
136 template <
typename propagator_state_t,
typename stepper_t,
137 typename navigator_t>
138 bool k2(
const propagator_state_t& state,
const stepper_t& stepper,
139 const navigator_t& navigator,
Vector3& knew,
const Vector3& bField,
140 std::array<double, 4>& kQoP,
const double h,
const Vector3& kprev) {
141 return k(state, stepper, navigator, knew, bField, kQoP, 1, h, kprev);
147 template <
typename propagator_state_t,
typename stepper_t,
148 typename navigator_t>
149 bool k3(
const propagator_state_t& state,
const stepper_t& stepper,
150 const navigator_t& navigator,
Vector3& knew,
const Vector3& bField,
151 std::array<double, 4>& kQoP,
const double h,
const Vector3& kprev) {
152 return k(state, stepper, navigator, knew, bField, kQoP, 2, h, kprev);
158 template <
typename propagator_state_t,
typename stepper_t,
159 typename navigator_t>
160 bool k4(
const propagator_state_t& state,
const stepper_t& stepper,
161 const navigator_t& navigator,
Vector3& knew,
const Vector3& bField,
162 std::array<double, 4>& kQoP,
const double h,
const Vector3& kprev) {
163 return k(state, stepper, navigator, knew, bField, kQoP, 3, h, kprev);
169 template <
typename propagator_state_t,
typename stepper_t,
170 typename navigator_t>
171 bool finalize(propagator_state_t& state,
const stepper_t& stepper,
172 const navigator_t& navigator,
const double h,
FreeMatrix&
D) {
174 auto impl = [&,
h](
auto intType,
auto& implRef) {
175 constexpr
int N = decltype(intType)::
value;
177 if constexpr (N == 0) {
182 return implRef(std::integral_constant<int, N - 1>{}, implRef);
185 if (std::get<N - 1>(this->
tuple())
186 .
finalize(state, stepper, navigator, h, D)) {
187 return implRef(std::integral_constant<int, N - 1>{}, implRef);
195 return impl(std::integral_constant<int, nExtensions>{}, impl);
201 template <
typename propagator_state_t,
typename stepper_t,
202 typename navigator_t>
203 bool finalize(propagator_state_t& state,
const stepper_t& stepper,
204 const navigator_t& navigator,
const double h) {
206 auto impl = [&,
h](
auto intType,
auto& implRef) {
207 constexpr
int N = decltype(intType)::
value;
209 if constexpr (N == 0) {
214 return implRef(std::integral_constant<int, N - 1>{}, implRef);
218 if (std::get<N - 1>(this->
tuple())
219 .
finalize(state, stepper, navigator, h)) {
220 return implRef(std::integral_constant<int, N - 1>{}, implRef);
228 return impl(std::integral_constant<int, nExtensions>{}, impl);