OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
PartData.h
Go to the documentation of this file.
1#ifndef OPALX_PartData_HH
2#define OPALX_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 {
38public:
40 // Inputs are:
41 // [DL]
42 // [DT]charge[DD]The charge per particle in proton charges.
43 // [DT]mass[DD]The particle mass in eV.
44 // [DT]momentum[DD]The reference momentum per particle in eV.
45 // [/DL]
46 PartData(double charge, double mass, double momentum);
47
48 PartData();
49
51 KOKKOS_INLINE_FUNCTION double getQ() const;
52
54 KOKKOS_INLINE_FUNCTION double getM() const;
55
57 double getP() const;
58
60 double getE() const;
61
63 double getBeta() const;
64
66 double getGamma() const;
67
69 // Input is the momentum in eV.
70 void setP(double p);
71
73 // Input is the energy in eV.
74 void setE(double E);
75
77 // Input is the relativistic beta = v/c.
78 void setBeta(double beta);
79
81 // Input is the relativistic gamma = E/(m*c*c).
82 void setGamma(double gamma);
83
85 inline void setM(double m) { mass = m; }
86
88 inline void setQ(double q) { charge = q; }
89
92 inline double getAnomaly() const { return anomaly; }
93 inline void setAnomaly(double a) { anomaly = a; }
94
95protected:
96 // The reference information.
97 double charge; // Particle charge.
98 double mass; // Particle mass.
99 double beta; // particle velocity divided by c.
100 double gamma; // particle energy divided by particle mass
101 double anomaly = 0.0; // Magnetic moment anomaly G = (g-2)/2.
102};
103
104// Inline functions.
105// ------------------------------------------------------------------------
106
107KOKKOS_INLINE_FUNCTION double PartData::getQ() const { return charge; }
108
109KOKKOS_INLINE_FUNCTION double PartData::getM() const { return mass; }
110
111inline double PartData::getP() const { return beta * gamma * mass; }
112
113inline double PartData::getE() const { return gamma * mass; }
114
115inline double PartData::getBeta() const { return beta; }
116
117inline double PartData::getGamma() const { return gamma; }
118
119#endif // OPALX_PartData_HH
Particle reference data.
Definition PartData.h:37
double mass
Definition PartData.h:98
double getAnomaly() const
Definition PartData.h:92
double getBeta() const
The relativistic beta per particle.
Definition PartData.h:115
double getGamma() const
The relativistic gamma per particle.
Definition PartData.h:117
void setM(double m)
Set reference mass expressed in eV/c^2.
Definition PartData.h:85
void setGamma(double gamma)
Set gamma.
Definition PartData.cpp:75
double charge
Definition PartData.h:97
double getP() const
The constant reference momentum per particle.
Definition PartData.h:111
double gamma
Definition PartData.h:100
KOKKOS_INLINE_FUNCTION double getM() const
The constant mass per particle.
Definition PartData.h:109
void setP(double p)
Set reference momentum.
Definition PartData.cpp:41
void setE(double E)
Set reference energy.
Definition PartData.cpp:55
void setAnomaly(double a)
Definition PartData.h:93
void setQ(double q)
Set reference charge expressed in proton charges,.
Definition PartData.h:88
double beta
Definition PartData.h:99
double anomaly
Definition PartData.h:101
void setBeta(double beta)
Set beta.
Definition PartData.cpp:66
double getE() const
The constant reference Energy per particle.
Definition PartData.h:113
KOKKOS_INLINE_FUNCTION double getQ() const
The constant charge per particle.
Definition PartData.h:107