OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
FM1DElectroStatic.h
Go to the documentation of this file.
1 #ifndef CLASSIC_FIELDMAP1DELECTROSTATIC_HH
2 #define CLASSIC_FIELDMAP1DELECTROSTATIC_HH
3 
4 #include "Fields/Fieldmap.h"
5 
6 class FM1DElectroStatic: public Fieldmap {
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(std::string aFilename);
25 
26  virtual void readMap();
27  virtual void freeMap();
28 
29  bool checkFileData(std::ifstream &fieldFile, bool parsingPassed);
30  void computeFieldOffAxis(const Vector_t &R, Vector_t &E, Vector_t &B,
31  std::vector<double> fieldComponents) const;
32  void computeFieldOnAxis(double z,
33  std::vector<double> &fieldComponents) const;
34  void computeFourierCoefficients(double maxEz, double fieldData[]);
35  void convertHeaderData();
36  double readFileData(std::ifstream &fieldFile, double fieldData[]);
37  bool readFileHeader(std::ifstream &fieldFile);
38  void stripFileHeader(std::ifstream &fieldFile);
39 
40  double rBegin_m;
41  double rEnd_m;
42  double zBegin_m;
43  double zEnd_m;
44  double length_m;
46 
47  int accuracy_m;
48  std::vector<double> fourierCoefs_m;
49 
50  friend class Fieldmap;
51 };
52 
53 inline bool FM1DElectroStatic::isInside(const Vector_t &r) const
54 {
55  return r(2) >= zBegin_m && r(2) < zEnd_m;
56 }
57 
58 #endif
DiffDirection
Definition: Fieldmap.h:54
virtual void freeMap()
double readFileData(std::ifstream &fieldFile, double fieldData[])
double zBegin_m
Maximum radius of field.
void computeFieldOnAxis(double z, std::vector< double > &fieldComponents) const
void stripFileHeader(std::ifstream &fieldFile)
double rEnd_m
Minimum radius of field.
virtual void setFrequency(double freq)
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const
int accuracy_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
double length_m
Longitudinal end of field.
virtual double getFrequency() const
std::vector< double > fourierCoefs_m
Number of Fourier coefficients to use reconstructing field.
bool checkFileData(std::ifstream &fieldFile, bool parsingPassed)
int numberOfGridPoints_m
Field length.
bool readFileHeader(std::ifstream &fieldFile)
virtual void readMap()
void computeFieldOffAxis(const Vector_t &R, Vector_t &E, Vector_t &B, std::vector< double > fieldComponents) const
virtual bool isInside(const Vector_t &r) const
virtual void getInfo(Inform *)
FM1DElectroStatic(std::string aFilename)
void computeFourierCoefficients(double maxEz, double fieldData[])
virtual void getFieldDimensions(double &zBegin, double &zEnd) const
double zEnd_m
Longitudinal start of field.
Definition: Inform.h:42