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