OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
MultipoleTCurvedVarRadius.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_VAR_RADIUS_H
31#define CLASSIC_MULTIPOLET_CURVED_VAR_RADIUS_H
32
78
79
80
82
85#include <vector>
86
88public:
92 explicit MultipoleTCurvedVarRadius(const std::string &name);
98 virtual ElementBase* clone() const override;
100 void accept(BeamlineVisitor &visitor) const override;
102 VarRadiusGeometry& getGeometry() override;
104 const VarRadiusGeometry& getGeometry() const override;
109 virtual void setMaxOrder(const std::size_t &maxOrder) override;
111 std::size_t getMaxXOrder() const;
115 void setMaxXOrder(const std::size_t &maxXOrder);
117 virtual void setBendAngle(const double &angle) override;
119 virtual double getBendAngle() const override;
125 virtual void initialise(PartBunch_t* bunch,
126 double &startField,
127 double &endField) override;
128private:
131 std::size_t maxOrderX_m;
133 std::vector<polynomial::RecursionRelationTwo> recursion_m;
137 virtual void transformCoords(Vector_t<double, 3> &R) override;
139 virtual void transformBField(Vector_t<double, 3> &B, const Vector_t<double, 3> &R) override;
140 double angle_m;
147 virtual double getRadius(const double &s) override;
152 virtual double getScaleFactor(const double &x, const double &s) override;
159 virtual double getFn(const std::size_t &n,
160 const double &x,
161 const double &s) override;
162};
163
164inline
168inline
170 const std::size_t &maxXorder) {
171 maxOrderX_m = maxXorder;
172}
173inline
175 return maxOrderX_m;
176}
177inline
181inline
185inline
186 void MultipoleTCurvedVarRadius::setBendAngle(const double &angle) {
187 angle_m = angle;
188}
189inline
191 return angle_m;
192}
193inline
195 double &/*startField*/,
196 double &/*endField*/) {
197 RefPartBunch_m = bunch;
198 double length = getLength();
199 varRadiusGeometry_m.setElementLength(2 * getBoundingBoxLength());
200 varRadiusGeometry_m.setRadius(length / angle_m);
201 varRadiusGeometry_m.setS0(length / 2);
202 std::vector<double> fringeLength = getFringeLength();
203 varRadiusGeometry_m.setLambdaLeft(fringeLength[0]);
204 varRadiusGeometry_m.setLambdaRight(fringeLength[1]);
205}
206
207#endif
PartBunch< PLayout_t< double, 3 >, double, 3 > PartBunch_t
ippl::Vector< T, Dim > Vector_t
virtual void visitMultipoleTCurvedVarRadius(const MultipoleTCurvedVarRadius &)=0
Apply the algorithm to an arbitrary curved multipole of variable radius.
PartBunch_t * RefPartBunch_m
Definition Component.h:185
ElementBase(const std::string &name)
Constructor with given name.
double getBoundingBoxLength() const
std::vector< double > getFringeLength() const
double getLength() const
std::vector< polynomial::RecursionRelationTwo > recursion_m
virtual void transformCoords(Vector_t< double, 3 > &R) override
virtual double getScaleFactor(const double &x, const double &s) override
virtual void setBendAngle(const double &angle) override
VarRadiusGeometry & getGeometry() override
virtual void transformBField(Vector_t< double, 3 > &B, const Vector_t< double, 3 > &R) override
virtual double getRadius(const double &s) override
virtual void setMaxOrder(const std::size_t &maxOrder) override
void setMaxXOrder(const std::size_t &maxXOrder)
virtual ElementBase * clone() const override
void accept(BeamlineVisitor &visitor) const override
virtual double getFn(const std::size_t &n, const double &x, const double &s) override
MultipoleTCurvedVarRadius(const std::string &name)
virtual void initialise(PartBunch_t *bunch, double &startField, double &endField) override
MultipoleTCurvedVarRadius operator=(const MultipoleTCurvedVarRadius &rhs)
virtual double getBendAngle() const override