OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
MultipoleWrapper.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: MultipoleWrapper.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: MultipoleWrapper
10 // Defines a representation for a modified multipole.
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 MultipoleWrapper
26 // A MultipoleWrapper represents a unique instance of a multipole magnet
27 // in the accelerator model.
28 // ------------------------------------------------------------------------
29 
31  Multipole(*ideal),
32  itsDesign(ideal),
33  itsError(),
34  tempField() {
35  setName(ideal->getName());
36  shareFlag = false;
37 }
38 
39 
41  Multipole(rhs),
42  itsDesign(rhs.itsDesign),
43  itsError(rhs.itsError),
44  tempField() {
45  shareFlag = false;
46 }
47 
48 
50 {}
51 
52 
54  visitor.visitMultipoleWrapper(*this);
55 }
56 
57 
59  MultipoleWrapper *mw = new MultipoleWrapper(*this);
60  mw->itsDesign = dynamic_cast<Multipole *>(itsDesign->clone());
61  return mw;
62 }
63 
64 
66  if(isSharable()) {
67  return this;
68  } else {
69  MultipoleWrapper *mw = new MultipoleWrapper(*this);
70  mw->itsDesign = dynamic_cast<Multipole *>(itsDesign->copyStructure());
71  return mw;
72  }
73 }
74 
75 
77  return itsError;
78 
79 }
80 
81 
83  shareFlag = true;
85 }
86 
87 
91  return tempField;
92 }
93 
94 
98  return tempField;
99 }
100 
101 
103  return itsDesign->getGeometry();
104 }
105 
106 
108  return itsDesign->getGeometry();
109 }
110 
111 
113  return MULTIPOLEWRAPPER;
114 }
115 
116 
118  return *itsDesign;
119 }
120 
121 
123  return *itsDesign;
124 }
125 
126 
128  return this;
129 }
130 
131 
133  return &*itsDesign;
134 }
135 
136 
138  return &*itsDesign;
139 }
140 
141 
143  return &*itsDesign;
144 }
145 
146 
148  return &*itsDesign;
149 }
virtual StraightGeometry & getGeometry()
Get geometry.
virtual void makeSharable()
Set sharable flag.
virtual const Multipole & getDesign() const
Get design corrector.
Interface for basic beam line object.
Definition: ElementBase.h:128
BMultipoleField tempField
virtual BMultipoleField & getField() override=0
Get multipole field.
virtual void setName(const std::string &name)
Set element name.
virtual BMultipoleField & getField()
Get field.
virtual ElementBase * makeFieldWrapper()
Make wrapper for this multipole.
virtual ElementBase * clone() const
Make clone.
Representation of a perturbed multipole.
virtual const std::string & getName() const
Get element name.
Definition: ElementBase.cpp:95
virtual void accept(BeamlineVisitor &) const
Apply visitor to modified multipole.
Interface for general multipole.
Definition: Multipole.h:46
virtual void makeSharable()
Set sharable flag.
virtual ElementBase * removeFieldWrapper()
Remove field wrapper.
BMultipoleField itsError
virtual ElementBase * removeWrappers()
Remove all wrappers.
virtual ElementBase * copyStructure()
Make structural copy.
virtual ElementBase * copyStructure()
Make a structural copy.
virtual ~MultipoleWrapper()
virtual ElementBase::ElementType getType() const
Get element type string.
virtual ElementBase * clone() const =0
Return clone.
bool shareFlag
Definition: ElementBase.h:464
A geometry representing a straight line.
virtual void visitMultipoleWrapper(const MultipoleWrapper &)=0
Apply the algorithm to an multipole wrapper.
The magnetic field of a multipole.
virtual BMultipoleField & errorField() const
Get multipole field error.
bool isSharable() const
Test if the element can be shared.
Definition: ElementBase.h:559
virtual StraightGeometry & getGeometry() override=0
Get geometry.
Pointer< Multipole > itsDesign
Abstract algorithm.
BMultipoleField & addField(const BMultipoleField &field)
Add to field.