OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
SBend.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: SBend.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Definitions for class: SBend
10 // Defines the abstract interface for a sector bend magnet.
11 //
12 // ------------------------------------------------------------------------
13 // Class category: AbsBeamline
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:32:31 $
17 // $Author: fci $
18 //
19 // ------------------------------------------------------------------------
20 
21 #include "AbsBeamline/SBend.h"
23 #include "Fields/Fieldmap.h"
24 
25 #include <string>
26 
27 extern Inform *gmsg;
28 
29 // Class SBend
30 // ------------------------------------------------------------------------
31 
33  SBend("")
34 {}
35 
36 SBend::SBend(const SBend &right):
37  Bend2D(right)
38 {
39  setMessageHeader("SBend ");
40 }
41 
42 SBend::SBend(const std::string &name):
43  Bend2D(name)
44 {
45  setMessageHeader("SBend ");
46 }
47 
49 }
50 
51 void SBend::accept(BeamlineVisitor &visitor) const {
52  visitor.visitSBend(*this);
53 }
54 
55 /*
56  * OPAL-MAP methods
57  * ================
58  */
59 double SBend::getNormalComponent(int n) const {
60  return getField().getNormalComponent(n);
61 }
62 
63 double SBend::getSkewComponent(int n) const {
64  return getField().getSkewComponent(n);
65 }
66 
67 void SBend::setNormalComponent(int n, double v) {
69 }
70 
71 void SBend::setSkewComponent(int n, double v) {
73 }
74 
75 
76 /*
77  * OPAL-T Methods.
78  * ===============
79  */
80 
81 /*
82  * This function merely repackages the field arrays as type Vector_t and calls
83  * the equivalent method but with the Vector_t data types.
84  */
85 
87  return SBEND;
88 }
89 
90 
91 bool SBend::findChordLength(double &chordLength) {
92 
93  /*
94  * Find bend chord length. If this was not set by the user using the
95  * L (length) attribute, infer it from the field map.
96  */
97  chordLength = getElementLength();
98  return true;
99 }
Inform * gmsg
Definition: Main.cpp:62
const std::string name
virtual void visitSBend(const SBend &)=0
Apply the algorithm to a sector bend.
Definition: Bend2D.h:51
void setMessageHeader(const std::string &header)
Definition: Bend2D.h:314
virtual double getElementLength() const
Get design length.
Definition: ElementBase.h:432
Definition: SBend.h:68
virtual ElementBase::ElementType getType() const override
Get element type std::string.
Definition: SBend.cpp:86
SBend()
Definition: SBend.cpp:32
void setSkewComponent(int, double)
Set skew component.
Definition: SBend.cpp:71
virtual ~SBend()
Definition: SBend.cpp:48
virtual void accept(BeamlineVisitor &) const override
Apply visitor to SBend.
Definition: SBend.cpp:51
double getSkewComponent(int) const
Get skew component.
Definition: SBend.cpp:63
virtual bool findChordLength(double &chordLength) override
Definition: SBend.cpp:91
double getNormalComponent(int) const
Get normal component.
Definition: SBend.cpp:59
virtual BMultipoleField & getField() override=0
Get multipole expansion of field.
void setNormalComponent(int, double)
Set normal component.
Definition: SBend.cpp:67
double getNormalComponent(int n) const
Get component.
double getSkewComponent(int n) const
Get component.
void setNormalComponent(int n, double Bn)
Set component.
void setSkewComponent(int n, double Bn)
Set component.
Definition: Inform.h:42