OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
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"
24 #include "Utilities/Options.h"
25 #include "Fields/Fieldmap.h"
27 #include <iostream>
28 #include <fstream>
29 
30 extern Inform *gmsg;
31 
32 // Class SBend
33 // ------------------------------------------------------------------------
34 
36  SBend("")
37 {}
38 
39 SBend::SBend(const SBend &right):
40  Bend2D(right)
41 {
42  setMessageHeader("SBend ");
43 }
44 
45 SBend::SBend(const std::string &name):
46  Bend2D(name)
47 {
48  setMessageHeader("SBend ");
49 }
50 
52 }
53 
54 void SBend::accept(BeamlineVisitor &visitor) const {
55  visitor.visitSBend(*this);
56 }
57 
58 /*
59  * OPAL-MAP methods
60  * ================
61  */
62 double SBend::getNormalComponent(int n) const {
63  return getField().getNormalComponent(n);
64 }
65 
66 double SBend::getSkewComponent(int n) const {
67  return getField().getSkewComponent(n);
68 }
69 
70 void SBend::setNormalComponent(int n, double v) {
72 }
73 
74 void SBend::setSkewComponent(int n, double v) {
75  getField().setSkewComponent(n, v);
76 }
77 
78 
79 /*
80  * OPAL-T Methods.
81  * ===============
82  */
83 
84 /*
85  * This function merely repackages the field arrays as type Vector_t and calls
86  * the equivalent method but with the Vector_t data types.
87  */
88 
90  return SBEND;
91 }
92 
93 
95  double &chordLength) {
96 
97  /*
98  * Find bend chord length. If this was not set by the user using the
99  * L (length) attribute, infer it from the field map.
100  */
101  chordLength = getLength();
102  return true;
103 }
virtual BMultipoleField & getField() override=0
Get multipole expansion of field.
virtual bool findChordLength(Inform &msg, double &chordLength) override
Definition: SBend.cpp:94
virtual ElementBase::ElementType getType() const override
Get element type std::string.
Definition: SBend.cpp:89
void setNormalComponent(int n, double Bn)
Set component.
Inform * gmsg
Definition: Main.cpp:21
double getSkewComponent(int n) const
Get component.
void setNormalComponent(int, double)
Set normal component.
Definition: SBend.cpp:70
void setSkewComponent(int n, double Bn)
Set component.
void setSkewComponent(int, double)
Set skew component.
Definition: SBend.cpp:74
double getNormalComponent(int n) const
Get component.
Definition: Bend2D.h:51
Definition: SBend.h:68
virtual ~SBend()
Definition: SBend.cpp:51
virtual void accept(BeamlineVisitor &) const override
Apply visitor to SBend.
Definition: SBend.cpp:54
double getLength() const
Definition: BendBase.h:70
double getNormalComponent(int) const
Get normal component.
Definition: SBend.cpp:62
const std::string name
virtual void visitSBend(const SBend &)=0
Apply the algorithm to a sector bend.
Abstract algorithm.
Definition: Inform.h:41
SBend()
Definition: SBend.cpp:35
void setMessageHeader(const std::string &header)
Definition: Bend2D.h:339
double getSkewComponent(int) const
Get skew component.
Definition: SBend.cpp:66