OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
FieldSolver.h
Go to the documentation of this file.
1 #ifndef OPAL_FieldSolver_HH
2 #define OPAL_FieldSolver_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: FieldSolver.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: FieldSolver
13 //
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:33:44 $
17 // $Author: Andreas Adelmann $
18 //
19 // ------------------------------------------------------------------------
20 
21 class FieldSolver;
23 #include "Algorithms/PartData.h"
24 #include "Solvers/PoissonSolver.h"
25 
26 #ifdef ENABLE_AMR
27  #include "Amr/AmrObject.h"
29  #include <memory>
30 #endif
31 
32 template <class T, unsigned Dim>
33 class PartBunchBase;
34 
35 
36 // Class FieldSolver
37 // ------------------------------------------------------------------------
39 // A FieldSolver definition is used by most physics commands to define the
40 // particle charge and the reference momentum, together with some other
41 // data.
42 
43 class FieldSolver: public Definition {
44 
45 public:
46 
48  FieldSolver();
49 
50  virtual ~FieldSolver();
51 
53  virtual FieldSolver *clone(const std::string &name);
54 
56  static FieldSolver *find(const std::string &name);
57 
58  std::string getType();
59 
61  double getMX() const;
62 
64  double getMY() const;
65 
67  double getMT() const;
68 
70  void setMX(double);
71 
73  void setMY(double);
74 
76  void setMT(double);
77 
79  virtual void update();
80 
82  virtual void execute();
83 
84  void initCartesianFields();
85 
87 
88  bool hasValidSolver();
89 
90  std::string getFieldSolverType() {return fsType_m; }
91 
92  inline Layout_t &getParticleLayout() { return *PL_m; }
93 
95 
96  Inform &printInfo(Inform &os) const;
97  unsigned int getInteractionRadius() {return (unsigned int) rpp_m; }
98 
99  bool hasPeriodicZ();
100 
101 #ifdef ENABLE_AMR
102  bool isAmrSolverType() const;
103 
105  return itsAmrObject_mp.get();
106  }
107 
108  const AmrObject *getAmrObject() const {
109  return itsAmrObject_mp.get();
110  }
111 #endif
112 
115 
116 private:
117 #ifdef ENABLE_AMR
118 
119  std::string getTagging_m() const;
120 
121  void initAmrObject_m();
122 
123  void initAmrSolver_m();
124 
125  std::unique_ptr<AmrObject> itsAmrObject_mp;
126 #endif
127 
128  // Not implemented.
129  FieldSolver(const FieldSolver &);
130  void operator=(const FieldSolver &);
131 
132  // Clone constructor.
133  FieldSolver(const std::string &name, FieldSolver *parent);
134 
137 
140 
142  std::unique_ptr<Layout_t> PL_m;
143 
146 
147  std::string fsType_m;
148 
149  double rpp_m;
150 
151 };
152 
153 inline Inform &operator<<(Inform &os, const FieldSolver &fs) {
154  return fs.printInfo(os);
155 }
156 
157 #endif // OPAL_FieldSolver_HH
static FieldSolver * find(const std::string &name)
Find named FieldSolver.
std::ostream & operator<<(std::ostream &os, const Attribute &attr)
Definition: Attribute.cpp:167
void initAmrSolver_m()
The base class for all OPAL definitions.
Definition: Definition.h:30
double getMT() const
Return meshsize.
The FieldSolver definition.
Definition: FieldSolver.h:43
void operator=(const FieldSolver &)
virtual void execute()
Execute (init) the field solver data.
AmrObject * getAmrObject()
Definition: FieldSolver.h:104
FRONT * fs
Definition: hypervolume.cpp:59
void initSolver(PartBunchBase< double, 3 > *b)
std::string getFieldSolverType()
Definition: FieldSolver.h:90
double getMY() const
Return meshsize.
void setMX(double)
Store emittance for mode 1.
virtual ~FieldSolver()
bool hasValidSolver()
Class: DataSink.
Definition: OpalData.h:29
PoissonSolver * solver_m
the actual solver, should be a base object
Definition: FieldSolver.h:114
void initAmrObject_m()
std::unique_ptr< Layout_t > PL_m
The particle layout.
Definition: FieldSolver.h:142
virtual void update()
Update the field solver data.
virtual FieldSolver * clone(const std::string &name)
Make clone.
std::string fsType_m
Definition: FieldSolver.h:147
void setMT(double)
Store emittance for mode 3.
FieldSolver()
Exemplar constructor.
const AmrObject * getAmrObject() const
Definition: FieldSolver.h:108
Mesh_t * mesh_m
The cartesian mesh.
Definition: FieldSolver.h:136
FieldLayout_t * getFieldLayout()
Definition: FieldSolver.h:94
std::string getTagging_m() const
std::unique_ptr< AmrObject > itsAmrObject_mp
Definition: FieldSolver.h:125
PartBunchBase< double, 3 > * itsBunch_m
all the particles are here ...
Definition: FieldSolver.h:145
const std::string name
void initCartesianFields()
std::string getType()
double getMX() const
Return meshsize.
double rpp_m
Definition: FieldSolver.h:149
unsigned int getInteractionRadius()
Definition: FieldSolver.h:97
void setMY(double)
Store emittance for mode 2.
bool hasPeriodicZ()
Inform & printInfo(Inform &os) const
Definition: Inform.h:41
bool isAmrSolverType() const
FieldLayout_t * FL_m
The field layout f.
Definition: FieldSolver.h:139
Layout_t & getParticleLayout()
Definition: FieldSolver.h:92