11 template <
typename B,
typename E,
typename A>
13 : m_bField(std::move(bField)) {}
15 template <
typename B,
typename E,
typename A>
20 parameters << state.pos[0], state.pos[1], state.pos[2], state.t, state.dir[0],
21 state.dir[1], state.dir[2], state.q / state.p;
23 state.jacTransport, state.derivative,
24 state.jacToGlobal, parameters, state.covTransport,
25 state.pathAccumulated,
surface);
28 template <
typename B,
typename E,
typename A>
32 parameters << state.pos[0], state.pos[1], state.pos[2], state.t, state.dir[0],
33 state.dir[1], state.dir[2], state.q / state.p;
35 state.cov, state.jacobian, state.jacTransport, state.derivative,
36 state.jacToGlobal, parameters, state.covTransport, state.pathAccumulated);
39 template <
typename B,
typename E,
typename A>
44 state.
dir =
mom.normalized();
46 state.
t = pars.
time();
52 template <
typename B,
typename E,
typename A>
55 const Vector3D& udirection,
double up,
57 state.
pos = uposition;
58 state.
dir = udirection;
63 template <
typename B,
typename E,
typename A>
69 template <
typename B,
typename E,
typename A>
73 parameters << state.
pos[0], state.
pos[1], state.
pos[2], state.
t, state.
dir[0],
74 state.
dir[1], state.
dir[2], state.
q / state.
p;
80 template <
typename B,
typename E,
typename A>
81 template <
typename propagator_state_t>
83 propagator_state_t& state)
const {
84 using namespace UnitLiterals;
87 auto& sd = state.stepping.stepData;
88 double error_estimate = 0.;
92 sd.B_first = getField(state.stepping, state.stepping.pos);
93 if (!state.stepping.extension.validExtensionForStep(state, *
this) ||
94 !state.stepping.extension.k1(state, *
this, sd.k1, sd.B_first, sd.kQoP)) {
109 state.stepping.pos + half_h * state.stepping.dir +
h2 * 0.125 * sd.k1;
110 sd.B_middle = getField(state.stepping, pos1);
111 if (!state.stepping.extension.k2(state, *
this, sd.k2, sd.B_middle, sd.kQoP,
117 if (!state.stepping.extension.k3(state, *
this, sd.k3, sd.B_middle, sd.kQoP,
124 state.stepping.pos + h * state.stepping.dir +
h2 * 0.5 * sd.k3;
125 sd.B_last = getField(state.stepping, pos2);
126 if (!state.stepping.extension.k4(state, *
this, sd.k4, sd.B_last, sd.kQoP, h,
133 h2 * ((sd.k1 - sd.k2 - sd.k3 + sd.k4).template lpNorm<1>() +
134 std::abs(sd.kQoP[0] - sd.kQoP[1] - sd.kQoP[2] + sd.kQoP[3])),
136 return (error_estimate <= state.options.tolerance);
139 double stepSizeScaling = 1.;
140 size_t nStepTrials = 0;
143 while (!tryRungeKuttaStep(state.stepping.stepSize)) {
149 if (stepSizeScaling == 1.) {
152 state.stepping.stepSize = state.stepping.stepSize * stepSizeScaling;
156 if (state.stepping.stepSize * state.stepping.stepSize <
157 state.options.stepSizeCutOff * state.options.stepSizeCutOff) {
159 return EigenStepperError::StepSizeStalled;
164 if (nStepTrials > state.options.maxRungeKuttaStepTrials) {
166 return EigenStepperError::StepSizeAdjustmentFailed;
172 const double h = state.stepping.stepSize;
175 if (state.stepping.covTransport) {
178 if (!state.stepping.extension.finalize(state, *
this,
h, D)) {
179 return EigenStepperError::StepInvalid;
183 state.stepping.jacTransport = D * state.stepping.jacTransport;
185 if (!state.stepping.extension.finalize(state, *
this,
h)) {
186 return EigenStepperError::StepInvalid;
191 state.stepping.pos +=
192 h * state.stepping.dir +
h2 / 6. * (sd.k1 + sd.k2 + sd.k3);
193 state.stepping.dir +=
h / 6. * (sd.k1 + 2. * (sd.k2 + sd.k3) + sd.k4);
194 state.stepping.dir /= state.stepping.dir.norm();
195 if (state.stepping.covTransport) {
196 state.stepping.derivative.template head<3>() = state.stepping.dir;
197 state.stepping.derivative.template segment<3>(4) = sd.k4;
199 state.stepping.pathAccumulated +=
h;