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