OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Solenoid.h
Go to the documentation of this file.
1#ifndef CLASSIC_Solenoid_HH
2#define CLASSIC_Solenoid_HH
3
4// ------------------------------------------------------------------------
5// $RCSfile: Solenoid.h,v $
6// ------------------------------------------------------------------------
7// $Revision: 1.1.1.1 $
8// ------------------------------------------------------------------------
9// Copyright: see Copyright.readme
10// ------------------------------------------------------------------------
11//
12// Class: Solenoid
13// Defines the abstract interface for a solenoid magnet.
14//
15// ------------------------------------------------------------------------
16// Class category: AbsBeamline
17// ------------------------------------------------------------------------
18//
19// $Date: 2000/03/27 09:32:32 $
20// $Author: fci $
21//
22// ------------------------------------------------------------------------
23
25
26template <class T, unsigned Dim>
27class PartBunchBase;
28class Fieldmap;
29
30// Class Solenoid
31// ------------------------------------------------------------------------
33// Class Solenoid defines the abstract interface for solenoid magnets.
34
35
36class Solenoid: public Component {
37
38public:
39
41 explicit Solenoid(const std::string &name);
42
43 Solenoid();
44 Solenoid(const Solenoid &);
45 virtual ~Solenoid();
46
48 virtual void accept(BeamlineVisitor &) const override;
49
51 virtual double getBz() const = 0;
52
53 void setKS(double ks);
54 void setDKS(double ks);
55
56 virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) override;
57
58 virtual bool apply(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override;
59
60 virtual bool applyToReferenceParticle(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override;
61
62 virtual void initialise(PartBunchBase<double, 3> *bunch, double &startField, double &endField) override;
63
64 virtual void finalise() override;
65
66 virtual bool bends() const override;
67
68 virtual void goOnline(const double &kineticEnergy) override;
69
70 virtual void goOffline() override;
71
72 // Assign the field filename.
73 void setFieldMapFN(std::string fn);
74
75 void setFast(bool fast);
76
77 bool getFast() const;
78
79 virtual ElementType getType() const override;
80
81 virtual void getDimensions(double &zBegin, double &zEnd) const override;
82
83 virtual bool isInside(const Vector_t &r) const override;
84
85 virtual void getElementDimensions(double &zBegin, double &zEnd) const override;
86
87 virtual CoordinateSystemTrafo getEdgeToBegin() const override;
88 virtual CoordinateSystemTrafo getEdgeToEnd() const override;
89
90private:
91
92 // std::string name; /**< The name of the object*/
93 std::string filename_m;
95 double scale_m;
96 double scaleError_m;
98 double startField_m;
100 bool fast_m;
101 // Not implemented.
102 void operator=(const Solenoid &);
103};
104
105
106
107inline
109{
111 Quaternion(1, 0, 0, 0));
112
113 return ret;
114}
115
116inline
118{
120 Quaternion(1, 0, 0, 0));
121
122 return ret;
123}
124#endif // CLASSIC_Solenoid_HH
ElementType
Definition: ElementBase.h:88
const std::string name
Interface for a single beam element.
Definition: Component.h:50
virtual double getElementLength() const
Get design length.
Definition: ElementBase.h:414
Interface for solenoids.
Definition: Solenoid.h:36
virtual double getBz() const =0
Get solenoid field Bz in Teslas.
virtual void getDimensions(double &zBegin, double &zEnd) const override
Definition: Solenoid.cpp:167
virtual CoordinateSystemTrafo getEdgeToBegin() const override
Definition: Solenoid.h:108
double scaleError_m
Definition: Solenoid.h:96
void setFast(bool fast)
Definition: Solenoid.cpp:75
virtual void getElementDimensions(double &zBegin, double &zEnd) const override
Definition: Solenoid.cpp:182
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) override
Definition: Solenoid.cpp:84
double startField_m
Definition: Solenoid.h:98
virtual void goOffline() override
Definition: Solenoid.cpp:154
virtual ~Solenoid()
Definition: Solenoid.cpp:62
virtual void goOnline(const double &kineticEnergy) override
Definition: Solenoid.cpp:149
virtual void finalise() override
Definition: Solenoid.cpp:141
bool fast_m
Definition: Solenoid.h:100
Fieldmap * myFieldmap_m
Definition: Solenoid.h:94
virtual bool applyToReferenceParticle(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override
Definition: Solenoid.cpp:104
virtual CoordinateSystemTrafo getEdgeToEnd() const override
Definition: Solenoid.h:117
bool getFast() const
Definition: Solenoid.cpp:80
virtual bool bends() const override
Definition: Solenoid.cpp:144
void setDKS(double ks)
Definition: Solenoid.cpp:163
virtual ElementType getType() const override
Get element type std::string.
Definition: Solenoid.cpp:173
virtual bool isInside(const Vector_t &r) const override
Definition: Solenoid.cpp:177
Solenoid()
Definition: Solenoid.cpp:35
std::string filename_m
Definition: Solenoid.h:93
void setKS(double ks)
Definition: Solenoid.cpp:159
void setFieldMapFN(std::string fn)
Definition: Solenoid.cpp:71
void operator=(const Solenoid &)
virtual void accept(BeamlineVisitor &) const override
Apply visitor to Solenoid.
Definition: Solenoid.cpp:67
double scale_m
Definition: Solenoid.h:95
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
Definition: Solenoid.cpp:119
Vektor< double, 3 > Vector_t
Definition: Vektor.h:6