OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
SBendWrapper.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: SBendWrapper.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1.2.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: SBendWrapper
10 // Defines a representation for a modified SBend.
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 SBendWrapper
26 // ------------------------------------------------------------------------
27 
29  SBend(*ideal),
30  itsDesign(ideal),
31  itsError(),
32  tempField() {
33  shareFlag = false;
34 }
35 
36 
38  SBend(rhs),
39  itsDesign(rhs.itsDesign),
40  itsError(rhs.itsError),
41  tempField() {
42  shareFlag = false;
43 }
44 
45 
47 {}
48 
49 
50 void SBendWrapper::accept(BeamlineVisitor &visitor) const {
51  visitor.visitSBendWrapper(*this);
52 }
53 
54 
56  SBendWrapper *sbw = new SBendWrapper(*this);
57  sbw->itsDesign = dynamic_cast<SBend *>(itsDesign->clone());
58  return sbw;
59 }
60 
61 
63  if(isSharable()) {
64  return this;
65  } else {
66  SBendWrapper *sbw = new SBendWrapper(*this);
67  sbw->itsDesign = dynamic_cast<SBend *>(itsDesign->copyStructure());
68  return sbw;
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 SBendWrapper::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 SBendWrapper::getSlices() const {
135  return itsDesign->getSlices();
136 }
137 
138 
140  return itsDesign->getStepsize();
141 }
142 
143 
145  return SBENDWRAPPER;
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 double getExitFaceRotation() const =0
Get exit pole face rotation.
virtual double getExitFaceRotation() const
Get pole face rotation.
virtual const SBend & getDesign() const
Get design SBend.
virtual double getSlices() const
Get number of slices.
virtual double getEntryFaceCurvature() const
Get pole face curvature.
Interface for basic beam line object.
Definition: ElementBase.h:128
virtual BMultipoleField & getField() override=0
Get multipole expansion of field.
virtual double getSlices() const =0
Get number of slices.
virtual ElementBase * removeWrappers()
Remove all wrappers.
A simple arc in the XZ plane.
virtual double getB() const
Get dipole component.
virtual PlanarArcGeometry & getGeometry() override=0
Get SBend geometry.
virtual double getStepsize() const
Get stepsize.
virtual void makeSharable()
Set sharable flag.
virtual ElementBase * removeFieldWrapper()
Remove field wrapper.
virtual double getStepsize() const =0
Get stepsize.
virtual ElementBase * clone() const
Make clone.
virtual void makeSharable()
Set sharable flag.
virtual void visitSBendWrapper(const SBendWrapper &)=0
Apply the algorithm to an SBend wrapper.
Pointer< SBend > itsDesign
Definition: SBendWrapper.h:152
virtual ~SBendWrapper()
virtual ElementBase * copyStructure()
Make structural copy.
double getNormalComponent(int n) const
Get component.
virtual BMultipoleField & getField()
Get field.
virtual PlanarArcGeometry & getGeometry()
Get geometry.
Definition: SBend.h:68
virtual BMultipoleField & errorField() const
Get multipole field error.
virtual ElementBase * copyStructure()
Make a structural copy.
Representation of a perturbed sector bend.
Definition: SBendWrapper.h:37
virtual double getEntryFaceCurvature() const =0
Get entry pole face curvature.
virtual ElementBase * clone() const =0
Return clone.
bool shareFlag
Definition: ElementBase.h:464
virtual double getEntryFaceRotation() const =0
Get pole entry face rotation.
The magnetic field of a multipole.
virtual double getExitFaceCurvature() const =0
Get exit pole face curvature.
virtual double getExitFaceCurvature() const
Get pole face curvature.
bool isSharable() const
Test if the element can be shared.
Definition: ElementBase.h:559
virtual double getEntryFaceRotation() const
Get pole face rotation.
virtual ElementBase * makeFieldWrapper()
Make wrapper for this bend.
virtual void accept(BeamlineVisitor &) const
Apply visitor to modified bend.
BMultipoleField itsError
The error field.
Definition: SBendWrapper.h:155
Abstract algorithm.
BMultipoleField & addField(const BMultipoleField &field)
Add to field.
BMultipoleField tempField
Definition: SBendWrapper.h:158
virtual ElementBase::ElementType getType() const
Get element type string.