OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
FM1DDynamic.h
Go to the documentation of this file.
1 #ifndef CLASSIC_FIELDMAP1DDYNAMIC_HH
2 #define CLASSIC_FIELDMAP1DDYNAMIC_HH
3 
4 #include "Fields/Fieldmap.h"
5 
6 class FM1DDynamic: 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(std::string aFilename);
25  ~FM1DDynamic();
26 
27  virtual void readMap();
28  virtual void freeMap();
29 
30  bool checkFileData(std::ifstream &fieldFile, bool parsingPassed);
31  void computeFieldOffAxis(const Vector_t &R, Vector_t &E, Vector_t &B,
32  std::vector<double> fieldComponents) const;
33  void computeFieldOnAxis(double z,
34  std::vector<double> &fieldComponents) const;
35  void computeFourierCoefficients(double maxEz, double fieldData[]);
36  void convertHeaderData();
37  double readFileData(std::ifstream &fieldFile, double fieldData[]);
38  double readFileData(std::ifstream &fieldFile,
39  std::vector<std::pair<double, double>> &eZ);
40  bool readFileHeader(std::ifstream &fieldFile);
41  void scaleField(double maxEz, std::vector<std::pair<double, double>> &eZ);
42  void stripFileHeader(std::ifstream &fieldFile);
43 
44  double frequency_m;
46 
47  double rBegin_m;
48  double rEnd_m;
49  double zBegin_m;
50  double zEnd_m;
51  double length_m;
53 
54  int accuracy_m;
55  std::vector<double> fourierCoefs_m;
56 
57  friend class Fieldmap;
58 };
59 
60 inline bool FM1DDynamic::isInside(const Vector_t &r) const
61 {
62  return r(2) >= zBegin_m && r(2) < zEnd_m;
63 }
64 
65 #endif
DiffDirection
Definition: Fieldmap.h:54
double zBegin_m
Maximum radius of field.
Definition: FM1DDynamic.h:49
virtual bool isInside(const Vector_t &r) const
Definition: FM1DDynamic.h:60
virtual void swap()
void computeFieldOnAxis(double z, std::vector< double > &fieldComponents) const
int numberOfGridPoints_m
Field length.
Definition: FM1DDynamic.h:52
void stripFileHeader(std::ifstream &fieldFile)
FM1DDynamic(std::string aFilename)
Definition: FM1DDynamic.cpp:12
double twoPiOverLambdaSq_m
Field angular frequency (Hz).
Definition: FM1DDynamic.h:45
double readFileData(std::ifstream &fieldFile, double fieldData[])
std::vector< double > fourierCoefs_m
Number of Fourier coefficients to use reconstructing field.
Definition: FM1DDynamic.h:55
void scaleField(double maxEz, std::vector< std::pair< double, double >> &eZ)
double rEnd_m
Minimum radius of field.
Definition: FM1DDynamic.h:48
double length_m
Longitudinal end of field.
Definition: FM1DDynamic.h:51
void convertHeaderData()
bool checkFileData(std::ifstream &fieldFile, bool parsingPassed)
virtual double getFrequency() const
double zEnd_m
Longitudinal start of field.
Definition: FM1DDynamic.h:50
virtual void freeMap()
Definition: FM1DDynamic.cpp:61
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const
Definition: FM1DDynamic.cpp:71
virtual void readMap()
Definition: FM1DDynamic.cpp:44
virtual void getFieldDimensions(double &zBegin, double &zEnd) const
int accuracy_m
Number of grid points in field input file.
Definition: FM1DDynamic.h:54
void computeFourierCoefficients(double maxEz, double fieldData[])
double frequency_m
Definition: FM1DDynamic.h:44
double rBegin_m
2 Pi divided by the field RF wavelength squared.
Definition: FM1DDynamic.h:47
virtual void getInfo(Inform *)
void computeFieldOffAxis(const Vector_t &R, Vector_t &E, Vector_t &B, std::vector< double > fieldComponents) const
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const
Definition: FM1DDynamic.cpp:81
bool readFileHeader(std::ifstream &fieldFile)
virtual void setFrequency(double freq)
virtual void getOnaxisEz(std::vector< std::pair< double, double >> &eZ)
Definition: Inform.h:42