17 FourCoefs_m(nullptr) {
19 int skippedValues = 0;
20 std::string tmpString;
28 bool parsing_passed =
true;
30 parsing_passed = interpretLine<std::string, int>(file, tmpString,
accuracy_m);
32 parsing_passed = interpretLine<std::string, int, std::string>(file, tmpString,
accuracy_m, tmpString);
35 if (tmpString !=
"TRUE" &&
38 "The third string on the first line of 1D field "
39 "maps has to be either TRUE or FALSE");
43 parsing_passed = parsing_passed &&
44 interpretLine<double, double>(file,
zbegin_m, tmpDouble);
47 while(!file.eof() && parsing_passed) {
48 parsing_passed = interpretLine<double, double>(file,
zend_m, tmpDouble,
false);
49 if (
zend_m - tmpDouble2 > 1e-10) {
51 }
else if (parsing_passed) {
60 if (!parsing_passed && !file.eof()) {
64 "An error occured when reading the fieldmap '" +
Filename_m +
"'");
88 bool parsing_passed =
true;
90 std::string tmpString;
99 gsl_spline *Bz_interpolant = gsl_spline_alloc(gsl_interp_cspline,
num_gridpz_m);
100 gsl_interp_accel *Bz_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);
112 parsing_passed = interpretLine<double, double>(in, zvals[i], RealValues[i]);
115 if (zvals[i] - tmpDouble > 1e-10) {
116 if (std::abs(RealValues[i]) > Bz_max) {
117 Bz_max = std::abs(RealValues[i]);
119 tmpDouble = zvals[i];
125 gsl_spline_init(Bz_interpolant, zvals, RealValues,
num_gridpz_m);
132 RealValues[ii] = gsl_spline_eval(Bz_interpolant, z, Bz_accel);
138 RealValues[i] = RealValues[ii];
148 for (
int i = 1; i < 2 *
accuracy_m - 1; i++) {
152 gsl_spline_free(Bz_interpolant);
153 gsl_interp_accel_free(Bz_accel);
155 gsl_fft_real_workspace_free(work);
156 gsl_fft_real_wavetable_free(
real);
175 const double RR2 = R(0) * R(0) + R(1) * R(1);
185 for (
int l = 1; l <
accuracy_m ; l++, n += 2) {
187 double somefactor = 1.0;
188 double coskzl = std::cos(kz * l);
189 double sinkzl = std::sin(kz * l);
191 somefactor *= somefactor_base;
193 somefactor *= somefactor_base;
195 somefactor *= somefactor_base;
199 const double BfieldR = -ezp / 2. + ezppp / 16. * RR2;
201 B(0) += BfieldR * R(0);
202 B(1) += BfieldR * R(1);
203 B(2) += ez - ezpp * RR2 / 4.;
FLieGenerator< T, N > real(const FLieGenerator< std::complex< T >, N > &)
Take real part of a complex generator.