OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
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
80#include "Algorithms/Vektor.h"
83#include <vector>
84
86public:
90 explicit MultipoleTCurvedVarRadius(const std::string &name);
96 virtual ElementBase* clone() const override;
98 void accept(BeamlineVisitor &visitor) const override;
100 VarRadiusGeometry& getGeometry() override;
102 const VarRadiusGeometry& getGeometry() const override;
107 virtual void setMaxOrder(const std::size_t &maxOrder) override;
109 std::size_t getMaxXOrder() const;
113 void setMaxXOrder(const std::size_t &maxXOrder);
115 virtual void setBendAngle(const double &angle) override;
117 virtual double getBendAngle() const override;
123 virtual void initialise(PartBunchBase<double, 3>* bunch,
124 double &startField,
125 double &endField) override;
126private:
129 std::size_t maxOrderX_m;
131 std::vector<polynomial::RecursionRelationTwo> recursion_m;
135 virtual void transformCoords(Vector_t &R) override;
137 virtual void transformBField(Vector_t &B, const Vector_t &R) override;
138 double angle_m;
145 virtual double getRadius(const double &s) override;
150 virtual double getScaleFactor(const double &x, const double &s) override;
157 virtual double getFn(const std::size_t &n,
158 const double &x,
159 const double &s) override;
160};
161
162inline
164 visitor.visitMultipoleTCurvedVarRadius(*this);
165}
166inline
168 const std::size_t &maxXorder) {
169 maxOrderX_m = maxXorder;
170}
171inline
173 return maxOrderX_m;
174}
175inline
177 return varRadiusGeometry_m;
178}
179inline
181 return varRadiusGeometry_m;
182}
183inline
184 void MultipoleTCurvedVarRadius::setBendAngle(const double &angle) {
185 angle_m = angle;
186}
187inline
189 return angle_m;
190}
191inline
193 double &/*startField*/,
194 double &/*endField*/) {
195 RefPartBunch_m = bunch;
196 double length = getLength();
199 varRadiusGeometry_m.setS0(length / 2);
200 std::vector<double> fringeLength = getFringeLength();
201 varRadiusGeometry_m.setLambdaLeft(fringeLength[0]);
202 varRadiusGeometry_m.setLambdaRight(fringeLength[1]);
203}
204
205#endif
const std::string name
virtual void visitMultipoleTCurvedVarRadius(const MultipoleTCurvedVarRadius &)=0
Apply the algorithm to an arbitrary curved multipole of variable radius.
PartBunchBase< double, 3 > * RefPartBunch_m
Definition: Component.h:191
double getBoundingBoxLength() const
std::vector< double > getFringeLength() const
double getLength() const
std::vector< polynomial::RecursionRelationTwo > recursion_m
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 &B, const Vector_t &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 void transformCoords(Vector_t &R) override
virtual double getFn(const std::size_t &n, const double &x, const double &s) override
MultipoleTCurvedVarRadius(const std::string &name)
MultipoleTCurvedVarRadius operator=(const MultipoleTCurvedVarRadius &rhs)
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
virtual double getBendAngle() const override
void setS0(const double &s_0)
virtual void setElementLength(double length)
void setLambdaRight(const double &lambda_right)
void setLambdaLeft(const double &lambda_left)
void setRadius(const double &rho)