OPALX (Object Oriented Parallel Accelerator Library for Exascal) 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
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
96 Inform& print(Inform& os);
97
98private:
99 void updateDomainLength(Vektor<int, 3>& grid);
100
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
141inline Inform& operator<<(Inform& os, PartBunch& p) {
142 return p.print(os);
143}
144
145#endif // OPAL_PartBunch_HH
Inform & operator<<(Inform &os, PartBunch &p)
Definition .PartBunch.h:141
PartBunch< PLayout_t< double, 3 >, double, 3 > PartBunch_t
Cell Center_t
Definition PBunchDefs.h:23
ippl::FieldLayout< Dim > FieldLayout_t
Definition PBunchDefs.h:27
ippl::Field< double, Dim, ViewArgs... > Field_t
Definition PBunchDefs.h:30
ippl::ParticleSpatialLayout< double, 3, Mesh_t > Layout_t
Definition PBunchDefs.h:21
ippl::Field< ippl::Vector< T, Dim >, Dim, ViewArgs... > VField_t
Definition PBunchDefs.h:33
ippl::UniformCartesian< double, 3 > Mesh_t
Definition PBunchDefs.h:19
ippl::Vector< T, Dim > Vector_t
ippl::ParticleAttrib< T > ParticleAttrib
void do_binaryRepart()
ParticleLayout< double, 3 > & getLayout()
Definition .PartBunch.h:115
PartBunch(const PartData *ref)
Default constructor.
const Mesh_t & getMesh() const
VectorPair_t getEExtrema()
std::pair< Vector_t< double, 3 >, Vector_t< double, 3 > > VectorPair_t
PartBunch & operator=(const PartBunch &)=delete
void updateFields(const Vector_t< double, 3 > &hr, const Vector_t< double, 3 > &origin)
PartBunch(const PartBunch &)=delete
void runTests()
IpplParticleBase< Layout_t > pbase_t
Definition .PartBunch.h:26
const ParticleLayout< double, 3 > & getLayout() const
Definition .PartBunch.h:120
void computeSelfFields()
double getRho(int x, int y, int z)
void updateDomainLength(Vektor< int, 3 > &grid)
void initialize(FieldLayout_t *fLayout)
void setBCForDCBeam()
Inform & print(Inform &os)
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
Definition .PartBunch.h:107
BConds< Vector_t< double, 3 >, 3, Mesh_t, Center_t > vbc_m
Definition .PartBunch.h:108
Mesh_t & getMesh()
Definition .PartBunch.h:134
PartBunch(PLayout_t< double, 3 > &pl, Vector_t< double, Dim > hr, Vector_t< double, Dim > rmin, Vector_t< double, Dim > rmax, std::array< bool, Dim > decomp, double Qtot)
ParticleAttrib< CacheDataCIC< double, 3U > > interpolationCache_m
Definition .PartBunch.h:112
void setBCAllOpen()
Inform & print(Inform &os)
FieldLayout_t & getFieldLayout()
void setBCAllPeriodic()
void computeSelfFields(int b)
void resetInterpolationCache(bool clearCache=false)
Particle reference data.
Definition PartData.h:37