OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
FM1DDynamic_fast.h
Go to the documentation of this file.
1 #ifndef CLASSIC_FIELDMAP1DDYNAMICFAST_HH
2 #define CLASSIC_FIELDMAP1DDYNAMICFAST_HH
3 
4 #include "Fields/Fieldmap.h"
5 
6 class FM1DDynamic_fast: public Fieldmap {
7 
8 public:
9  virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const;
10  virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E,
11  Vector_t &B, const DiffDirection &dir) const;
12  virtual void getFieldDimensions(double &zBegin, double &zEnd) const;
13  virtual void getFieldDimensions(double &xIni, double &xFinal,
14  double &yIni, double &yFinal,
15  double &zIni, double &zFinal) const;
16  virtual void swap();
17  virtual void getInfo(Inform *);
18  virtual double getFrequency() const;
19  virtual void setFrequency(double freq);
20  virtual void getOnaxisEz(std::vector<std::pair<double, double>> &eZ);
21 
22  virtual bool isInside(const Vector_t &r) const;
23 private:
24  FM1DDynamic_fast(std::string aFilename);
26 
27  virtual void readMap();
28  virtual void freeMap();
29 
30  bool checkFileData(std::ifstream &fieldFile, bool parsingPassed);
31  void computeFieldDerivatives(std::vector<double> fourierCoefs,
32  double onAxisFieldP[], double onAxisFieldPP[],
33  double onAxisFieldPPP[]);
34  void computeFieldOffAxis(const Vector_t &R, Vector_t &E, Vector_t &B,
35  std::vector<double> fieldComponents) const;
36  void computeFieldOnAxis(double z, std::vector<double> &fieldComponents) const;
37  std::vector<double> computeFourierCoefficients(double fieldData[]);
38  void computeInterpolationVectors(double onAxisFieldP[],
39  double onAxisFieldPP[],
40  double onAxisFieldPPP[]);
41  void convertHeaderData();
42  void normalizeField(double maxEz, std::vector<double> &fourierCoefs);
43  double readFileData(std::ifstream &fieldFile, double fieldData[]);
44  double readFileData(std::ifstream &fieldFile,
45  std::vector<std::pair<double, double>> &eZ);
46  bool readFileHeader(std::ifstream &fieldFile);
47  void scaleField(double maxEz, std::vector<std::pair<double, double>> &eZ);
48  void stripFileHeader(std::ifstream &fieldFile);
49 
50  void prepareForMapCheck(std::vector<double> &fourierCoefs);
51 
52  double frequency_m;
54 
55  double rBegin_m;
56  double rEnd_m;
57  double zBegin_m;
58  double zEnd_m;
59  double length_m;
60  unsigned int numberOfGridPoints_m;
61  double deltaZ_m;
62  unsigned int accuracy_m;
63 
64  double* onAxisField_m;
69 
71  gsl_interp_accel *onAxisFieldAccel_m;
72  gsl_interp_accel *onAxisFieldPAccel_m;
73  gsl_interp_accel *onAxisFieldPPAccel_m;
74  gsl_interp_accel *onAxisFieldPPPAccel_m;
75 
76  friend class Fieldmap;
77 };
78 
79 inline bool FM1DDynamic_fast::isInside(const Vector_t &r) const
80 {
81  return r(2) >= zBegin_m && r(2) < zEnd_m;
82 }
83 
84 #endif
DiffDirection
Definition: Fieldmap.h:54
gsl_interp_accel * onAxisFieldAccel_m
On axis field third derivative interpolation structure.
FM1DDynamic_fast(std::string aFilename)
virtual void getFieldDimensions(double &zBegin, double &zEnd) const
gsl_spline * onAxisFieldPInterpolants_m
On axis field interpolation structure.
void stripFileHeader(std::ifstream &fieldFile)
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const
gsl_spline * onAxisFieldInterpolants_m
On axis field data.
double rEnd_m
Minimum radius of field.
double zBegin_m
Maximum radius of field.
gsl_interp_accel * onAxisFieldPPPAccel_m
void computeFieldOffAxis(const Vector_t &R, Vector_t &E, Vector_t &B, std::vector< double > fieldComponents) const
double zEnd_m
Longitudinal start of field.
void computeFieldOnAxis(double z, std::vector< double > &fieldComponents) const
virtual void setFrequency(double freq)
gsl_interp_accel * onAxisFieldPPAccel_m
std::vector< double > computeFourierCoefficients(double fieldData[])
double length_m
Longitudinal end of field.
virtual void readMap()
gsl_spline * onAxisFieldPPPInterpolants_m
On axis field second derivative interpolation structure.
virtual double getFrequency() const
void normalizeField(double maxEz, std::vector< double > &fourierCoefs)
virtual void getOnaxisEz(std::vector< std::pair< double, double >> &eZ)
virtual void swap()
void computeInterpolationVectors(double onAxisFieldP[], double onAxisFieldPP[], double onAxisFieldPPP[])
double readFileData(std::ifstream &fieldFile, double fieldData[])
void prepareForMapCheck(std::vector< double > &fourierCoefs)
unsigned int numberOfGridPoints_m
Field length.
void computeFieldDerivatives(std::vector< double > fourierCoefs, double onAxisFieldP[], double onAxisFieldPP[], double onAxisFieldPPP[])
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const
gsl_spline * onAxisFieldPPInterpolants_m
On axis field first derivative interpolation structure.
virtual void freeMap()
void scaleField(double maxEz, std::vector< std::pair< double, double >> &eZ)
bool checkFileData(std::ifstream &fieldFile, bool parsingPassed)
bool readFileHeader(std::ifstream &fieldFile)
virtual void getInfo(Inform *)
virtual bool isInside(const Vector_t &r) const
gsl_interp_accel * onAxisFieldPAccel_m
unsigned int accuracy_m
Field grid point spacing.
double deltaZ_m
Number of grid points in field input file.
double rBegin_m
2 Pi divided by the field RF wavelength squared.
double twoPiOverLambdaSq_m
Field angular frequency (Hz).
Definition: Inform.h:42