OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
MultipoleTCurvedConstRadius.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, Titus Dascalu
3  * Copyright (c) 2018, Martin Duy Tat
4  * All rights reserved.
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * 1. Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright notice,
10  * this list of conditions and the following disclaimer in the documentation
11  * and/or other materials provided with the distribution.
12  * 3. Neither the name of STFC nor the names of its contributors may be used to
13  * endorse or promote products derived from this software without specific
14  * prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 
30 #ifndef CLASSIC_MULTIPOLET_CURVED_CONST_RADIUS_H
31 #define CLASSIC_MULTIPOLET_CURVED_CONST_RADIUS_H
32 
81 #include <vector>
82 
84 public:
88  explicit MultipoleTCurvedConstRadius(const std::string &name);
94  virtual ElementBase* clone() const override;
96  void accept(BeamlineVisitor &visitor) const override;
98  PlanarArcGeometry& getGeometry() override;
100  const PlanarArcGeometry& getGeometry() const override;
105  virtual void setMaxOrder(const std::size_t &maxOrder) override;
107  std::size_t getMaxXOrder() const;
111  void setMaxXOrder(const std::size_t &maxXOrder);
113  virtual void setBendAngle(const double &angle) override;
115  virtual double getBendAngle() const override;
121  virtual void initialise(PartBunchBase<double, 3>* bunch,
122  double &startField,
123  double &endField) override;
124 private:
126  const MultipoleTCurvedConstRadius &rhs);
128  std::size_t maxOrderX_m;
130  std::vector<polynomial::RecursionRelation> recursion_m;
134  virtual void transformCoords(Vector_t &R) override;
136  virtual void transformBField(Vector_t &B, const Vector_t &R) override;
137  double angle_m;
143  virtual double getRadius(const double &s) override;
148  virtual double getScaleFactor(const double &x, const double &s) override;
155  virtual double getFn(const std::size_t &n,
156  const double &x,
157  const double &s) override;
158 };
159 
160 inline
162  visitor.visitMultipoleTCurvedConstRadius(*this);
163 }
164 inline
166  const std::size_t &maxXorder) {
167  maxOrderX_m = maxXorder;
168 }
169 inline
171  return maxOrderX_m;
172 }
173 inline
175  return planarArcGeometry_m;
176 }
177 inline
179  return planarArcGeometry_m;
180 }
181 inline
182  void MultipoleTCurvedConstRadius::setBendAngle(const double &angle) {
183  angle_m = angle;
184 }
185 inline
187  return angle_m;
188 }
189 inline
191  double &/*startField*/,
192  double &/*endField*/) {
193  RefPartBunch_m = bunch;
196 }
197 
198 #endif
const std::string name
virtual void visitMultipoleTCurvedConstRadius(const MultipoleTCurvedConstRadius &)=0
Apply the algorithm to an arbitrary curved multipole of constant radius.
PartBunchBase< double, 3 > * RefPartBunch_m
Definition: Component.h:194
double getBoundingBoxLength() const
double getLength() const
std::vector< polynomial::RecursionRelation > recursion_m
virtual void transformBField(Vector_t &B, const Vector_t &R) override
virtual double getFn(const std::size_t &n, const double &x, const double &s) override
void setMaxXOrder(const std::size_t &maxXOrder)
virtual void setBendAngle(const double &angle) override
void accept(BeamlineVisitor &visitor) const override
MultipoleTCurvedConstRadius(const std::string &name)
virtual double getRadius(const double &s) override
PlanarArcGeometry & getGeometry() override
virtual void setMaxOrder(const std::size_t &maxOrder) override
virtual void transformCoords(Vector_t &R) override
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
virtual double getBendAngle() const override
virtual double getScaleFactor(const double &x, const double &s) override
MultipoleTCurvedConstRadius operator=(const MultipoleTCurvedConstRadius &rhs)
virtual ElementBase * clone() const override
A simple arc in the XZ plane.
void setCurvature(double)
Set curvature.
virtual void setElementLength(double)
Set length.