11 template <
typename S,
typename N>
12 template <
typename result_t,
typename propagator_state_t>
18 debugLog(state, [&] {
return std::string(
"Entering propagation."); });
21 m_navigator.status(state, m_stepper);
23 state.options.actionList(state, m_stepper, result);
27 bool terminatedNormally =
false;
29 if (!state.options.abortList(result, state, m_stepper)) {
31 m_navigator.target(state, m_stepper);
33 debugLog(state, [&] {
return std::string(
"Starting stepping loop."); });
35 for (; result.steps < state.options.maxSteps; ++result.steps) {
41 result.pathLength +=
s;
43 std::stringstream dstream;
44 dstream <<
"Step with size = ";
46 dstream <<
" performed.";
51 std::stringstream dstream;
52 dstream <<
"Step failed: ";
53 dstream << res.error();
61 m_navigator.status(state, m_stepper);
62 state.options.actionList(state, m_stepper, result);
63 if (state.options.abortList(result, state, m_stepper)) {
64 terminatedNormally =
true;
67 m_navigator.target(state, m_stepper);
73 if (!terminatedNormally) {
74 debugLog(state, [&] {
return std::string(
"Terminated with failure."); });
75 state.navigation.navigationBreak =
true;
79 debugLog(state, [&] {
return std::string(
"Stepping loop done."); });
80 state.options.actionList(state, m_stepper, result);
83 return std::move(result);
86 template <
typename S,
typename N>
87 template <
typename parameters_t,
typename propagator_options_t,
88 typename path_aborter_t>
90 const parameters_t&
start,
const propagator_options_t& options)
const
93 typename propagator_options_t::action_list_type>> {
94 static_assert(ParameterConcept<parameters_t>,
95 "Parameters do not fulfill parameter concept.");
103 typename propagator_options_t::action_list_type>;
106 "return track parameter type must be copy-constructible");
109 path_aborter_t pathAborter;
110 pathAborter.internalLimit = options.pathLimit;
112 auto abortList = options.abortList.append(pathAborter);
115 auto eOptions = options.extend(abortList);
116 using OptionsType = decltype(eOptions);
119 StateType state(
start, eOptions);
124 "Step method of the Stepper is not compatible with the propagator "
128 if (options.loopProtection) {
130 lProtection(state, m_stepper);
133 auto result = propagate_impl<ResultType>(state);
135 auto& propRes = *result;
137 auto curvState = m_stepper.curvilinearState(state.stepping);
138 auto& curvParameters = std::get<CurvilinearParameters>(curvState);
140 propRes.endParameters = std::make_unique<const CurvilinearParameters>(
141 std::move(curvParameters));
143 if (state.stepping.covTransport) {
144 auto& tJacobian = std::get<Jacobian>(curvState);
145 propRes.transportJacobian =
146 std::make_unique<const Jacobian>(std::move(tJacobian));
150 return result.error();
154 template <
typename S,
typename N>
155 template <
typename parameters_t,
typename propagator_options_t,
156 typename target_aborter_t,
typename path_aborter_t>
159 const propagator_options_t& options)
const
162 static_assert(ParameterConcept<parameters_t>,
163 "Parameters do not fulfill parameter concept.");
169 target_aborter_t targetAborter;
170 path_aborter_t pathAborter;
171 pathAborter.internalLimit = options.pathLimit;
172 auto abortList = options.abortList.append(targetAborter, pathAborter);
175 auto eOptions = options.extend(abortList);
176 using OptionsType = decltype(eOptions);
181 typename propagator_options_t::action_list_type>;
185 StateType state(
start, eOptions);
186 state.navigation.targetSurface = &
target;
191 "Step method of the Stepper is not compatible with the propagator "
196 lProtection(state, m_stepper);
199 auto result = propagate_impl<ResultType>(state);
202 auto& propRes = *result;
204 auto bs = m_stepper.boundState(state.stepping,
target);
205 auto& boundParameters = std::get<BoundParameters>(bs);
207 propRes.endParameters =
208 std::make_unique<const BoundParameters>(std::move(boundParameters));
210 if (state.stepping.covTransport) {
211 auto& tJacobian = std::get<Jacobian>(bs);
212 propRes.transportJacobian =
213 std::make_unique<const Jacobian>(std::move(tJacobian));
217 return result.error();
221 template <
typename S,
typename N>
222 template <
typename propagator_state_t>
224 propagator_state_t& state,
226 if (state.options.debug) {
227 std::vector<std::string> lines;
228 std::string input = logAction();
230 for (
const auto& line : lines) {
231 std::stringstream dstream;
232 dstream <<
"|->" << std::setw(state.options.debugPfxWidth);
233 dstream <<
"Propagator"
235 dstream << std::setw(state.options.debugMsgWidth) << line <<
'\n';
236 state.options.debugString += dstream.str();