10 const double Safety = 0.9;
11 double remainigStep =
step;
12 double stepSize =
step;
15 std::pair<CartesianState, double> tryStep;
20 if (tryStep.second <
eps) {
21 if (remainigStep - stepSize <
eps / 2) {
23 std::cout <<
"Accuracy reached, and full step taken in " << nsteps <<
" steps" << std::endl;
26 remainigStep -= stepSize;
32 std::cout <<
"Accuracy reached, but " << remainigStep <<
" remain after " << nsteps
33 <<
" steps. Step size increased by " <<
factor <<
" to " << stepSize << std::endl;
40 std::cout <<
"Accuracy not yet reached: delta = " << tryStep.second <<
", step reduced by " <<
factor <<
" to " 44 }
while (remainigStep >
eps / 2);
57 return std::pair<CartesianState, double>(secondHalf,
diff);
61 return (
a.position() -
b.position()).
mag() + (
a.momentum() -
b.momentum()).
mag() /
b.momentum().mag();
double distance(const CartesianState &a, const CartesianState &b) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
CartesianState operator()(const CartesianState &start, const RKCartesianDerivative &deriv, double step, double eps) const
std::pair< CartesianState, double > stepWithAccuracy(const CartesianState &start, const RKCartesianDerivative &deriv, double step) const
Power< A, B >::type pow(const A &a, const B &b)