OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
RBend.h
Go to the documentation of this file.
1 //
2 // Class RBend
3 // Interface for a rectangular bend magnet.
4 //
5 // A rectangular bend magnet physically has a rectangular shape.
6 //
7 // The standard rectangular magnet, for purposes of definitions, has a field in
8 // the y direction. This produces a bend in the horizontal (x) plane. Bends in
9 // other planes can be accomplished by rotating the magnet about the axes.
10 //
11 // A positive bend angle is defined as one that bends a beam to the right when
12 // looking down (in the negative y direction) so that the beam is bent in the
13 // negative x direction. (This definition of a positive bend is the same whether
14 // the charge is positive or negative.)
15 //
16 // A zero degree entrance edge angle is parallel to the x direction in an x/y/s
17 // coordinate system. A positive entrance edge angle is defined as one that
18 // rotates the positive edge (in x) of the angle toward the positive s axis.
19 //
20 // Since the magnet geometry is a fixed rectangle, the exit edge angle is
21 // defined by the bend angle of the magnet and the entrance edge angle. In
22 // general, the exit edge angle is equal to the bend angle minus the entrance
23 // edge angle.
24 //
25 // ------------------------------------------------------------------------
26 //
27 // This class defines two interfaces:
28 //
29 // 1) Interface for rectangular magnets for OPAL-MAP.
30 //
31 // Here we specify multipole components about the curved magnet trajectory.
32 //
33 // 2) Interface for rectangular magnets for OPAL-T.
34 //
35 // Here we defined the magnet as a field map.
36 //
37 // Copyright (c) 2008 - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
38 // All rights reserved
39 //
40 // This file is part of OPAL.
41 //
42 // OPAL is free software: you can redistribute it and/or modify
43 // it under the terms of the GNU General Public License as published by
44 // the Free Software Foundation, either version 3 of the License, or
45 // (at your option) any later version.
46 //
47 // You should have received a copy of the GNU General Public License
48 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
49 //
50 
51 #ifndef CLASSIC_RBend_HH
52 #define CLASSIC_RBend_HH
53 
54 #include "AbsBeamline/Bend2D.h"
56 #include "Fields/BMultipoleField.h"
57 
58 class RBend: public Bend2D {
59 
60 public:
61 
63  explicit RBend(const std::string &name);
64 
65  RBend();
66  RBend(const RBend &);
67  virtual ~RBend();
68 
70  virtual void accept(BeamlineVisitor &) const override;
71 
72  /*
73  * Methods for OPAL-MAP
74  * ====================
75  */
76 
78  virtual double getB() const = 0;
79 
81  // Version for non-constant object.
82  virtual RBendGeometry &getGeometry() override = 0;
83 
85  // Version for constant object.
86  virtual const RBendGeometry &getGeometry() const override = 0;
87 
89  // Version for non-constant object.
90  virtual BMultipoleField &getField() override = 0;
91 
93  // Version for constant object.
94  virtual const BMultipoleField &getField() const override = 0;
95 
97  // Return the normal component of order [b]n[/b] in T/m**(n-1).
98  // If [b]n[/b] is larger than the maximum order, the return value is zero.
99  double getNormalComponent(int) const;
100 
102  // Return the skew component of order [b]n[/b] in T/m**(n-1).
103  // If [b]n[/b] is larger than the maximum order, the return value is zero.
104  double getSkewComponent(int) const;
105 
107  // Set the normal component of order [b]n[/b] in T/m**(n-1).
108  // If [b]n[/b] is larger than the maximum order, the component is created.
109  void setNormalComponent(int, double);
110 
112  // Set the skew component of order [b]n[/b] in T/m**(n-1).
113  // If [b]n[/b] is larger than the maximum order, the component is created.
114  void setSkewComponent(int, double);
115 
117  // Return the rotation of the entry pole face with respect to the x-axis.
118  // A positive angle rotates the pole face normal away from the centre
119  // of the machine.
120  virtual double getEntryFaceRotation() const = 0;
121 
123  // Return the rotation of the exit pole face with respect to the x-axis.
124  // A positive angle rotates the pole face normal away from the centre
125  // of the machine.
126  virtual double getExitFaceRotation() const = 0;
127 
129  // Return the curvature of the entry pole face.
130  // A positive curvature creates a convex pole face.
131  virtual double getEntryFaceCurvature() const = 0;
132 
134  // Return the curvature of the exit pole face.
135  // A positive curvature creates a convex pole face.
136  virtual double getExitFaceCurvature() const = 0;
137 
139  // Slices and stepsize used to determine integration step.
140  virtual double getSlices() const = 0;
141 
143  // Slices and stepsize used to determine integration step.
144  virtual double getStepsize() const = 0;
145 
146  /*
147  * Methods for OPAL-T.
148  */
149 
150  virtual ElementBase::ElementType getType() const override;
151  virtual void setBendAngle(double angle) override;
152  virtual void setEntranceAngle(double entranceAngle) override;
153 
154 private:
155 
156  // Not implemented.
157  void operator=(const RBend &);
158 
159  virtual bool findChordLength(double &chordLength) override;
160 };
161 
162 #endif // CLASSIC_RBend_HH
const std::string name
Definition: Bend2D.h:51
Definition: RBend.h:58
virtual void setBendAngle(double angle) override
Definition: RBend.cpp:119
virtual ElementBase::ElementType getType() const override
Get element type std::string.
Definition: RBend.cpp:115
virtual double getB() const =0
Get dipole field of RBend.
void operator=(const RBend &)
RBend()
Definition: RBend.cpp:62
virtual BMultipoleField & getField() override=0
Get multipole expansion of field.
virtual void accept(BeamlineVisitor &) const override
Apply visitor to RBend.
Definition: RBend.cpp:81
virtual double getSlices() const =0
Get number of slices.
double getNormalComponent(int) const
Get normal component.
Definition: RBend.cpp:89
virtual const RBendGeometry & getGeometry() const override=0
Get RBend geometry.
virtual double getExitFaceCurvature() const =0
Get exit pole face curvature.
virtual const BMultipoleField & getField() const override=0
Get multipole expansion of field.
virtual bool findChordLength(double &chordLength) override
Definition: RBend.cpp:129
void setNormalComponent(int, double)
Set normal component.
Definition: RBend.cpp:97
virtual ~RBend()
Definition: RBend.cpp:78
void setSkewComponent(int, double)
Set skew component.
Definition: RBend.cpp:101
virtual double getEntryFaceCurvature() const =0
Get entry pole face curvature.
virtual RBendGeometry & getGeometry() override=0
Get RBend geometry.
virtual double getEntryFaceRotation() const =0
Get pole entry face rotation.
virtual double getStepsize() const =0
Get stepsize.
double getSkewComponent(int) const
Get skew component.
Definition: RBend.cpp:93
virtual void setEntranceAngle(double entranceAngle) override
Definition: RBend.cpp:124
virtual double getExitFaceRotation() const =0
Get exit pole face rotation.
The geometry for a RBend element.
Definition: RBendGeometry.h:41
The magnetic field of a multipole.