OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
BDipoleField.h
Go to the documentation of this file.
1 #ifndef CLASSIC_BDipoleField_HH
2 #define CLASSIC_BDipoleField_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: BDipoleField.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: BDipoleField
13 //
14 // ------------------------------------------------------------------------
15 // Class category: Fields
16 // ------------------------------------------------------------------------
17 //
18 // $Date: 2000/03/27 09:32:35 $
19 // $Author: fci $
20 //
21 // ------------------------------------------------------------------------
22 
23 #include "Fields/ConstBField.h"
24 
25 
26 // Class BDipoleField
27 // ------------------------------------------------------------------------
29 // A static magnetic dipole field in the (x,y)-plane.
30 
31 class BDipoleField: public ConstBField {
32 
33 public:
34 
36  // Constructs a null field.
37  BDipoleField();
38 
39  virtual ~BDipoleField();
40 
42  // Return the time-independent part of the magnetic field in point [b]P[/b].
43  // This override forces implementation in derived classes.
44  virtual BVector Bfield(const Point3D &P) const;
45 
47  // Return the magnetic field at time [b]t[/b] in point [b]P[/b].
48  // This override forces implementation in derived classes.
49  virtual BVector Bfield(const Point3D &P, double t) const;
50 
52  // Return the horizontal component of the field in Teslas.
53  virtual double getBx() const;
54 
56  // Return the vertical component of the field in Teslas.
57  virtual double getBy() const;
58 
60  // Assign the horizontal component of the field in Teslas.
61  virtual void setBx(double Bx);
62 
64  // Assign the vertical component of the field in Teslas.
65  virtual void setBy(double By);
66 
68  // Add [b]field[/b] to the old value; return new value.
69  BDipoleField &addField(const BDipoleField &field);
70 
72  // Subtract [b]field[/b] from the old value; return new value.
74 
76  // Multiply the field by [b]scalar[/b].
77  virtual void scale(double scalar);
78 
79 private:
80 
81  // The field components.
82  double Bx, By;
83 };
84 
85 #endif // CLASSIC_BDipoleField_HH
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 homogenous magnetostatic field.
Definition: ConstBField.h:31
A point in 3 dimensions.
Definition: EMField.h:33
A magnetic field vector.
Definition: EMField.h:97