21 PartBunch_t* bunch,
const size_t& i,
const double& t,
const double dt,
22 Arguments&... args)
const {
42 bool outOfBound = derivate_m(bunch, x, t, deriv1, i, args...);
43 if (outOfBound)
return false;
46 const double half_dt = 0.5 * dt;
47 const double t_half = t + half_dt;
49 for (
int j = 0; j < 6; ++j)
50 xtemp[j] = x[j] + half_dt * deriv1[j];
52 outOfBound = derivate_m(bunch, xtemp, t_half, deriv2, i, args...);
53 if (outOfBound)
return false;
56 for (
int j = 0; j < 6; ++j)
57 xtemp[j] = x[j] + half_dt * deriv2[j];
59 outOfBound = derivate_m(bunch, xtemp, t_half, deriv3, i, args...);
60 if (outOfBound)
return false;
63 double t_full = t + dt;
64 for (
int j = 0; j < 6; ++j)
65 xtemp[j] = x[j] + dt * deriv3[j];
67 outOfBound = derivate_m(bunch, xtemp, t_full, deriv4, i, args...);
68 if (outOfBound)
return false;
71 for (
int j = 0; j < 6; ++j)
72 x[j] += dt / 6. * (deriv1[j] + deriv4[j] + 2. * (deriv2[j] + deriv3[j]));
81 PartBunch_t* bunch [[maybe_unused]],
double* y,
const double& t,
double* yp,
82 const size_t& i, Arguments&... args)
const {
91 for (
int j = 0; j < 3; ++j)
96 bool outOfBound = this->fieldfunc_m(t, i, externalE, externalB, args...);
100 double tempgamma = sqrt(1 + (y[3] * y[3] + y[4] * y[4] + y[5] * y[5]));
102 yp[0] = c_mtns / tempgamma * y[3];
103 yp[1] = c_mtns / tempgamma * y[4];
104 yp[2] = c_mtns / tempgamma * y[5];
112 yp[3] = (externalE(0) /
Physics::c + (externalB(2) * y[4] - externalB(1) * y[5]) / tempgamma)
114 yp[4] = (externalE(1) /
Physics::c - (externalB(2) * y[3] - externalB(0) * y[5]) / tempgamma)
116 yp[5] = (externalE(2) /
Physics::c + (externalB(1) * y[3] - externalB(0) * y[4]) / tempgamma)
bool derivate_m(PartBunch_t *bunch, double *y, const double &t, double *yp, const size_t &i, Arguments &... args) const
bool doAdvance_m(PartBunch_t *bunch, const size_t &i, const double &t, const double dt, Arguments &... args) const