OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
PartData.h
Go to the documentation of this file.
1#ifndef MAD_PartData_HH
2#define MAD_PartData_HH
3
4// ------------------------------------------------------------------------
5// $RCSfile: PartData.h,v $
6// ------------------------------------------------------------------------
7// $Revision: 1.1.1.1 $
8// ------------------------------------------------------------------------
9// Copyright: see Copyright.readme
10// ------------------------------------------------------------------------
11// Description:
12//
13// ------------------------------------------------------------------------
14// Class category: Algorithms
15// ------------------------------------------------------------------------
16//
17// $Date: 2000/03/27 09:32:33 $
18// $Author: fci $
19//
20// ------------------------------------------------------------------------
21
22// Class PartData
23// ------------------------------------------------------------------------
25// This class encapsulates the reference data for a beam:
26// [UL]
27// [LI]charge per particle expressed in proton charges,
28// [LI]mass per particle expressed in eV,
29// [LI]reference momentum per particle expressed in eV.
30// [/UL]
31// The copy constructor, destructor, and assignment operator generated
32// by the compiler perform the correct operation. For speed reasons
33// they are not implemented.
34
35#include <Kokkos_Core.hpp>
36
37class PartData {
38
39public:
40
42 // Inputs are:
43 // [DL]
44 // [DT]charge[DD]The charge per particle in proton charges.
45 // [DT]mass[DD]The particle mass in eV.
46 // [DT]momentum[DD]The reference momentum per particle in eV.
47 // [/DL]
48 PartData(double charge, double mass, double momentum);
49
50 PartData();
51
53 KOKKOS_INLINE_FUNCTION double getQ() const;
54
56 KOKKOS_INLINE_FUNCTION double getM() const;
57
59 double getP() const;
60
62 double getE() const;
63
65 double getBeta() const;
66
68 double getGamma() const;
69
71 // Input is the momentum in eV.
72 void setP(double p);
73
75 // Input is the energy in eV.
76 void setE(double E);
77
79 // Input is the relativistic beta = v/c.
80 void setBeta(double beta);
81
83 // Input is the relativistic gamma = E/(m*c*c).
84 void setGamma(double gamma);
85
86
88 inline void setM(double m){mass = m;}
89
91 inline void setQ(double q) {charge = q;}
92
93protected:
94
95 // The reference information.
96 double charge; // Particle charge.
97 double mass; // Particle mass.
98 double beta; // particle velocity divided by c.
99 double gamma; // particle energy divided by particle mass
100};
101
102
103// Inline functions.
104// ------------------------------------------------------------------------
105
106KOKKOS_INLINE_FUNCTION double PartData::getQ() const {
107 return charge;
108}
109
110
111KOKKOS_INLINE_FUNCTION double PartData::getM() const {
112 return mass;
113}
114
115
116inline double PartData::getP() const {
117 return beta * gamma * mass;
118}
119
120
121inline double PartData::getE() const {
122 return gamma * mass;
123}
124
125
126inline double PartData::getBeta() const {
127 return beta;
128}
129
130
131inline double PartData::getGamma() const {
132 return gamma;
133}
134
135#endif // MAD_PartData_HH
double mass
Definition PartData.h:97
PartData(double charge, double mass, double momentum)
Constructor.
Definition PartData.cpp:29
double getBeta() const
The relativistic beta per particle.
Definition PartData.h:126
double getGamma() const
The relativistic gamma per particle.
Definition PartData.h:131
void setM(double m)
Set reference mass expressed in eV/c^2.
Definition PartData.h:88
void setGamma(double gamma)
Set gamma.
Definition PartData.cpp:83
double charge
Definition PartData.h:96
double getP() const
The constant reference momentum per particle.
Definition PartData.h:116
double gamma
Definition PartData.h:99
KOKKOS_INLINE_FUNCTION double getM() const
The constant mass per particle.
Definition PartData.h:111
void setP(double p)
Set reference momentum.
Definition PartData.cpp:44
void setE(double E)
Set reference energy.
Definition PartData.cpp:61
void setQ(double q)
Set reference charge expressed in proton charges,.
Definition PartData.h:91
double beta
Definition PartData.h:98
void setBeta(double beta)
Set beta.
Definition PartData.cpp:73
double getE() const
The constant reference Energy per particle.
Definition PartData.h:121
KOKKOS_INLINE_FUNCTION double getQ() const
The constant charge per particle.
Definition PartData.h:106