OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
EMField.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: EMField.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Classes:
10 // Point3D: a point in 3-dimensional space.
11 // EVector: an electric field vector.
12 // BVector: a magnetic field vector.
13 // EBVectors: an electromagnetic field, containing E and B.
14 // EMField: a virtual base class for electromagnetic fields.
15 //
16 // ------------------------------------------------------------------------
17 // Class category: Fields
18 // ------------------------------------------------------------------------
19 //
20 // $Date: 2000/03/27 09:32:35 $
21 // $Author: fci $
22 //
23 // ------------------------------------------------------------------------
24 
25 #include "Fields/EMField.h"
26 
27 
28 // Class Point3D
29 // ------------------------------------------------------------------------
30 
31 Point3D::Point3D(double xx, double yy, double zz)
32 { x = xx; y = yy; z = zz; }
33 
34 double Point3D::getX() const
35 { return x; }
36 
37 double Point3D::getY() const
38 { return y; }
39 
40 double Point3D::getZ() const
41 { return z; }
42 
43 
44 // Class EVector
45 // ------------------------------------------------------------------------
46 
47 EVector::EVector(double Exx, double Eyy, double Ezz)
48 { Ex = Exx; Ey = Eyy; Ez = Ezz; }
49 
50 
51 EVector EVector::operator*(double scale) const
52 { return EVector(scale * Ex, scale * Ey, scale * Ez); }
53 
54 
55 double EVector::getEx() const
56 { return Ex; }
57 
58 
59 double EVector::getEy() const
60 { return Ey; }
61 
62 
63 double EVector::getEz() const
64 { return Ez; }
65 
66 
67 // Class BVector
68 // ------------------------------------------------------------------------
69 
70 BVector::BVector(double Bxx, double Byy, double Bzz)
71 { Bx = Bxx; By = Byy; Bz = Bzz; }
72 
73 
74 BVector BVector::operator*(double scale) const
75 { return BVector(scale * Bx, scale * By, scale * Bz); }
76 
77 
78 double BVector::getBx() const
79 { return Bx; }
80 
81 
82 double BVector::getBy() const
83 { return By; }
84 
85 
86 double BVector::getBz() const
87 { return Bz; }
88 
89 
90 // Class EBVectors
91 // ------------------------------------------------------------------------
92 
93 EBVectors::EBVectors(const EVector &eField, const BVector &bField):
94  E(eField), B(bField)
95 {}
96 
97 
99 { return E; }
100 
101 
102 double EBVectors::getEx() const
103 { return E.getEx(); }
104 
105 
106 double EBVectors::getEy() const
107 { return E.getEy(); }
108 
109 
110 double EBVectors::getEz() const
111 { return E.getEz(); }
112 
113 
115 { return B; }
116 
117 
118 double EBVectors::getBx() const
119 { return B.getBx(); }
120 
121 
122 double EBVectors::getBy() const
123 { return B.getBy(); }
124 
125 
126 double EBVectors::getBz() const
127 { return B.getBy(); }
128 
129 
130 // Class EMField
131 // ------------------------------------------------------------------------
132 
133 // Zero field representations.
134 const EVector
135 EMField::ZeroEfield(0.0, 0.0, 0.0);
136 
137 
138 const BVector
139 EMField::ZeroBfield(0.0, 0.0, 0.0);
140 
141 
142 const EBVectors
144 
145 
147 {}
148 
149 
151 {}
152 
153 
155 {}
156 
157 
159  return *this;
160 }
161 
162 
164  return ZeroEfield;
165 }
166 
167 
169  return ZeroBfield;
170 }
171 
172 
173 EVector EMField::Efield(const Point3D &X, double) const {
174  return Efield(X);
175 }
176 
177 
178 BVector EMField::Bfield(const Point3D &X, double) const {
179  return Bfield(X);
180 }
181 
182 
184  return EBVectors(Efield(X), Bfield(X));
185 }
186 
187 
188 EBVectors EMField::EBfield(const Point3D &X, double) const {
189  return EBfield(X);
190 }
A magnetic field vector.
Definition: EMField.h:97
virtual BVector Bfield(const Point3D &P) const
Get field.
Definition: EMField.cpp:168
double Bz
Definition: EMField.h:123
EVector E
Definition: EMField.h:176
double getZ() const
Return coordinate.
Definition: EMField.cpp:40
An electric field vector.
Definition: EMField.h:63
Definition: rbendmap.h:8
virtual EBVectors EBfield(const Point3D &P) const
Get field.
Definition: EMField.cpp:183
double Bx
Definition: EMField.h:123
EVector(double, double, double)
Constructor.
Definition: EMField.cpp:47
double z
Definition: EMField.h:55
EBVectors(const EVector &E, const BVector &B)
Constructor.
Definition: EMField.cpp:93
double getEy() const
Get component.
Definition: EMField.cpp:106
double getY() const
Return coordinate.
Definition: EMField.cpp:37
const EMField & operator=(const EMField &right)
Definition: EMField.cpp:158
double Ey
Definition: EMField.h:89
A point in 3 dimensions.
Definition: EMField.h:33
EMField()
Default constructor.
Definition: EMField.cpp:146
double getBz() const
Get component.
Definition: EMField.cpp:126
double getBy() const
Get component.
Definition: EMField.cpp:82
BVector B
Definition: EMField.h:177
EVector getE() const
Get component.
Definition: EMField.cpp:98
double Ex
Definition: EMField.h:89
virtual ~EMField()
Definition: EMField.cpp:154
double getEz() const
Get component.
Definition: EMField.cpp:63
double getBz() const
Get component.
Definition: EMField.cpp:86
double getEz() const
Get component.
Definition: EMField.cpp:110
BVector(double, double, double)
Constructor.
Definition: EMField.cpp:70
virtual EVector Efield(const Point3D &P) const
Get field.
Definition: EMField.cpp:163
Abstract base class for electromagnetic fields.
Definition: EMField.h:188
double getBx() const
Get component.
Definition: EMField.cpp:78
static const BVector ZeroBfield
The constant representing a zero magnetic field.
Definition: EMField.h:239
Point3D(double x, double y, double z)
Constructor.
Definition: EMField.cpp:31
double getEy() const
Get component.
Definition: EMField.cpp:59
double getEx() const
Get component.
Definition: EMField.cpp:102
double By
Definition: EMField.h:123
BVector operator*(double scalar) const
Scale.
Definition: EMField.cpp:74
double getBy() const
Get component.
Definition: EMField.cpp:122
static const EVector ZeroEfield
The constant representing a zero electric field.
Definition: EMField.h:236
double y
Definition: EMField.h:55
double Ez
Definition: EMField.h:89
static const EBVectors ZeroEBfield
The constant representing a zero electromagnetic field.
Definition: EMField.h:242
BVector getB() const
Get field.
Definition: EMField.cpp:114
double getBx() const
Get component.
Definition: EMField.cpp:118
double getEx() const
Get component.
Definition: EMField.cpp:55
double x
Definition: EMField.h:55
double getX() const
Return coordinate.
Definition: EMField.cpp:34
EVector operator*(double scalar) const
Scale.
Definition: EMField.cpp:51
A representation of an electromagnetic field.
Definition: EMField.h:133