OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
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// Class Point3D
28// ------------------------------------------------------------------------
29
30Point3D::Point3D(double xx, double yy, double zz) {
31 x = xx;
32 y = yy;
33 z = zz;
34}
35
36double Point3D::getX() const { return x; }
37
38double Point3D::getY() const { return y; }
39
40double Point3D::getZ() const { return z; }
41
42// Class EVector
43// ------------------------------------------------------------------------
44
45EVector::EVector(double Exx, double Eyy, double Ezz) {
46 Ex = Exx;
47 Ey = Eyy;
48 Ez = Ezz;
49}
50
51EVector EVector::operator*(double scale) const {
52 return EVector(scale * Ex, scale * Ey, scale * Ez);
53}
54
55double EVector::getEx() const { return Ex; }
56
57double EVector::getEy() const { return Ey; }
58
59double EVector::getEz() const { return Ez; }
60
61// Class BVector
62// ------------------------------------------------------------------------
63
64BVector::BVector(double Bxx, double Byy, double Bzz) {
65 Bx = Bxx;
66 By = Byy;
67 Bz = Bzz;
68}
69
70BVector BVector::operator*(double scale) const {
71 return BVector(scale * Bx, scale * By, scale * Bz);
72}
73
74double BVector::getBx() const { return Bx; }
75
76double BVector::getBy() const { return By; }
77
78double BVector::getBz() const { return Bz; }
79
80// Class EBVectors
81// ------------------------------------------------------------------------
82
83EBVectors::EBVectors(const EVector& eField, const BVector& bField) : E(eField), B(bField) {}
84
85EVector EBVectors::getE() const { return E; }
86
87double EBVectors::getEx() const { return E.getEx(); }
88
89double EBVectors::getEy() const { return E.getEy(); }
90
91double EBVectors::getEz() const { return E.getEz(); }
92
93BVector EBVectors::getB() const { return B; }
94
95double EBVectors::getBx() const { return B.getBx(); }
96
97double EBVectors::getBy() const { return B.getBy(); }
98
99double EBVectors::getBz() const { return B.getBy(); }
100
101// Class EMField
102// ------------------------------------------------------------------------
103
104// Zero field representations.
105const EVector EMField::ZeroEfield(0.0, 0.0, 0.0);
106
107const BVector EMField::ZeroBfield(0.0, 0.0, 0.0);
108
110
112
114
116
117const EMField& EMField::operator=(const EMField&) { return *this; }
118
119EVector EMField::Efield(const Point3D&) const { return ZeroEfield; }
120
121BVector EMField::Bfield(const Point3D&) const { return ZeroBfield; }
122
123EVector EMField::Efield(const Point3D& X, double) const { return Efield(X); }
124
125BVector EMField::Bfield(const Point3D& X, double) const { return Bfield(X); }
126
127EBVectors EMField::EBfield(const Point3D& X) const { return EBVectors(Efield(X), Bfield(X)); }
128
129EBVectors EMField::EBfield(const Point3D& X, double) const { return EBfield(X); }
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
BVector(double, double, double)
Constructor.
Definition EMField.cpp:64
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
EBVectors(const EVector &E, const BVector &B)
Constructor.
Definition EMField.cpp:83
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
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
EVector(double, double, double)
Constructor.
Definition EMField.cpp:45
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
Point3D(double x, double y, double z)
Constructor.
Definition EMField.cpp:30
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