4 #include "gsl/gsl_fft_real.h"
23 for(
int i = 0; i < 4; ++i) {
41 double tmpDouble, tmpDouble2;
42 unsigned int skippedValues = 0;
43 bool passed = interpreteLine<double, double>(file,
zbegin_m, tmpDouble);
46 while (!file.eof() && passed) {
47 passed = interpreteLine<double, double>(file,
zend_m, tmpDouble,
false);
48 if (zend_m - tmpDouble2 > 1
e-10) {
58 return passed || file.eof();
69 if(zvals_m[nsp] - tmpDouble > 1
e-10) {
73 tmpDouble = zvals_m[nsp];
97 zvals[i] = zvals[i - 1] +
hz_m;
99 zvals[num_gridpz_m - 1] =
zvals_m[num_gridpz_m - 1];
115 realValues[num_gridpz_m - 1] =
onAxisField_m[num_gridpz_m - 1];
121 std::vector<double> &evenFieldSampling) {
122 std::vector<double> fourierCoefficients(2 * accuracy - 1);
127 RealValues[ii] = evenFieldSampling[i];
128 RealValues[iii] = evenFieldSampling[i];
131 gsl_fft_real_wavetable *
real = gsl_fft_real_wavetable_alloc(2 * num_gridpz_m);
132 gsl_fft_real_workspace *work = gsl_fft_real_workspace_alloc(2 * num_gridpz_m);
134 gsl_fft_real_transform(&RealValues[0], 1, 2 * num_gridpz_m, real, work);
136 gsl_fft_real_workspace_free(work);
137 gsl_fft_real_wavetable_free(real);
140 fourierCoefficients[0] = RealValues[0] / (2 *
num_gridpz_m);
141 for(
int i = 1; i < 2 * accuracy - 1; i++) {
145 return fourierCoefficients;
149 double interiorDerivative, base;
150 double coskzl, sinkzl, z = 0.0;
152 std::vector<double> higherDerivatives[3];
161 for(
int l = 1; l < accuracy; ++l) {
162 int coefIndex = 2 * l - 1;
164 interiorDerivative = base;
165 coskzl =
cos(kz * l);
166 sinkzl =
sin(kz * l);
168 higherDerivatives[0][i] += interiorDerivative * (-fourierComponents[coefIndex] * sinkzl
169 - fourierComponents[coefIndex + 1] * coskzl);
170 interiorDerivative *= base;
171 higherDerivatives[1][i] += interiorDerivative * (-fourierComponents[coefIndex] * coskzl
172 + fourierComponents[coefIndex + 1] * sinkzl);
173 interiorDerivative *= base;
174 higherDerivatives[2][i] += interiorDerivative * (fourierComponents[coefIndex] * sinkzl
175 + fourierComponents[coefIndex + 1] * coskzl);
179 for(
int i = 1; i < 4; ++i) {
182 gsl_spline_init(
onAxisInterpolants_m[i], &zvals[0], &higherDerivatives[i - 1][0], num_gridpz_m);
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
constexpr double e
The value of .
gsl_spline * onAxisInterpolants_m[4]
Tps< T > sin(const Tps< T > &x)
Sine.
constexpr double two_pi
The value of .
std::vector< double > getEvenlyDistributedSamplingPoints()
static std::string typeset_msg(const std::string &msg, const std::string &title)
bool determineNumSamplingPoints(std::ifstream &file)
FLieGenerator< T, N > real(const FLieGenerator< std::complex< T >, N > &)
Take real part of a complex generator.
std::vector< double > interpolateFieldData(std::vector< double > &samplingPoints)
double readFieldData(std::ifstream &file)
virtual void getOnaxisEz(std::vector< std::pair< double, double > > &F)
gsl_interp_accel * onAxisAccel_m[4]
void computeFieldDerivatives(std::vector< double > &fourierComponents, int accuracy)
std::vector< double > computeFourierCoefficients(int accuracy, std::vector< double > &evenSampling)
Astra1D_fast(std::string aFilename)
Tps< T > cos(const Tps< T > &x)
Cosine.
Inform & level3(Inform &inf)
void normalizeFieldData(double maxEz)
Inform & endl(Inform &inf)