OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
EMField.h
Go to the documentation of this file.
1#ifndef OPALX_EMField_HH
2#define OPALX_EMField_HH
3
4// ------------------------------------------------------------------------
5// $RCSfile: EMField.h,v $
6// ------------------------------------------------------------------------
7// $Revision: 1.1.1.1 $
8// ------------------------------------------------------------------------
9// Copyright: see Copyright.readme
10// ------------------------------------------------------------------------
11//
12// Classes:
13// Point3D: a point in 3-dimensional space.
14// EVector: an electric field vector.
15// BVector: a magnetic field vector.
16// EBVectors: an electromagnetic field, containing E and B.
17// EMField: a virtual base class for electromagnetic fields.
18//
19// ------------------------------------------------------------------------
20// Class category: Fields
21// ------------------------------------------------------------------------
22//
23// $Date: 2000/03/27 09:32:36 $
24// $Author: fci $
25//
26// ------------------------------------------------------------------------
27
28// Class Point3D
29// ------------------------------------------------------------------------
31
32class Point3D {
33public:
35 // Construct the point from its coordinates (x,y,z) in m.
36 Point3D(double x, double y, double z);
37
39 // Return the x-coordinate for the point in m.
40 double getX() const;
41
43 // Return the y-coordinate for the point in m.
44 double getY() const;
45
47 // Return the z-coordinate for the point in m.
48 double getZ() const;
49
50private:
51 double x, y, z;
52};
53
54// Class EVector
55// ------------------------------------------------------------------------
57
58class EVector {
59public:
61 // Construct the field vector from is components (Ex,Ey,Ez) in A/m.
62 EVector(double, double, double);
63
65 // Multiply the field vector by [b]scalar[/b].
66 EVector operator*(double scalar) const;
67
69 // Return the x-component of the field in A/m.
70 double getEx() const;
71
73 // Return the y-component of the field in A/m.
74 double getEy() const;
75
77 // Return the z-component of the field in A/m.
78 double getEz() const;
79
80private:
81 double Ex, Ey, Ez;
82};
83
84// Class BVector
85// ------------------------------------------------------------------------
87
88class BVector {
89public:
91 // Construct the field vector from its components (Bx,By,Bz) in T.
92 BVector(double, double, double);
93
95 // Multiply the field vector by [b]scalar[/b].
96 BVector operator*(double scalar) const;
97
99 // Return the x-component of the field in T.
100 double getBx() const;
101
103 // Return the y-component of the field in T.
104 double getBy() const;
105
107 // Return the z-component of the field in T.
108 double getBz() const;
109
110private:
111 double Bx, By, Bz;
112};
113
114// Class EBVectors
115// ------------------------------------------------------------------------
117// Contains both an electric and a magnetic field vector.
118// These represent the instantaneous electromagnetic field in a given point.
119
121public:
123 // Construct the field from the two field vectors [b]E[/b] (in A/m)
124 // and [b]B[/b] (in T).
125 EBVectors(const EVector& E, const BVector& B);
126
128 // Return the electric field vector in A/m.
129 EVector getE() const;
130
132 // Return the x-component of the electric field in A/m.
133 double getEx() const;
134
136 // Return the y-component of the electric field in A/m.
137 double getEy() const;
138
140 // Return the z-component of the electric field in A/m.
141 double getEz() const;
142
144 // Return the magnetic field vector in T.
145 BVector getB() const;
146
148 // Return the x-component of the magnetic field in T.
149 double getBx() const;
150
152 // Return the y-component of the magnetic field in T.
153 double getBy() const;
154
156 // Return the z-component of the magnetic field in T.
157 double getBz() const;
158
159private:
162};
163
164// Class EMField
165// ------------------------------------------------------------------------
167// This class represent a time-varying position dependent electromagnetic
168// field. Derived classes include time-constant fields as well as
169// spatially homogeneous fields.
170
171class EMField {
172public:
174 // Construct zero field.
175 EMField();
176
177 EMField(const EMField& right);
178 virtual ~EMField();
179 const EMField& operator=(const EMField& right);
180
182 // Return the time-independent part of the electric field in point [b]P[/b].
183 // This default action returns a zero field.
184 virtual EVector Efield(const Point3D& P) const;
185
187 // Return the time-independent part of the magnetic field in point [b]P[/b].
188 // This default action returns a zero field.
189 virtual BVector Bfield(const Point3D& P) const;
190
192 // Return the electric field at time [b]t[/b] in point [b]P[/b].
193 // This default action returns the static part EField(P).
194 virtual EVector Efield(const Point3D& P, double t) const;
195
197 // Return the magnetic field at time [b]t[/b] in point [b]P[/b].
198 // This default action returns the static part BField(P).
199 virtual BVector Bfield(const Point3D& P, double t) const;
200
202 // Return the static part of the field pair (E,B) in point [b]P[/b].
203 // This default action returns EBVectors(EField(P), BField(P)).
204 virtual EBVectors EBfield(const Point3D& P) const;
205
207 // Return the field pair (E,B) at time [b]t[/b] in point [b]P[/b].
208 // This default action returns the static part EBfield(P).
209 virtual EBVectors EBfield(const Point3D& P, double t) const;
210
212 // Multiply the field by [b]scalar[/b].
213 // This method must be defined for each derived class.
214 virtual void scale(double scalar) = 0;
215
217 static const EVector ZeroEfield;
218
220 static const BVector ZeroBfield;
221
223 static const EBVectors ZeroEBfield;
224};
225
226#endif // OPALX_EMField_HH
A magnetic field vector.
Definition EMField.h:88
BVector operator*(double scalar) const
Scale.
Definition EMField.cpp:70
double getBz() const
Get component.
Definition EMField.cpp:78
double Bx
Definition EMField.h:111
double getBy() const
Get component.
Definition EMField.cpp:76
double getBx() const
Get component.
Definition EMField.cpp:74
double Bz
Definition EMField.h:111
double By
Definition EMField.h:111
A representation of an electromagnetic field.
Definition EMField.h:120
double getEz() const
Get component.
Definition EMField.cpp:91
EVector E
Definition EMField.h:160
double getBz() const
Get component.
Definition EMField.cpp:99
double getEx() const
Get component.
Definition EMField.cpp:87
double getBy() const
Get component.
Definition EMField.cpp:97
BVector getB() const
Get field.
Definition EMField.cpp:93
double getBx() const
Get component.
Definition EMField.cpp:95
BVector B
Definition EMField.h:161
EVector getE() const
Get component.
Definition EMField.cpp:85
double getEy() const
Get component.
Definition EMField.cpp:89
Abstract base class for electromagnetic fields.
Definition EMField.h:171
EMField()
Default constructor.
Definition EMField.cpp:111
const EMField & operator=(const EMField &right)
Definition EMField.cpp:117
static const BVector ZeroBfield
The constant representing a zero magnetic field.
Definition EMField.h:220
static const EVector ZeroEfield
The constant representing a zero electric field.
Definition EMField.h:217
virtual BVector Bfield(const Point3D &P) const
Get field.
Definition EMField.cpp:121
virtual ~EMField()
Definition EMField.cpp:115
virtual void scale(double scalar)=0
Scale the field.
static const EBVectors ZeroEBfield
The constant representing a zero electromagnetic field.
Definition EMField.h:223
virtual EVector Efield(const Point3D &P) const
Get field.
Definition EMField.cpp:119
virtual EBVectors EBfield(const Point3D &P) const
Get field.
Definition EMField.cpp:127
An electric field vector.
Definition EMField.h:58
double Ex
Definition EMField.h:81
double Ez
Definition EMField.h:81
EVector operator*(double scalar) const
Scale.
Definition EMField.cpp:51
double getEz() const
Get component.
Definition EMField.cpp:59
double getEx() const
Get component.
Definition EMField.cpp:55
double getEy() const
Get component.
Definition EMField.cpp:57
double Ey
Definition EMField.h:81
A point in 3 dimensions.
Definition EMField.h:32
double getZ() const
Return coordinate.
Definition EMField.cpp:40
double getX() const
Return coordinate.
Definition EMField.cpp:36
double z
Definition EMField.h:51
double y
Definition EMField.h:51
double x
Definition EMField.h:51
double getY() const
Return coordinate.
Definition EMField.cpp:38