OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
SBend3D.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, Chris Rogers
3  * All rights reserved.
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  * 1. Redistributions of source code must retain the above copyright notice,
7  * this list of conditions and the following disclaimer.
8  * 2. Redistributions in binary form must reproduce the above copyright notice,
9  * this list of conditions and the following disclaimer in the documentation
10  * and/or other materials provided with the distribution.
11  * 3. Neither the name of STFC nor the names of its contributors may be used to
12  * endorse or promote products derived from this software without specific
13  * prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  * POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #include "Fields/BMultipoleField.h"
31 #include "AbsBeamline/Component.h"
32 
33 #ifndef ABSBEAMLINE_SBEND3D_H
34 #define ABSBEAMLINE_SBEND3D_H
35 
50 class SBend3D : public Component {
51  public:
56  explicit SBend3D(const std::string &name);
57 
59  SBend3D(const SBend3D &right);
60 
62  ~SBend3D();
63 
65  ElementBase* clone() const override;
66 
76  bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) override;
77 
86  bool apply(const Vector_t &R, const Vector_t &P, const double &t,
87  Vector_t &E, Vector_t &B) override;
88 
95  void initialise(PartBunchBase<double, 3> *bunch, double &startField, double &endField) override;
96 
98  void finalise() override;
99 
101  inline bool bends() const override;
102 
104  void getDimensions(double &zBegin, double &zEnd) const override {}
105 
107  BGeometryBase& getGeometry() override;
108 
110  const BGeometryBase& getGeometry() const override;
111 
113  EMField &getField() override;
114 
116  const EMField &getField() const override;
117 
119  void accept(BeamlineVisitor& visitor) const override;
120 
128  void setFieldMapFileName(std::string name);
129 
131  inline std::string getFieldMapFileName() const;
132 
134  double getLengthUnits() const {return lengthUnits_m;}
135 
137  void setLengthUnits(double lengthUnits) {lengthUnits_m = lengthUnits;}
138 
140  double getFieldUnits() const {return fieldUnits_m;}
141 
143  void setFieldUnits(double fieldUnits) {fieldUnits_m = fieldUnits;}
144 
146  int getPolynomialOrder() const {return polyOrder_m;}
147 
149  void setPolynomialOrder(int polyOrder) {polyOrder_m = polyOrder;}
150 
152  int getSmoothingOrder() const {return smoothOrder_m;}
153 
155  void setSmoothingOrder(int polyOrder) {smoothOrder_m = polyOrder;}
156 
159 
160  private:
162  // Geometry
164  // Units used for field maps
165  double fieldUnits_m;
167  // Polynomial interpolation
170  // Not implemented (I think this is something to do with error fields?)
172 };
173 
174 std::string SBend3D::getFieldMapFileName() const {
175  return map_m->getFieldMapFileName();
176 }
177 
178 #endif
EMField & getField() override
Definition: SBend3D.cpp:60
handles field map grids with sector geometry
Interface for basic beam line object.
Definition: ElementBase.h:128
void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
Definition: SBend3D.cpp:79
int polyOrder_m
Definition: SBend3D.h:168
A simple arc in the XZ plane.
void accept(BeamlineVisitor &visitor) const override
Definition: SBend3D.cpp:119
SBend3D(const std::string &name)
Definition: SBend3D.cpp:32
void setSmoothingOrder(int polyOrder)
Definition: SBend3D.h:155
bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) override
Definition: SBend3D.cpp:68
void getDimensions(double &zBegin, double &zEnd) const override
Definition: SBend3D.h:104
PlanarArcGeometry planarArcGeometry_m
Definition: SBend3D.h:163
std::string getFieldMapFileName() const
Definition: SBend3D.h:174
double lengthUnits_m
Definition: SBend3D.h:166
void setFieldUnits(double fieldUnits)
Definition: SBend3D.h:143
std::string getFieldMapFileName() const
double fieldUnits_m
Definition: SBend3D.h:165
int getSmoothingOrder() const
Definition: SBend3D.h:152
Abstract base class for accelerator geometry classes.
Definition: Geometry.h:43
double getLengthUnits() const
Definition: SBend3D.h:134
void setPolynomialOrder(int polyOrder)
Definition: SBend3D.h:149
void finalise() override
Definition: SBend3D.cpp:83
double smoothOrder_m
Definition: SBend3D.h:169
SectorMagneticFieldMap * map_m
Definition: SBend3D.h:161
~SBend3D()
Definition: SBend3D.cpp:51
SectorMagneticFieldMap * getSectorMagneticFieldMap() const
Definition: SBend3D.h:158
double getFieldUnits() const
Definition: SBend3D.h:140
Abstract base class for electromagnetic fields.
Definition: EMField.h:188
BMultipoleField dummy
Definition: SBend3D.h:171
void setLengthUnits(double lengthUnits)
Definition: SBend3D.h:137
The magnetic field of a multipole.
const std::string name
BGeometryBase & getGeometry() override
Definition: SBend3D.cpp:91
int getPolynomialOrder() const
Definition: SBend3D.h:146
Interface for a single beam element.
Definition: Component.h:51
ElementBase * clone() const override
Definition: SBend3D.cpp:55
Abstract algorithm.
bool bends() const override
Definition: SBend3D.cpp:87
void setFieldMapFileName(std::string name)
Definition: SBend3D.cpp:99