OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
MultipoleTStraight.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_STRAIGHT_H
31 #define CLASSIC_MULTIPOLET_STRAIGHT_H
32 
80 #include <vector>
81 
83 public:
87  explicit MultipoleTStraight(const std::string &name);
93  virtual ElementBase* clone() const override;
95  void accept(BeamlineVisitor &visitor) const override;
100  virtual void setMaxOrder(const std::size_t &maxOrder) override;
102  StraightGeometry& getGeometry() override;
104  const StraightGeometry& getGeometry() const override;
110  virtual void initialise(PartBunchBase<double, 3>* bunch,
111  double &startField,
112  double &endField) override;
113 private:
118  virtual void transformCoords(Vector_t &R) override;
120  virtual void transformBField(Vector_t &B, const Vector_t &R) override;
125  virtual double getRadius(const double &s) override;
130  virtual double getScaleFactor(const double &x, const double &s) override;
135  virtual double getBx (const Vector_t &R) override;
140  virtual double getBs (const Vector_t &R) override;
147  virtual double getFn(const std::size_t &n,
148  const double &x,
149  const double &s) override;
150 };
151 
152 inline
154  visitor.visitMultipoleTStraight(*this);
155 }
156 inline
158 }
159 inline
160  double MultipoleTStraight::getRadius(const double &s) {
161  return 1e300;
162 }
163 inline
164  double MultipoleTStraight::getScaleFactor(const double &x,
165  const double &s) {
166  return 1.0;
167 }
168 inline
170  return straightGeometry_m;
171 }
172 inline
174  return straightGeometry_m;
175 }
176 inline
178  double &startField,
179  double &endField) {
180  RefPartBunch_m = bunch;
182 }
183 
184 #endif
virtual double getRadius(const double &s) override
Interface for basic beam line object.
Definition: ElementBase.h:128
virtual void setMaxOrder(const std::size_t &maxOrder) override
MultipoleTStraight operator=(const MultipoleTStraight &rhs)
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
void accept(BeamlineVisitor &visitor) const override
StraightGeometry straightGeometry_m
virtual ElementBase * clone() const override
MultipoleTStraight(const std::string &name)
virtual void transformCoords(Vector_t &R) override
virtual double getFn(const std::size_t &n, const double &x, const double &s) override
virtual void setElementLength(double length)
Set design length.
PartBunchBase< double, 3 > * RefPartBunch_m
Definition: Component.h:200
virtual void visitMultipoleTStraight(const MultipoleTStraight &)=0
Apply the algorithm to an arbitrary straight Multipole.
virtual double getScaleFactor(const double &x, const double &s) override
StraightGeometry & getGeometry() override
A geometry representing a straight line.
const std::string name
virtual double getBx(const Vector_t &R) override
double getBoundingBoxLength() const
Abstract algorithm.
virtual void transformBField(Vector_t &B, const Vector_t &R) override
virtual double getBs(const Vector_t &R) override