OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
CyclotronWrapper.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: CyclotronWrapper.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1.2.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: CyclotronWrapper
10 // Defines a representation for a modified Cyclotron.
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 CyclotronWrapper
26 // ------------------------------------------------------------------------
27 
29  Cyclotron(*ideal),
30  itsDesign(ideal),
31  itsError(),
32  tempField() {
33  shareFlag = false;
34 }
35 
36 
38  Cyclotron(rhs),
39  itsDesign(rhs.itsDesign),
40  itsError(rhs.itsError),
41  tempField() {
42  shareFlag = false;
43 }
44 
45 
47 {}
48 
49 
51  visitor.visitCyclotronWrapper(*this);
52 }
53 
54 
56  CyclotronWrapper *sbw = new CyclotronWrapper(*this);
57  sbw->itsDesign = dynamic_cast<Cyclotron *>(itsDesign->clone());
58  return sbw;
59 }
60 
61 
63  if(isSharable()) {
64  return this;
65  } else {
66  CyclotronWrapper *sbw = new CyclotronWrapper(*this);
67  sbw->itsDesign = dynamic_cast<Cyclotron *>(itsDesign->copyStructure());
68  return sbw;
69  }
70 }
71 
72 
74  return itsError;
75 }
76 
77 
79  shareFlag = true;
81 }
82 
83 
85  /*
86  tempField = itsDesign->getField();
87  tempField.addField(itsError);
88  return tempField;
89  */
90  // BMultipoleField tf;
91  return tempField;
92 }
93 
94 
96  /*
97  tempField = itsDesign->getField();
98  tempField.addField(itsError);
99  return tempField;
100  */
101  // BMultipoleField tf;
102  return tempField;
103 }
104 
105 
107 
108  return static_cast<PlanarArcGeometry &>(itsDesign->getGeometry());
109 
110  // PlanarArcGeometry gm(.0);
111  // return gm;
112 }
113 
114 
116  return static_cast<PlanarArcGeometry &>(itsDesign->getGeometry());
117  // PlanarArcGeometry gm(.0);
118  // return gm;
119 }
120 
121 
123  return itsDesign->getSlices();
124 }
125 
126 
128  return itsDesign->getStepsize();
129 }
130 
131 
133  return CYCLOTRONWRAPPER;
134 }
135 
136 
138  return *itsDesign;
139 }
140 
141 
143  return *itsDesign;
144 }
145 
146 
148  return this;
149 }
150 
151 
153  return &*itsDesign;
154 }
155 
156 
158  return &*itsDesign;
159 }
160 
161 
163  return &*itsDesign;
164 }
165 
166 
168  return &*itsDesign;
169 }
virtual void accept(BeamlineVisitor &) const
Apply visitor to modified bend.
Interface for basic beam line object.
Definition: ElementBase.h:128
Interface for a Cyclotron.
Definition: Cyclotron.h:91
virtual BGeometryBase & getGeometry()=0
Get geometry.
A simple arc in the XZ plane.
Pointer< Cyclotron > itsDesign
virtual double getStepsize() const =0
Get stepsize.
virtual ElementBase * clone() const
Make clone.
virtual BMultipoleField & errorField() const
Get multipole field error.
virtual PlanarArcGeometry & getGeometry()
Get geometry.
virtual void makeSharable()
Set sharable flag.
virtual const Cyclotron & getDesign() const
Get design Cyclotron.
virtual ElementBase * makeFieldWrapper()
Make wrapper for this bend.
Representation of a perturbed cyclotron.
virtual double getSlices() const
Get number of slices.
virtual ElementBase * copyStructure()
Make a structural copy.
virtual ~CyclotronWrapper()
virtual void makeSharable()
Set sharable flag.
virtual ElementBase * clone() const =0
Return clone.
bool shareFlag
Definition: ElementBase.h:464
virtual ElementBase * removeWrappers()
Remove all wrappers.
virtual ElementBase * copyStructure()
Make structural copy.
virtual void visitCyclotronWrapper(const CyclotronWrapper &)=0
Apply the algorithm to an corrector wrapper.
BMultipoleField itsError
The error field.
The magnetic field of a multipole.
virtual ElementBase::ElementType getType() const
Get element type string.
virtual ElementBase * removeFieldWrapper()
Remove field wrapper.
bool isSharable() const
Test if the element can be shared.
Definition: ElementBase.h:559
virtual double getStepsize() const
Get stepsize.
Abstract algorithm.
virtual BMultipoleField & getField()
Get field.
virtual double getSlices() const =0
Get number of slices.
BMultipoleField tempField