OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
ClassicField.h
Go to the documentation of this file.
1 #ifndef CLASSIC_FIELD_H
2 #define CLASSIC_FIELD_H
3 
4 #include <list>
5 #include <memory>
7 
8 class ClassicField {
9 public:
10  ClassicField(std::shared_ptr<Component>, const double &, const double &);
11  ~ClassicField();
12  std::shared_ptr<Component> getElement();
13  std::shared_ptr<const Component> getElement() const;
14  double getLength() const;
15  const double &getStart() const;
16  const double &getEnd() const;
17  void setStart(const double & z);
18  void setEnd(const double & z);
19  const bool &isOn() const;
20  void setOn(const double &kinematicEnergy);
21  void setOff();
22 
23  static bool SortAsc(const ClassicField &fle1, const ClassicField &fle2) {
24  return (fle1.start_m < fle2.start_m
25  || (fle1.start_m == fle2.start_m && fle1.element_m->getName() < fle2.element_m->getName()));
26  }
27 
28  static bool ZeroLength(const ClassicField &fle) {
29  return (fle.getLength() < 1.e-6);
30  }
31 
33 
34  unsigned int order_m;
35 private:
36  std::shared_ptr<Component> element_m;
37  double start_m;
38  double end_m;
39  bool is_on_m;
40 };
41 
42 typedef std::list<ClassicField> FieldList;
43 
44 inline std::shared_ptr<Component> ClassicField::getElement() {
45  return element_m;
46 }
47 
48 inline std::shared_ptr<const Component> ClassicField::getElement() const {
49  return element_m;
50 }
51 
52 inline double ClassicField::getLength() const {
53  return end_m - start_m;
54 }
55 
56 inline const double &ClassicField::getStart() const {
57  return start_m;
58 }
59 
60 inline const double &ClassicField::getEnd() const {
61  return end_m;
62 }
63 
64 inline const bool &ClassicField::isOn() const {
65  return is_on_m;
66 }
67 
68 inline void ClassicField::setStart(const double & z) {
69  start_m = z;
70 }
71 
72 inline void ClassicField::setEnd(const double & z) {
73  end_m = z;
74 }
75 
76 inline
78  return element_m->getBoundingBoxInLabCoords();
79 }
80 #endif // CLASSIC_FIELD_H
std::list< ClassicField > FieldList
Definition: ClassicField.h:42
const double & getEnd() const
Definition: ClassicField.h:60
void setOn(const double &kinematicEnergy)
static bool SortAsc(const ClassicField &fle1, const ClassicField &fle2)
Definition: ClassicField.h:23
std::shared_ptr< Component > element_m
Definition: ClassicField.h:36
void setStart(const double &z)
Definition: ClassicField.h:68
const double & getStart() const
Definition: ClassicField.h:56
double getLength() const
Definition: ClassicField.h:52
double start_m
Definition: ClassicField.h:37
void setEnd(const double &z)
Definition: ClassicField.h:72
const bool & isOn() const
Definition: ClassicField.h:64
double end_m
Definition: ClassicField.h:38
ClassicField(std::shared_ptr< Component >, const double &, const double &)
Definition: ClassicField.cpp:5
unsigned int order_m
Definition: ClassicField.h:34
ElementBase::BoundingBox getBoundingBoxInLabCoords() const
Definition: ClassicField.h:77
static bool ZeroLength(const ClassicField &fle)
Definition: ClassicField.h:28
std::shared_ptr< Component > getElement()
Definition: ClassicField.h:44