OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
ParticleContainer.hpp
Go to the documentation of this file.
1
2#ifndef OPAL_PARTICLE_CONTAINER_H
3#define OPAL_PARTICLE_CONTAINER_H
4
5#include <memory>
6
7#include "Manager/BaseManager.h"
8
10
11template <typename T>
12using ParticleAttrib = ippl::ParticleAttrib<T>;
13
14using size_type = ippl::detail::size_type;
15
16// Define the ParticlesContainer class
17template <typename T, unsigned Dim = 3>
18class ParticleContainer : public ippl::ParticleBase<ippl::ParticleSpatialLayout<T, Dim>> {
19 using Base = ippl::ParticleBase<ippl::ParticleSpatialLayout<T, Dim>>;
20
21public:
23 using bin_index_type = short int; // Needed in AdaptBins class
24
25public:
27 ippl::ParticleAttrib<double> Q;
28
30 ippl::ParticleAttrib<double> M;
31
33 ippl::ParticleAttrib<double> dt;
34
36 ippl::ParticleAttrib<double> Phi;
37
39 ippl::ParticleAttrib<bin_index_type> Bin;
40
42 ippl::ParticleAttrib<short> Sp;
43
45 typename Base::particle_position_type P;
46
48 typename Base::particle_position_type E;
49
51 //typename Base::particle_position_type Etmp; // TODO: might not need this...
52
54 typename Base::particle_position_type B;
55
57 this->initialize(pl_m);
59 setupBCs();
60 }
61
64
66 // register the particle attributes
67 this->addAttribute(Q);
68 this->addAttribute(M);
69 this->addAttribute(dt);
70 this->addAttribute(Phi);
71 this->addAttribute(Bin);
72 this->addAttribute(Sp);
73 this->addAttribute(P);
74 this->addAttribute(E);
75 //this->addAttribute(Etmp);
76 this->addAttribute(B);
77 }
78
79 void setupBCs() {
81 }
82
84 return pl_m;
85 }
86
88 size_t Np = this->getTotalNum();
89 Np = (Np == 0) ? 1 : Np; // only used for normalization in the moments class --> avoid division by zero
90
91 size_t Nlocal = this->getLocalNum();
92 distMoments_m.computeMoments(this->R.getView(), this->P.getView(), this->M.getView(), Np, Nlocal);
93 }
94
96 return distMoments_m.getMeanMomentum();
97 }
98
100 return distMoments_m.getStandardDeviationMomentum();
101 }
102
104 return distMoments_m.getMeanPosition();
105 }
106
108 return distMoments_m.getStandardDeviationPosition();
109 }
110
112 return distMoments_m.getStandardDeviationRP();
113 }
114
116 size_t Nlocal = this->getLocalNum();
117 distMoments_m.computeMinMaxPosition(this->R.getView(), Nlocal);
118 }
119
121 return distMoments_m.getMinPosition();
122 }
123
125 return distMoments_m.getMaxPosition();
126 }
127
129 return distMoments_m.getMoments6x6();
130 }
131
132 double getMeanKineticEnergy() const {
133 return distMoments_m.getMeanKineticEnergy();
134 }
135
136 double getStdKineticEnergy() const {
137 return distMoments_m.getStdKineticEnergy();
138 }
139
141 return distMoments_m.getMeans();
142 }
143
145 return distMoments_m.getCentroid();
146 }
147
149 return distMoments_m.getNormalizedEmittance();
150 }
151
152 double getDx() const {
153 return distMoments_m.getDx();
154 }
155
156 double getDDx() const {
157 return distMoments_m.getDDx();
158 }
159
160 double getDy() const {
161 return distMoments_m.getDy();
162 }
163
164 double getDDy() const {
165 return distMoments_m.getDDy();
166 }
167
168 double getDebyeLength() const {
169 return distMoments_m.getDebyeLength();
170 }
171
172 double getMeanGammaZ() const {
173 return distMoments_m.getMeanGammaZ();
174 }
175
176 double getTemperature() const {
177 return distMoments_m.getTemperature();
178 }
179
180 double getPlasmaParameter() const {
181 return distMoments_m.getPlasmaParameter();
182 }
183
184 double computeDebyeLength(double density){
185 size_t Np = this->getTotalNum();
186 Np = (Np == 0) ? 1 : Np; // only used for normalization in the moments class --> avoid division by zero
187
188 size_t Nlocal = this->getLocalNum();
189 distMoments_m.computeDebyeLength(this->R.getView(), this->P.getView(), Np, Nlocal, density);
190 return distMoments_m.getDebyeLength();
191 }
192
193private:
195 this->setParticleBC(ippl::BC::PERIODIC);
196 }
197
199
201};
202
203#endif
ippl::FieldLayout< Dim > FieldLayout_t
Definition PBunchDefs.h:27
ippl::UniformCartesian< double, 3 > Mesh_t
Definition PBunchDefs.h:19
boost::numeric::ublas::matrix< double > matrix_t
Definition BoostMatrix.h:23
ippl::Vector< T, Dim > Vector_t
typename ippl::ParticleSpatialLayout< T, Dim, Mesh_t< Dim > > PLayout_t
ippl::detail::size_type size_type
ippl::ParticleAttrib< T > ParticleAttrib
Vector_t< double, 3 > getMeanP() const
Vector_t< double, 6 > getMeans() const
Vector_t< double, 3 > getMaxR() const
ippl::ParticleAttrib< double > M
double getMeanGammaZ() const
ippl::ParticleAttrib< double > dt
double getPlasmaParameter() const
ippl::ParticleAttrib< double > Phi
Vector_t< double, 3 > getRmsP() const
Vector_t< double, 3 > getMinR() const
Vector_t< double, 3 > getRmsRP() const
Base::particle_position_type B
ippl::ParticleAttrib< double > Q
double computeDebyeLength(double density)
Vector_t< double, 6 > getCentroid() const
Vector_t< double, 3 > getNormEmit() const
matrix_t getCovMatrix() const
double getMeanKineticEnergy() const
ippl::ParticleAttrib< bin_index_type > Bin
Vector_t< double, 3 > getMeanR() const
Vector_t< double, 3 > getRmsR() const
ippl::ParticleBase< ippl::ParticleSpatialLayout< double, Dim > > Base
Base::particle_position_type E
Base::particle_position_type P
double getTemperature() const
double getStdKineticEnergy() const
ippl::ParticleAttrib< short > Sp
ParticleContainer(Mesh_t< Dim > &mesh, FieldLayout_t< Dim > &FL)
double getDebyeLength() const
PLayout_t< T, Dim > & getPL()