17 int skippedValues = 0;
18 std::string tmpString;
26 bool parsing_passed = true;
28 parsing_passed = interpretLine<std::string, int>(file, tmpString, accuracy_m);
34 if (tmpString !=
"TRUE" && tmpString !=
"FALSE")
36 "Astra1DDynamic::Astra1DDynamic",
37 "The third string on the first line of 1D field "
38 "maps has to be either TRUE or FALSE");
47 while (!file.eof() && parsing_passed) {
49 if (
zend_m - tmpDouble2 > 1e-10) {
51 }
else if (parsing_passed) {
59 if (!parsing_passed && !file.eof()) {
63 "Astra1DDynamic::Astra1DDynamic",
64 "An error occured when reading the fieldmap '" +
Filename_m +
"'");
88 bool parsing_passed =
true;
90 std::string tmpString;
99 gsl_spline* Ez_interpolant = gsl_spline_alloc(gsl_interp_cspline,
num_gridpz_m);
100 gsl_interp_accel* Ez_accel = gsl_interp_accel_alloc();
102 gsl_fft_real_wavetable* real = gsl_fft_real_wavetable_alloc(2 *
num_gridpz_m);
103 gsl_fft_real_workspace* work = gsl_fft_real_workspace_alloc(2 *
num_gridpz_m);
117 if (zvals[i] - tmpDouble > 1e-10) {
118 if (std::abs(RealValues[i]) > Ez_max) {
119 Ez_max = std::abs(RealValues[i]);
121 tmpDouble = zvals[i];
127 gsl_spline_init(Ez_interpolant, zvals, RealValues,
num_gridpz_m);
134 RealValues[ii] = gsl_spline_eval(Ez_interpolant, z, Ez_accel);
140 RealValues[i] = RealValues[ii];
143 gsl_fft_real_transform(RealValues, 1, 2 *
num_gridpz_m, real, work);
150 for (
int i = 1; i < 2 *
accuracy_m - 1; ++i) {
154 gsl_spline_free(Ez_interpolant);
155 gsl_interp_accel_free(Ez_accel);
157 gsl_fft_real_workspace_free(work);
158 gsl_fft_real_wavetable_free(real);
180 const double RR2 = R(0) * R(0) + R(1) * R(1);
190 for (
int l = 1; l <
accuracy_m; ++l, n += 2) {
192 double somefactor = 1.0;
193 double coskzl = cos(kz * l);
194 double sinkzl = sin(kz * l);
196 somefactor *= somefactor_base;
198 somefactor *= somefactor_base;
200 somefactor *= somefactor_base;
207 const double EfieldR = -(ezp / 2. + fp * RR2);
210 E(0) += EfieldR * R(0);
211 E(1) += EfieldR * R(1);
212 E(2) += ez + 4. * f * RR2;
213 B(0) += -BfieldT * R(1);
214 B(1) += BfieldT * R(0);
virtual bool getFieldDerivative(const Vector_t< double, 3 > &R, Vector_t< double, 3 > &E, Vector_t< double, 3 > &B, const DiffDirection &dir) const