OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
PartBunch.h
Go to the documentation of this file.
1 #ifndef OPAL_PartBunch_HH
2 #define OPAL_PartBunch_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: PartBunch.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class PartBunch
13 //
14 // ------------------------------------------------------------------------
15 // Class category: Algorithms
16 // ------------------------------------------------------------------------
17 //
18 // $Date: 2000/03/27 09:32:33 $
19 // $Author: Andreas Adelmann and Co. $
20 //
21 // ------------------------------------------------------------------------
22 
24 
25 // Class PartBunch.
26 // ------------------------------------------------------------------------
28 // A representation of a particle bunch as a vector of particles.
29 
30 class PartBunch: public PartBunchBase<double, 3> {
31 
32 public:
34  enum { Dim = Dimension };
35 
36 public:
37 
39  // Construct empty bunch.
40  explicit PartBunch(const PartData *ref);
41 
42  PartBunch() = delete;
43  PartBunch(const PartBunch &) = delete;
44  PartBunch &operator=(const PartBunch &) = delete;
45 
46  ~PartBunch();
47 
48 // pbase_t* clone();
49 
50  void runTests();
51 
52  void initialize(FieldLayout_t *fLayout);
53 
54  void do_binaryRepart();
55 
56  double getRho(int x, int y, int z);
57 
58  /*
59 
60  Mesh and Field Layout related functions
61 
62  */
63 
64  // MATTHIAS CHECK
65  const Mesh_t &getMesh() const;
66 
67 // void setMesh(Mesh_t* mesh);
68 
69  // MATTHIAS CHECK
70  Mesh_t &getMesh();
71 
72 // void setFieldLayout(FieldLayout_t* fLayout);
73 
74  // MATTHIAS CHECK
76 
77  void setBCAllPeriodic();
78  void setBCAllOpen();
79 
80  void setBCForDCBeam();
81 
82  /*
83  Compatibility function push_back
84 
85  */
86 
88 
89  void computeSelfFields();
90 
92  void computeSelfFields(int b);
93 
94  void computeSelfFields_cycl(double gamma);
95  void computeSelfFields_cycl(int b);
96 
97  void resetInterpolationCache(bool clearCache = false);
98 
99  void swap(unsigned int i, unsigned int j);
100 
103 
106 
107  Inform &print(Inform &os);
108 
109 private:
110 
112 
113  void updateFields(const Vector_t& hr, const Vector_t& origin);
114 
116  void resizeMesh();
117 
121 
122 
124 
126 
127  //FIXME
129  return pbase->getLayout();
130  }
131 
132  //FIXME
134  return pbase->getLayout();
135  }
136 };
137 
138 
139 
140 inline
141 double PartBunch::getRho(int x, int y, int z) {
142  return rho_m[x][y][z].get();
143 }
144 
145 inline
146 const Mesh_t &PartBunch::getMesh() const {
147  const Layout_t* layout = static_cast<const Layout_t*>(&getLayout());
148  return layout->getLayout().getMesh();
149 }
150 
151 inline
153  Layout_t* layout = static_cast<Layout_t*>(&getLayout());
154  return layout->getLayout().getMesh();
155 }
156 
157 // inline
158 
159 inline Inform &operator<<(Inform &os, PartBunch &p) {
160  return p.print(os);
161 }
162 
163 #endif // OPAL_PartBunch_HH
void setBCForDCBeam()
Definition: PartBunch.cpp:1060
void setBCAllPeriodic()
Definition: PartBunch.cpp:1031
std::ostream & operator<<(std::ostream &os, const Attribute &attr)
Definition: Attribute.cpp:167
RegionLayout< T, Dim, Mesh > & getLayout()
void computeSelfFields()
Definition: PartBunch.cpp:463
void swap(unsigned int i, unsigned int j)
Definition: PartBunch.cpp:1156
Inform & print(Inform &os)
Definition: PartBunch.cpp:1166
Particle reference data.
Definition: PartData.h:38
ParticleLayout< double, 3 > & getLayout()
Definition: PartBunch.h:128
ParticleAttrib< CacheDataCIC< double, 3U > > interpolationCache_m
Definition: PartBunch.h:125
Definition: BCond.h:34
BConds< Vector_t, 3, Mesh_t, Center_t > vbc_m
Definition: PartBunch.h:120
std::shared_ptr< AbstractParticle< double, Dim > > pbase
std::pair< Vector_t, Vector_t > VectorPair_t
Definition: PartBunchBase.h:37
Class: DataSink.
Definition: OpalData.h:29
Field_t rho_m
scalar potential
Definition: PartBunch.h:102
void runTests()
Definition: PartBunch.cpp:76
void updateDomainLength(Vektor< int, 3 > &grid)
Definition: PartBunch.cpp:1083
bool interpolationCacheSet_m
Definition: PartBunch.h:123
IpplParticleBase< Layout_t > pbase_t
Definition: PartBunch.h:33
PartBunch & operator=(const PartBunch &)=delete
double getRho(int x, int y, int z)
Definition: PartBunch.h:141
VectorPair_t getEExtrema()
Definition: PartBunch.cpp:1139
void do_binaryRepart()
Definition: PartBunch.cpp:106
void initialize(FieldLayout_t *fLayout)
Definition: PartBunch.cpp:71
VField_t eg_m
vector field on the grid
Definition: PartBunch.h:105
const Mesh_t & getMesh() const
Definition: PartBunch.h:146
static const unsigned Dimension
Definition: PartBunchBase.h:39
void setBCAllOpen()
Definition: PartBunch.cpp:1050
Particle Bunch.
Definition: PartBunch.h:30
const ParticleLayout< double, 3 > & getLayout() const
Definition: PartBunch.h:133
MeshType & getMesh()
Definition: RegionLayout.h:141
void resizeMesh()
resize mesh to geometry specified
Definition: PartBunch.cpp:413
void updateFields(const Vector_t &hr, const Vector_t &origin)
Definition: PartBunch.cpp:1090
void resetInterpolationCache(bool clearCache=false)
Definition: PartBunch.cpp:1149
Definition: Inform.h:41
BConds< double, 3, Mesh_t, Center_t > bc_m
for defining the boundary conditions
Definition: PartBunch.h:119
PartBunch()=delete
void computeSelfFields_cycl(double gamma)
Calculates the self electric field from the charge density distribution for use in cyclotrons...
Definition: PartBunch.cpp:643
FieldLayout_t & getFieldLayout()
Definition: PartBunch.cpp:1026