OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
CorrectorWrapper.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: CorrectorWrapper.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: CorrectorWrapper
10 // Defines a representation for a modified corrector.
11 //
12 // ------------------------------------------------------------------------
13 // Class category: ComponentWrappers
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:32:35 $
17 // $Author: fci $
18 //
19 // ------------------------------------------------------------------------
20 
23 
24 
25 // Class CorrectorWrapper
26 // A CorrectorWrapper represents a unique instance of a corrector magnet
27 // in the accelerator model.
28 // ------------------------------------------------------------------------
29 
31  Corrector(*corr),
32  itsDesign(corr),
33  itsError(),
34  tempField() {
35  shareFlag = false;
36 }
37 
38 
40  Corrector(rhs),
41  itsDesign(rhs.itsDesign),
42  itsError(rhs.itsError),
43  tempField() {
44  shareFlag = false;
45 }
46 
47 
49 {}
50 
51 
53  visitor.visitCorrectorWrapper(*this);
54 }
55 
56 
58  CorrectorWrapper *cw = new CorrectorWrapper(*this);
59  cw->itsDesign = dynamic_cast<Corrector *>(itsDesign->clone());
60  return cw;
61 }
62 
63 
65  if(isSharable()) {
66  return this;
67  } else {
68  CorrectorWrapper *cw = new CorrectorWrapper(*this);
69  cw->itsDesign = dynamic_cast<Corrector *>(itsDesign->copyStructure());
70  return cw;
71  }
72 }
73 
74 
76  shareFlag = true;
78 }
79 
80 
82  return itsDesign->getGeometry();
83 }
84 
85 
87  return itsDesign->getGeometry();
88 }
89 
90 
92  return itsDesign->getPlane();
93 }
94 
95 
97  return CORRECTORWRAPPER;
98 }
99 
100 
102  return *itsDesign;
103 }
104 
105 
107  return *itsDesign;
108 }
109 
110 
112  return itsError;
113 }
114 
115 
117  return this;
118 }
119 
120 
122  return &*itsDesign;
123 }
124 
125 
127  return &*itsDesign;
128 }
129 
130 
132  return &*itsDesign;
133 }
134 
135 
137  return &*itsDesign;
138 }
139 
140 
144  return tempField;
145 }
146 
147 
151  return tempField;
152 }
virtual void accept(BeamlineVisitor &) const
Apply visitor to modified corrector.
virtual BDipoleField & getField()=0
Return the corrector field.
BDipoleField & addField(const BDipoleField &field)
Add to field.
Interface for basic beam line object.
Definition: ElementBase.h:128
The field of a magnetic dipole.
Definition: BDipoleField.h:31
virtual BDipoleField & errorField() const
Get corrector field error.
virtual ElementBase::ElementType getType() const
Get element type string.
virtual ElementBase * removeWrappers()
Remove all wrappers.
Interface for general corrector.
Definition: Corrector.h:35
virtual Plane getPlane() const =0
Return the plane on which the corrector acts.
virtual ElementBase * removeFieldWrapper()
Remove field wrapper.
virtual void makeSharable()
Set sharable flag.
virtual void makeSharable()
Set sharable flag.
virtual ElementBase * copyStructure()
Make structural copy.
virtual BDipoleField & getField()
Get corrector field.
Plane
Plane selection.
Definition: Corrector.h:40
virtual Plane getPlane() const
Get plane of action.
BDipoleField tempField
BDipoleField itsError
The field modifiers.
virtual StraightGeometry & getGeometry()=0
Return the corrector geometry.
virtual const Corrector & getDesign() const
Get design corrector.
virtual ElementBase * copyStructure()
Make a structural copy.
virtual ElementBase * clone() const
Make clone.
virtual ElementBase * clone() const =0
Return clone.
bool shareFlag
Definition: ElementBase.h:464
Representation for a perturbed closed orbit corrector.
A geometry representing a straight line.
virtual ElementBase * makeFieldWrapper()
Make wrapper for this corrector.
virtual StraightGeometry & getGeometry()
Get geometry.
virtual ~CorrectorWrapper()
Pointer< Corrector > itsDesign
bool isSharable() const
Test if the element can be shared.
Definition: ElementBase.h:559
virtual void visitCorrectorWrapper(const CorrectorWrapper &)=0
Apply the algorithm to an corrector wrapper.
Abstract algorithm.