OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
MultipoleT.h
Go to the documentation of this file.
1//
2// Cubic Spline Interpolation to replace GSL spline
3//
4// Copyright (c) 2023, Paul Scherrer Institute, Villigen PSI, Switzerland
5// All rights reserved
6//
7// This file is part of OPAL.
8//
9// OPAL is free software: you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation, either version 3 of the License, or
12// (at your option) any later version.
13//
14// You should have received a copy of the GNU General License
15// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
16//
17
18#ifndef ABSBEAMLINE_MULTIPOLET_H
19#define ABSBEAMLINE_MULTIPOLET_H
20
65#include <vector>
69#include "MultipoleTBase.h"
70#include "MultipoleTConfig.h"
71
72class MultipoleT : public Component {
73public:
77 explicit MultipoleT(const std::string& name);
79 MultipoleT(const MultipoleT& right);
81 ~MultipoleT() override = default;
83 ElementBase* clone() const override;
85 void accept(BeamlineVisitor& visitor) const override;
87 BGeometryBase& getGeometry() override;
89 const BGeometryBase& getGeometry() const override;
91 EMField& getField() override { return dummy; }
93 const EMField& getField() const override { return dummy; }
95 bool apply(const std::shared_ptr<ParticleContainer_t>& pc) override;
105 bool apply(
106 const Vector_t<double, 3>& R, const Vector_t<double, 3>& P, const double& t,
119 bool apply(const size_t& i, const double& t, Vector_t<double, 3>& E, Vector_t<double, 3>& B)
120 override;
126 void initialise(PartBunch_t* bunch, double& startField, double& endField) override;
128 void finalise() override;
130 bool bends() const override;
132 size_t getMaxFOrder() const { return config_m.maxFOrder_m; }
133 size_t getMaxXOrder() const { return config_m.maxXOrder_m; }
138 void setMaxOrder(size_t orderZ, size_t orderX);
144 void setTransProfile(const std::vector<double>& profile);
146 const Kokkos::Array<double, MultipoleTConfig::NumPoles>& getTransProfile() const {
148 }
149
158 void setFringeField(const double& s0, const double& lambda_left, const double& lambda_right);
162 std::tuple<double, double, double> getFringeField() const;
166 void setEntranceAngle(double entranceAngle);
170 void setEntryOffset(double offset);
172 double getEntryOffset() const { return config_m.entryOffset_m; }
176 void setBendAngle(double angle, bool variableRadius);
178 double getBendAngle() const { return config_m.bendAngle_m; }
180 double getEntranceAngle() const { return config_m.entranceAngle_m; }
185 void setElementLength(double length) override;
187 double getLength() const { return config_m.length_m; }
193 void setAperture(const double& vertAp, const double& horizAp);
197 std::tuple<double, double> getAperture() {
199 }
200
205 void setRotation(double rot);
207 double getRotation() const { return config_m.rotation_m; }
213 void setBoundingBoxLength(double boundingBoxLength);
220 void getFieldExtend(double& zBegin, double& zEnd) const override {
221 zBegin = 0.0;
222 zEnd = getElementLength();
223 }
224
225 void setScalingName(const std::string& name);
226 std::string getScalingName() const { return scalingName_m; }
227 void initialiseTimeDependencies() const;
228
230
231protected:
234
236 double getScaling(double t) const;
237 void validateConfiguration() const;
238
241
242 // Time dependence
243 std::string scalingName_m;
244 mutable std::shared_ptr<AbstractTimeDependence> scalingTD_m;
245
246 // The object that does the work
247 std::unique_ptr<MultipoleTBase> implementation_{};
248};
249#endif
Defines the abstract interface for a single beamline component in the accelerator model.
ippl::Vector< T, Dim > Vector_t
Abstract base class for accelerator geometry classes.
Definition Geometry.h:42
The magnetic field of a multipole.
Abstract base class for electromagnetic fields.
Definition EMField.h:171
virtual double getElementLength() const
Get design length.
void setRotation(double rot)
std::size_t getTransMaxOrder() const
Definition MultipoleT.h:140
double getBoundingBoxLength() const
Definition MultipoleT.h:209
void setScalingName(const std::string &name)
BMultipoleField dummy
Definition MultipoleT.h:240
size_t getMaxFOrder() const
Definition MultipoleT.h:132
const EMField & getField() const override
Definition MultipoleT.h:93
bool getVariableRadius() const
Definition MultipoleT.h:174
void setBendAngle(double angle, bool variableRadius)
void setElementLength(double length) override
void initialise(PartBunch_t *bunch, double &startField, double &endField) override
void setEntranceAngle(double entranceAngle)
MultipoleTConfig & getConfig()
Definition MultipoleT.h:229
ElementBase * clone() const override
std::tuple< double, double > getAperture()
Definition MultipoleT.h:197
const Kokkos::Array< double, MultipoleTConfig::NumPoles > & getTransProfile() const
Definition MultipoleT.h:146
std::string scalingName_m
Definition MultipoleT.h:243
double getLength() const
Definition MultipoleT.h:187
EMField & getField() override
Definition MultipoleT.h:91
void accept(BeamlineVisitor &visitor) const override
MultipoleTConfig config_m
Definition MultipoleT.h:233
void setAperture(const double &vertAp, const double &horizAp)
void setMaxOrder(size_t orderZ, size_t orderX)
void initialiseTimeDependencies() const
double getScaling(double t) const
void finalise() override
~MultipoleT() override=default
void getFieldExtend(double &zBegin, double &zEnd) const override
Definition MultipoleT.h:220
size_t getMaxXOrder() const
Definition MultipoleT.h:133
BGeometryBase & getGeometry() override
bool bends() const override
double getRotation() const
Definition MultipoleT.h:207
std::shared_ptr< AbstractTimeDependence > scalingTD_m
Definition MultipoleT.h:244
void chooseImplementation()
std::string getScalingName() const
Definition MultipoleT.h:226
double getEntranceAngle() const
Definition MultipoleT.h:180
void setFringeField(const double &s0, const double &lambda_left, const double &lambda_right)
bool apply(const std::shared_ptr< ParticleContainer_t > &pc) override
std::tuple< double, double, double > getFringeField() const
double getBendAngle() const
Definition MultipoleT.h:178
void setEntryOffset(double offset)
void validateConfiguration() const
void setBoundingBoxLength(double boundingBoxLength)
double getEntryOffset() const
Definition MultipoleT.h:172
void setTransProfile(const std::vector< double > &profile)
std::unique_ptr< MultipoleTBase > implementation_
Definition MultipoleT.h:247
unsigned int maxXOrder_m
unsigned int maxFOrder_m
unsigned int transverseProfileMaxOrder_m
Kokkos::Array< double, NumPoles > transverseProfile_m