65{
66 fInitialPoint = { y[0], y[1], y[2] };
67
69
73 const G4double S6 = hstep * one_sixth;
74
76 if (notEquals(momentum2, fMomentum2))
77 {
78 fMomentum = std::sqrt(momentum2);
79 fMomentum2 = momentum2;
80 fInverseMomentum = 1. / fMomentum;
81 fCoefficient = GetFCof() * fInverseMomentum;
82 }
83
84
86 fInverseMomentum * dydx[3],
87 fInverseMomentum * dydx[4],
88 fInverseMomentum * dydx[5]
89 };
90
91
93 y[0] + S5 * (dydx[0] + S4 * K1[0]),
94 y[1] + S5 * (dydx[1] + S4 * K1[1]),
95 y[2] + S5 * (dydx[2] + S4 * K1[2]),
96 y[7]
97 };
98
99 GetFieldValue(p, field);
100
102 dydx[0] + S5 * K1[0],
103 dydx[1] + S5 * K1[1],
104 dydx[2] + S5 * K1[2]
105 };
106
108 (A2[1] * field[2] - A2[2] * field[1]) * fCoefficient,
109 (A2[2] * field[0] - A2[0] * field[2]) * fCoefficient,
110 (A2[0] * field[1] - A2[1] * field[0]) * fCoefficient
111 };
112
113 fMidPoint = { p[0], p[1], p[2] };
114
115
117 dydx[0] + S5 * K2[0],
118 dydx[1] + S5 * K2[1],
119 dydx[2] + S5 * K2[2]
120 };
121
123 (A3[1] * field[2] - A3[2] * field[1]) * fCoefficient,
124 (A3[2] * field[0] - A3[0] * field[2]) * fCoefficient,
125 (A3[0] * field[1] - A3[1] * field[0]) * fCoefficient
126 };
127
128
129 p[0] = y[0] + hstep * (dydx[0] + S5 * K3[0]);
130 p[1] = y[1] + hstep * (dydx[1] + S5 * K3[1]);
131 p[2] = y[2] + hstep * (dydx[2] + S5 * K3[2]);
132
133 GetFieldValue(p, field);
134
136 dydx[0] + hstep * K3[0],
137 dydx[1] + hstep * K3[1],
138 dydx[2] + hstep * K3[2]
139 };
140
142 (A4[1] * field[2] - A4[2] * field[1]) * fCoefficient,
143 (A4[2] * field[0] - A4[0] * field[2]) * fCoefficient,
144 (A4[0] * field[1] - A4[1] * field[0]) * fCoefficient
145 };
146
147
148 yOut[0] = y[0] + hstep * (dydx[0] + S6 * (K1[0] + K2[0] + K3[0]));
149 yOut[1] = y[1] + hstep * (dydx[1] + S6 * (K1[1] + K2[1] + K3[1]));
150 yOut[2] = y[2] + hstep * (dydx[2] + S6 * (K1[2] + K2[2] + K3[2]));
151
152 yOut[3] = dydx[0] + S6 * (K1[0] + K4[0] + 2. * (K2[0] + K3[0]));
153 yOut[4] = dydx[1] + S6 * (K1[1] + K4[1] + 2. * (K2[1] + K3[1]));
154 yOut[5] = dydx[2] + S6 * (K1[2] + K4[2] + 2. * (K2[2] + K3[2]));
155
156 yOut[6] = y[6];
157 yOut[7] = y[7];
158
159 fEndPoint = { yOut[0], yOut[1], yOut[2] };
160
161
162 yError[3] = hstep * std::fabs(K1[0] - K2[0] - K3[0] + K4[0]);
163 yError[4] = hstep * std::fabs(K1[1] - K2[1] - K3[1] + K4[1]);
164 yError[5] = hstep * std::fabs(K1[2] - K2[2] - K3[2] + K4[2]);
165 yError[0] = hstep * yError[3];
166 yError[1] = hstep * yError[4];
167 yError[2] = hstep * yError[5];
168 yError[3] *= fMomentum;
169 yError[4] *= fMomentum;
170 yError[5] *= fMomentum;
171
172
174 yOut[3] *= normF;
175 yOut[4] *= normF;
176 yOut[5] *= normF;
177
178
179
180
181}
G4double getValue(const ArrayType &array, Value1D value)
G4double getValue2(const ArrayType &array, Value1D value)