33 std::vector<litfloat> xOut(6, 0.);
34 std::vector<litfloat> F1(36, 0.);
39 std::vector<litfloat> cOut(21);
47 F->assign(F1.begin(), F1.end());
54 litfloat zOut, std::vector<litfloat>& derivs)
const
58 litfloat coef[4] = {0.0, 0.5, 0.5, 1.0};
61 litfloat dAx_dtx[4], dAy_dtx[4], dAx_dty[4], dAy_dty[4];
71 litfloat x[5] = {xIn[0], xIn[1], xIn[2], xIn[3], xIn[5]};
73 for (
unsigned int iStep = 0; iStep < 4; iStep++) {
75 for (
unsigned int i = 0; i < 5; i++) {
76 x[i] = xIn[4 == i ? 5 : i] + coef[iStep] * k[i][iStep - 1];
81 fField->GetFieldValue(
x[0],
x[1], zIn + coef[iStep] *
h, Bx, By, Bz);
90 litfloat txtxtyty1 = 1.0 + txtx + tyty;
94 Ax[iStep] = (txty * Bx + ty * Bz - (1.0 + txtx) * By) * t1;
95 Ay[iStep] = (-txty * By - tx * Bz + (1.0 + tyty) * Bx) * t1;
97 dAx_dtx[iStep] = Ax[iStep] * tx * t2 + (ty * Bx - 2.0 * tx * By) * t1;
98 dAx_dty[iStep] = Ax[iStep] * ty * t2 + (tx * Bx + Bz) * t1;
99 dAy_dtx[iStep] = Ay[iStep] * tx * t2 + (-ty * By - Bz) * t1;
100 dAy_dty[iStep] = Ay[iStep] * ty * t2 + (-tx * By + 2.0 * ty * Bx) * t1;
102 k[0][iStep] = tx *
h;
103 k[1][iStep] = ty *
h;
104 k[2][iStep] = Ax[iStep] * hCqp;
105 k[3][iStep] = Ay[iStep] * hCqp;
109 for (
unsigned int i = 0; i < 4; i++) {
110 xOut[i] =
CalcOut(xIn[i], k[i]);
113 xOut[5] =
CalcOut(xIn[5], k[4]);
141 litfloat fT1 = std::sqrt(1 + xIn[2] * xIn[2] + xIn[3] * xIn[3]);
149 for (
unsigned int iStep = 0; iStep < 4; iStep++) {
151 for (
unsigned int i = 0; i < 5; i++) {
153 x[i] = x0[i] + coef[iStep] * k[i][iStep - 1];
158 k[0][iStep] =
x[2] *
h;
159 k[1][iStep] =
x[3] *
h;
161 k[3][iStep] = (dAy_dtx[iStep] *
x[2] + dAy_dty[iStep] *
x[3]) * hCqp;
165 derivs[2] =
CalcOut(x0[0], k[0]);
166 derivs[8] =
CalcOut(x0[1], k[1]);
168 derivs[20] =
CalcOut(x0[3], k[3]);
170 derivs[32] =
CalcOut(x0[4], k[4]);
179 for (
unsigned int iStep = 0; iStep < 4; iStep++) {
181 for (
unsigned int i = 0; i < 5; i++) {
183 x[i] = x0[i] + coef[iStep] * k[i][iStep - 1];
188 k[0][iStep] =
x[2] *
h;
189 k[1][iStep] =
x[3] *
h;
190 k[2][iStep] = (dAx_dtx[iStep] *
x[2] + dAx_dty[iStep] *
x[3]) * hCqp;
195 derivs[3] =
CalcOut(x0[0], k[0]);
196 derivs[9] =
CalcOut(x0[1], k[1]);
197 derivs[15] =
CalcOut(x0[2], k[2]);
200 derivs[33] =
CalcOut(x0[4], k[4]);
209 for (
unsigned int iStep = 0; iStep < 4; iStep++) {
211 for (
unsigned int i = 0; i < 5; i++) {
212 x[i] = x0[i] + coef[iStep] * k[i][iStep - 1];
216 k[0][iStep] =
x[2] *
h;
217 k[1][iStep] =
x[3] *
h;
218 k[2][iStep] = Ax[iStep] * hC + hCqp * (dAx_dtx[iStep] *
x[2] + dAx_dty[iStep] *
x[3]);
219 k[3][iStep] = Ay[iStep] * hC + hCqp * (dAy_dtx[iStep] *
x[2] + dAy_dty[iStep] *
x[3]);
223 derivs[4] =
CalcOut(x0[0], k[0]);
224 derivs[10] =
CalcOut(x0[1], k[1]);
225 derivs[16] =
CalcOut(x0[2], k[2]);
226 derivs[22] =
CalcOut(x0[3], k[3]);
228 derivs[34] =
CalcOut(x0[4], k[4]);
262 std::vector<litfloat>& cOut)
const
298 std::vector<litfloat> C(36);
301 for (
int i = 0; i < 6; ++i) {
302 for (
int j = i; j < 6; ++j) {
303 C[6 * i + j] = cIn[k++];
305 if (i < j) C[i + 6 * j] = C[6 * i + j];
309 std::vector<litfloat> tmp(36);
311 std::vector<litfloat> FT(36);
313 std::vector<litfloat> tmp2(36);
317 for (
int i = 0; i < 6; ++i) {
318 for (
int j = i; j < 6; ++j)
319 cOut[k++] = tmp2[6 * i + j];