OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
RBend.h
Go to the documentation of this file.
1 #ifndef CLASSIC_RBend_HH
2 #define CLASSIC_RBend_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: RBend.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1.2.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: RBend
13 // Defines the abstract interface for a rectangular bend magnet.
14 //
15 // ------------------------------------------------------------------------
16 // Class category: AbsBeamline
17 // ------------------------------------------------------------------------
18 //
19 // $Date: 2004/11/12 18:57:53 $
20 // $Author: adelmann $
21 //
22 // ------------------------------------------------------------------------
23 
24 #include "AbsBeamline/Bend2D.h"
26 #include "Fields/BMultipoleField.h"
27 
28 /*
29  * Class RBend
30  *
31  * Interface for a rectangular bend magnet.
32  *
33  * A rectangular bend magnet physically has a rectangular shape.
34  *
35  * The standard rectangular magnet, for purposes of definitions, has a field in
36  * the y direction. This produces a bend in the horizontal (x) plane. Bends in
37  * other planes can be accomplished by rotating the magnet about the axes.
38  *
39  * A positive bend angle is defined as one that bends a beam to the right when
40  * looking down (in the negative y direction) so that the beam is bent in the
41  * negative x direction. (This definition of a positive bend is the same whether
42  * the charge is positive or negative.)
43  *
44  * A zero degree entrance edge angle is parallel to the x direction in an x/y/s
45  * coordinate system. A positive entrance edge angle is defined as one that
46  * rotates the positive edge (in x) of the angle toward the positive s axis.
47  *
48  * Since the magnet geometry is a fixed rectangle, the exit edge angle is
49  * defined by the bend angle of the magnet and the entrance edge angle. In
50  * general, the exit edge angle is equal to the bend angle minus the entrance
51  * edge angle.
52  *
53  * ------------------------------------------------------------------------
54  *
55  * This class defines three interfaces:
56  *
57  * 1) Interface for rectangular magnets for OPAL-MAP.
58  *
59  * Here we specify multipole components about the curved magnet trajectory.
60  *
61  *
62  * 2) Interface for rectangular magnets in OPAL-SLICE.
63  *
64  * Here we define a rectangular magnet for use in the OPAL
65  * slice model.
66  *
67  *
68  * 3) Interface for rectangular magnets for OPAL-T.
69  *
70  * Here we defined the magnet as a field map.
71  */
72 
73 class RBend: public Bend2D {
74 
75 public:
76 
78  explicit RBend(const std::string &name);
79 
80  RBend();
81  RBend(const RBend &);
82  virtual ~RBend();
83 
85  virtual void accept(BeamlineVisitor &) const override;
86 
87  /*
88  * Methods for OPAL-MAP
89  * ====================
90  */
91 
93  virtual double getB() const = 0;
94 
96  // Version for non-constant object.
97  virtual RBendGeometry &getGeometry() override = 0;
98 
100  // Version for constant object.
101  virtual const RBendGeometry &getGeometry() const override = 0;
102 
104  // Version for non-constant object.
105  virtual BMultipoleField &getField() override = 0;
106 
108  // Version for constant object.
109  virtual const BMultipoleField &getField() const override = 0;
110 
112  // Return the normal component of order [b]n[/b] in T/m**(n-1).
113  // If [b]n[/b] is larger than the maximum order, the return value is zero.
114  double getNormalComponent(int) const;
115 
117  // Return the skew component of order [b]n[/b] in T/m**(n-1).
118  // If [b]n[/b] is larger than the maximum order, the return value is zero.
119  double getSkewComponent(int) const;
120 
122  // Set the normal component of order [b]n[/b] in T/m**(n-1).
123  // If [b]n[/b] is larger than the maximum order, the component is created.
124  void setNormalComponent(int, double);
125 
127  // Set the skew component of order [b]n[/b] in T/m**(n-1).
128  // If [b]n[/b] is larger than the maximum order, the component is created.
129  void setSkewComponent(int, double);
130 
132  // Return the rotation of the entry pole face with respect to the x-axis.
133  // A positive angle rotates the pole face normal away from the centre
134  // of the machine.
135  virtual double getEntryFaceRotation() const = 0;
136 
138  // Return the rotation of the exit pole face with respect to the x-axis.
139  // A positive angle rotates the pole face normal away from the centre
140  // of the machine.
141  virtual double getExitFaceRotation() const = 0;
142 
144  // Return the curvature of the entry pole face.
145  // A positive curvature creates a convex pole face.
146  virtual double getEntryFaceCurvature() const = 0;
147 
149  // Return the curvature of the exit pole face.
150  // A positive curvature creates a convex pole face.
151  virtual double getExitFaceCurvature() const = 0;
152 
154  // Slices and stepsize used to determine integration step.
155  virtual double getSlices() const = 0;
156 
158  // Slices and stepsize used to determine integration step.
159  virtual double getStepsize() const = 0;
160 
161 
162  /*
163  * Methods for OPAL-SLICE.
164  */
165  virtual void addKR(int i, double t, Vector_t &K) override;
166  virtual void addKT(int i, double t, Vector_t &K) override;
167 
168 
169  /*
170  * Methods for OPAL-T.
171  */
172 
173  virtual ElementBase::ElementType getType() const override;
174  virtual void setBendAngle(double angle) override;
175  virtual void setEntranceAngle(double entranceAngle) override;
176 
177 private:
178 
179  // Not implemented.
180  void operator=(const RBend &);
181 
182  virtual bool findChordLength(Inform &msg,
183  double &chordLength) override;
184 };
185 
186 #endif // CLASSIC_RBend_HH
virtual void setEntranceAngle(double entranceAngle) override
Definition: RBend.cpp:141
virtual bool findChordLength(Inform &msg, double &chordLength) override
Definition: RBend.cpp:146
virtual BMultipoleField & getField() override=0
Get multipole expansion of field.
double getNormalComponent(int) const
Get normal component.
Definition: RBend.cpp:62
virtual ElementBase::ElementType getType() const override
Get element type std::string.
Definition: RBend.cpp:132
virtual double getExitFaceCurvature() const =0
Get exit pole face curvature.
virtual void setBendAngle(double angle) override
Definition: RBend.cpp:136
virtual void accept(BeamlineVisitor &) const override
Apply visitor to RBend.
Definition: RBend.cpp:54
virtual double getB() const =0
Get dipole field of RBend.
Definition: RBend.h:73
virtual double getEntryFaceRotation() const =0
Get pole entry face rotation.
void operator=(const RBend &)
virtual double getStepsize() const =0
Get stepsize.
void setSkewComponent(int, double)
Set skew component.
Definition: RBend.cpp:74
virtual double getExitFaceRotation() const =0
Get exit pole face rotation.
virtual void addKR(int i, double t, Vector_t &K) override
Definition: RBend.cpp:81
virtual void addKT(int i, double t, Vector_t &K) override
Definition: RBend.cpp:103
virtual double getSlices() const =0
Get number of slices.
Definition: Bend2D.h:51
The geometry for a RBend element.
Definition: RBendGeometry.h:41
The magnetic field of a multipole.
double getSkewComponent(int) const
Get skew component.
Definition: RBend.cpp:66
const std::string name
virtual double getEntryFaceCurvature() const =0
Get entry pole face curvature.
virtual RBendGeometry & getGeometry() override=0
Get RBend geometry.
RBend()
Definition: RBend.cpp:35
void setNormalComponent(int, double)
Set normal component.
Definition: RBend.cpp:70
#define K
Definition: integrate.cpp:118
Abstract algorithm.
Definition: Inform.h:41
virtual ~RBend()
Definition: RBend.cpp:51