OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
BDipoleField.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: BDipoleField.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: BDipoleField
10 // An electrostatic dipole field in the (x,y)-plane.
11 //
12 // ------------------------------------------------------------------------
13 // Class category: Fields
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:32:35 $
17 // $Author: fci $
18 //
19 // ------------------------------------------------------------------------
20 
21 #include "Fields/BDipoleField.h"
22 
23 
24 // Class BDipoleField
25 // ------------------------------------------------------------------------
26 
28  Bx(0.0), By(0.0)
29 {}
30 
32 {}
33 
34 
36  return BVector(Bx, By, 0.0);
37 }
38 
39 
40 BVector BDipoleField::Bfield(const Point3D &/*X*/, double) const {
41  return BVector(Bx, By, 0.0);
42 }
43 
44 
45 double BDipoleField::getBx() const {
46  return Bx;
47 }
48 
49 double BDipoleField::getBy() const {
50  return By;
51 }
52 
53 
54 void BDipoleField::setBx(double value) {
55  Bx = value;
56 }
57 
58 void BDipoleField::setBy(double value) {
59  By = value;
60 }
61 
62 
64  Bx += field.Bx;
65  By += field.By;
66  return *this;
67 }
68 
69 
71  Bx -= field.Bx;
72  By -= field.By;
73  return *this;
74 }
75 
76 
77 void BDipoleField::scale(double scalar) {
78  Bx *= scalar;
79  By *= scalar;
80 }
The field of a magnetic dipole.
Definition: BDipoleField.h:31
BDipoleField & addField(const BDipoleField &field)
Add to field.
virtual BVector Bfield(const Point3D &P) const
Get field.
virtual ~BDipoleField()
virtual double getBy() const
Get vertical component.
virtual double getBx() const
Get horizontal component.
BDipoleField()
Default constructor.
virtual void setBy(double By)
Set vertical component.
BDipoleField & subtractField(const BDipoleField &field)
Subtract from field.
virtual void scale(double scalar)
Scale the field.
virtual void setBx(double Bx)
Set horizontal component.
A point in 3 dimensions.
Definition: EMField.h:33
A magnetic field vector.
Definition: EMField.h:97