OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
RBendWrapper.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: RBendWrapper.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1.2.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: RBendWrapper
10 // Defines a representation for a modified RBend.
11 //
12 // ------------------------------------------------------------------------
13 // Class category: ComponentWrappers
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2004/11/12 18:57:54 $
17 // $Author: adelmann $
18 //
19 // ------------------------------------------------------------------------
20 
23 
24 
25 // Class RBendWrapper
26 // ------------------------------------------------------------------------
27 
29  RBend(*ideal),
30  itsDesign(ideal),
31  itsError(),
32  tempField() {
33  shareFlag = false;
34 }
35 
36 
38  RBend(rhs),
39  itsDesign(rhs.itsDesign),
40  itsError(rhs.itsError),
41  tempField() {
42  shareFlag = false;
43 }
44 
45 
47 {}
48 
49 
50 void RBendWrapper::accept(BeamlineVisitor &visitor) const {
51  visitor.visitRBendWrapper(*this);
52 }
53 
54 
56  RBendWrapper *rbw = new RBendWrapper(*this);
57  rbw->itsDesign = dynamic_cast<RBend *>(itsDesign->clone());
58  return rbw;
59 }
60 
61 
63  if(isSharable()) {
64  return this;
65  } else {
66  RBendWrapper *rbw = new RBendWrapper(*this);
67  rbw->itsDesign = dynamic_cast<RBend *>(itsDesign->copyStructure());
68  return rbw;
69  }
70 }
71 
72 
74  return itsError;
75 }
76 
77 
79  shareFlag = true;
81 }
82 
83 
87  return tempField;
88 }
89 
90 
94  return tempField;
95 }
96 
97 
99  return itsDesign->getGeometry();
100 }
101 
102 
104  return itsDesign->getGeometry();
105 }
106 
107 
108 double RBendWrapper::getB() const {
109  getField();
110  return tempField.getNormalComponent(1);
111 }
112 
113 
116 }
117 
118 
120  return itsDesign->getExitFaceRotation();
121 }
122 
123 
126 }
127 
128 
131 }
132 
133 
134 double RBendWrapper::getSlices() const {
135  return itsDesign->getSlices();
136 }
137 
138 
140  return itsDesign->getStepsize();
141 }
142 
143 
145  return RBENDWRAPPER;
146 }
147 
148 
150  return *itsDesign;
151 }
152 
153 
155  return *itsDesign;
156 }
157 
158 
160  return this;
161 }
162 
163 
165  return &*itsDesign;
166 }
167 
168 
170  return &*itsDesign;
171 }
172 
173 
175  return &*itsDesign;
176 }
177 
178 
180  return &*itsDesign;
181 }
virtual BMultipoleField & getField() override=0
Get multipole expansion of field.
virtual ElementBase * makeFieldWrapper()
Make wrapper for this bend.
virtual double getExitFaceCurvature() const =0
Get exit pole face curvature.
Interface for basic beam line object.
Definition: ElementBase.h:128
virtual ElementBase::ElementType getType() const
Get element type string.
Definition: RBend.h:73
virtual double getEntryFaceRotation() const =0
Get pole entry face rotation.
virtual double getStepsize() const =0
Get stepsize.
virtual double getEntryFaceRotation() const
Get pole face rotation.
virtual ElementBase * removeWrappers()
Remove all wrappers.
virtual double getExitFaceRotation() const =0
Get exit pole face rotation.
virtual void makeSharable()
Set sharable flag.
virtual const RBend & getDesign() const
Get design RBend.
virtual double getSlices() const =0
Get number of slices.
virtual BMultipoleField & errorField() const
Get multipole field error.
virtual void accept(BeamlineVisitor &) const
Apply visitor to modified bend.
virtual double getSlices() const
Get number of slices.
double getNormalComponent(int n) const
Get component.
virtual double getB() const
Get dipole component.
virtual double getExitFaceRotation() const
Get pole face rotation.
virtual ElementBase * removeFieldWrapper()
Remove field wrapper.
virtual double getEntryFaceCurvature() const
Get pole face curvature.
virtual ElementBase * clone() const
Make clone.
virtual ElementBase * copyStructure()
Make a structural copy.
virtual ElementBase * clone() const =0
Return clone.
bool shareFlag
Definition: ElementBase.h:464
The geometry for a RBend element.
Definition: RBendGeometry.h:41
virtual ~RBendWrapper()
virtual BMultipoleField & getField()
Get field.
virtual void makeSharable()
Set sharable flag.
The magnetic field of a multipole.
virtual ElementBase * copyStructure()
Make structural copy.
virtual double getEntryFaceCurvature() const =0
Get entry pole face curvature.
bool isSharable() const
Test if the element can be shared.
Definition: ElementBase.h:559
virtual RBendGeometry & getGeometry() override=0
Get RBend geometry.
BMultipoleField itsError
The error field.
Definition: RBendWrapper.h:155
BMultipoleField tempField
Definition: RBendWrapper.h:158
virtual RBendGeometry & getGeometry()
Get geometry.
virtual double getExitFaceCurvature() const
Get pole face curvature.
Representation of a perturbed rectangular bend.
Definition: RBendWrapper.h:37
Abstract algorithm.
virtual void visitRBendWrapper(const RBendWrapper &)=0
Apply the algorithm to an RBend wrapper.
virtual double getStepsize() const
Get stepsize.
BMultipoleField & addField(const BMultipoleField &field)
Add to field.
Pointer< RBend > itsDesign
Definition: RBendWrapper.h:152