OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
BeamlineFieldElement.h
Go to the documentation of this file.
1#ifndef OPALX_BeamlineFieldElement_H
2#define OPALX_BeamlineFieldElement_H
3
4#include <list>
5#include <memory>
8
17public:
18 BeamlineFieldElement(std::shared_ptr<Component>, const double&, const double&);
20 std::shared_ptr<Component> getElement();
21 std::shared_ptr<const Component> getElement() const;
22 double getLength() const;
23 const double& getStart() const;
24 const double& getEnd() const;
25 void setStart(const double& z);
26 void setEnd(const double& z);
27 const bool& isOn() const;
28 void setOn(const double& kinematicEnergy);
29 void setOff();
30
31 static bool SortAsc(const BeamlineFieldElement& fle1, const BeamlineFieldElement& fle2) {
32 return (fle1.start_m < fle2.start_m
33 || (fle1.start_m == fle2.start_m
34 && fle1.element_m->getName() < fle2.element_m->getName()));
35 }
36
37 static bool ZeroLength(const BeamlineFieldElement& fle) { return (fle.getLength() < 1.e-6); }
38
40
41 unsigned int order_m;
42
43private:
44 std::shared_ptr<Component> element_m;
45 double start_m;
46 double end_m;
47 bool is_on_m;
48};
49
50using FieldList = std::list<BeamlineFieldElement>;
51
52inline std::shared_ptr<Component> BeamlineFieldElement::getElement() { return element_m; }
53
54inline std::shared_ptr<const Component> BeamlineFieldElement::getElement() const {
55 return element_m;
56}
57
58inline double BeamlineFieldElement::getLength() const { return end_m - start_m; }
59
60inline const double& BeamlineFieldElement::getStart() const { return start_m; }
61
62inline const double& BeamlineFieldElement::getEnd() const { return end_m; }
63
64inline const bool& BeamlineFieldElement::isOn() const { return is_on_m; }
65
66inline void BeamlineFieldElement::setStart(const double& z) { start_m = z; }
67
68inline void BeamlineFieldElement::setEnd(const double& z) { end_m = z; }
69
71 return element_m->getBoundingBoxInLabCoords();
72}
73#endif // OPALX_BeamlineFieldElement_H
std::list< BeamlineFieldElement > FieldList
Defines the abstract interface for a single beamline component in the accelerator model.
Beamline component together with its active longitudinal field interval.
void setOn(const double &kinematicEnergy)
std::shared_ptr< Component > element_m
std::shared_ptr< Component > getElement()
BoundingBox getBoundingBoxInLabCoords() const
const bool & isOn() const
void setEnd(const double &z)
static bool SortAsc(const BeamlineFieldElement &fle1, const BeamlineFieldElement &fle2)
void setStart(const double &z)
const double & getStart() const
static bool ZeroLength(const BeamlineFieldElement &fle)
const double & getEnd() const