OPALX (Object Oriented Parallel Accelerator Library for Exascale) MINIorX
OPALX
.PartBunch.h
Go to the documentation of this file.
1//
2// Class PartBunch
3// Particle Bunch.
4// A representation of a particle bunch as a vector of particles.
5//
6// Copyright (c) 2008 - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
7// All rights reserved
8//
9// This file is part of OPAL.
10//
11// OPAL is free software: you can redistribute it and/or modify
12// it under the terms of the GNU General Public License as published by
13// the Free Software Foundation, either version 3 of the License, or
14// (at your option) any later version.
15//
16// You should have received a copy of the GNU General Public License
17// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
18//
19#ifndef OPAL_PartBunch_HH
20#define OPAL_PartBunch_HH
21
22#include "Algorithms/PartBunch.h"
23
24class PartBunch : public PartBunch_t {
25public:
26 typedef IpplParticleBase<Layout_t> pbase_t;
27 enum { Dim = Dimension };
28
29public:
31 // Construct empty bunch.
32 explicit PartBunch(const PartData* ref);
33
34 PartBunch() = delete;
35 PartBunch(const PartBunch&) = delete;
36 PartBunch& operator=(const PartBunch&) = delete;
37
39
40 // pbase_t* clone();
41
42 void runTests();
43
44 void initialize(FieldLayout_t* fLayout);
45
47
48 double getRho(int x, int y, int z);
49
50 /*
51
52 Mesh and Field Layout related functions
53
54 */
55
56 // MATTHIAS CHECK
57 const Mesh_t& getMesh() const;
58
59 // void setMesh(Mesh_t* mesh);
60
61 // MATTHIAS CHECK
62 Mesh_t& getMesh();
63
64 // void setFieldLayout(FieldLayout_t* fLayout);
65
66 // MATTHIAS CHECK
68
71
73
74 /*
75 Compatibility function push_back
76
77 */
78
80
82
84 void computeSelfFields(int b);
85
86 void resetInterpolationCache(bool clearCache = false);
87
88 void swap(unsigned int i, unsigned int j);
89
92
95
97
98private:
99 void updateDomainLength(Vektor<int, 3>& grid);
100
101 void updateFields(const Vector_t<double, 3>& hr, const Vector_t<double, 3>& origin);
102
105
107 BConds<double, 3, Mesh_t, Center_t> bc_m;
108 BConds<Vector_t<double, 3>, 3, Mesh_t, Center_t> vbc_m;
109
111
113
114 // FIXME
115 ParticleLayout<double, 3>& getLayout() {
116 return pbase_m->getLayout();
117 }
118
119 // FIXME
120 const ParticleLayout<double, 3>& getLayout() const {
121 return pbase_m->getLayout();
122 }
123};
124
125inline double PartBunch::getRho(int x, int y, int z) {
126 return rho_m[x][y][z].get();
127}
128
129inline const Mesh_t& PartBunch::getMesh() const {
130 const Layout_t* layout = static_cast<const Layout_t*>(&getLayout());
131 return layout->getLayout().getMesh();
132}
133
135 Layout_t* layout = static_cast<Layout_t*>(&getLayout());
136 return layout->getLayout().getMesh();
137}
138
139// inline
140
142 return p.print(os);
143}
144
145#endif // OPAL_PartBunch_HH
Inform & operator<<(Inform &os, PartBunch &p)
Definition: .PartBunch.h:141
ippl::UniformCartesian< double, 3 > Mesh_t
Definition: PBunchDefs.h:19
void updateDomainLength(Vector_t< int, 3 > &grid)
void updateFields(const Vector_t< T, Dim > &, const Vector_t< T, Dim > &origin)
void do_binaryRepart()
ParticleLayout< double, 3 > & getLayout()
Definition: .PartBunch.h:115
const Mesh_t & getMesh() const
VectorPair_t getEExtrema()
std::pair< Vector_t< double, 3 >, Vector_t< double, 3 > > VectorPair_t
static const unsigned Dimension
PartBunch & operator=(const PartBunch &)=delete
PartBunch(const PartBunch &)=delete
void runTests()
Field_t< Dim > rho_m
IpplParticleBase< Layout_t > pbase_t
Definition: .PartBunch.h:26
const ParticleLayout< double, 3 > & getLayout() const
Definition: .PartBunch.h:120
void computeSelfFields()
VField_t eg_m
vector field on the grid
Definition: .PartBunch.h:94
Field_t rho_m
scalar potential
Definition: .PartBunch.h:91
double getRho(int x, int y, int z)
void setBCForDCBeam()
Inform & print(Inform &os)
bool interpolationCacheSet_m
Definition: .PartBunch.h:110
PartBunch()=delete
void swap(unsigned int i, unsigned int j)
void resizeMesh()
resize mesh to geometry specified
BConds< double, 3, Mesh_t, Center_t > bc_m
for defining the boundary conditions
Definition: .PartBunch.h:107
BConds< Vector_t< double, 3 >, 3, Mesh_t, Center_t > vbc_m
Definition: .PartBunch.h:108
ParticleAttrib< CacheDataCIC< double, 3U > > interpolationCache_m
Definition: .PartBunch.h:112
void initialize(FieldLayout_t< Dim > &fl, Mesh_t< Dim > &mesh)
void setBCAllOpen()
Inform & print(Inform &os)
FieldLayout_t & getFieldLayout()
void setBCAllPeriodic()
void computeSelfFields(int b)
/brief used for self fields with binned distribution
void resetInterpolationCache(bool clearCache=false)
Particle reference data.
Definition: PartData.h:37
Definition: Centering.h:30
Definition: Inform.h:40