OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
OpalElement.h
Go to the documentation of this file.
1 //
2 // Class OpalElement
3 // Base class for all beam line elements.
4 //
5 // Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
6 // All rights reserved
7 //
8 // This file is part of OPAL.
9 //
10 // OPAL is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
17 //
18 #ifndef OPAL_OpalElement_HH
19 #define OPAL_OpalElement_HH
20 
23 #include <map>
24 #include <string>
25 
26 class Statement;
27 
28 class OpalElement: public Element {
29 
30 public:
31 
33  enum {
34  TYPE, // The design type.
35  APERT, // The aperture data.
36  LENGTH, // The element length.
37  ELEMEDGE, // The position of the element (in path length)
38  WAKEF, // The wake function to be used
39  PARTICLEMATTERINTERACTION, // The particle mater interaction handler to be used
40  ORIGIN, // The location of the element in floor coordinates
41  ORIENTATION, // The orientation of the element (Tait Bryan angles)
42  X, // The x-coordinate of the location of the element in floor coordinates
43  Y, // The y-coordinate of the location of the element in floor coordinates
44  Z, // The z-coordinate of the location of the element in floor coordinates
45  THETA, // The rotation about the y-axis
46  PHI, // The rotation about the x-axis
47  PSI, // The rotation about the z-axis
48  DX, // Misalignment in x (local coordinate system)
49  DY, // Misalignment in y (local coordinate system)
50  DZ, // Misalignment in z (local coordinate system)
51  DTHETA, // The rotation around y axis in rad.
52  DPHI, // The rotation around x axis in rad.
53  DPSI, // The rotation around s axis in rad.
54  OUTFN, // Output filename
55  DELETEONTRANSVERSEEXIT, // Flag whether particles should be deleted if exit transversally
57  };
58 
59  virtual ~OpalElement();
60 
62  virtual double getLength() const;
63 
65  const std::string getTypeName() const;
66 
67  //return the element aperture vector
68  std::pair<ApertureType, std::vector<double> > getApert() const;
69 
71  const std::string getWakeF() const;
72 
73  const std::string getParticleMatterInteraction() const;
74 
75  const std::string getWMaterial() const;
76 
77  const std::string getWakeGeom() const;
78 
79  std::vector<double> getWakeParam() const;
80 
81  const std::string getWakeConductivity() const;
82 
84  // This special version for elements handles unknown attributes by
85  // appending them to the attribute list.
86  virtual void parse(Statement&);
87 
89  // This special version handles special printing in OPAL-8 format.
90  virtual void print(std::ostream&) const;
91 
93  virtual void update();
94 
96  virtual void updateUnknown(ElementBase*);
97 
98 protected:
99 
101  OpalElement(int size, const char* name, const char* help);
102 
104  OpalElement(const std::string& name, OpalElement* parent);
105 
107  // This function is accessible to all multipole-like elements
108  // (RBend, SBend, Quadrupole, Sextupole, Octupole, Multipole).
109  static void printMultipoleStrength(std::ostream& os,
110  int order,
111  int& len,
112  const std::string& sName,
113  const std::string& tName,
114  const Attribute& length,
115  const Attribute& vNorm,
116  const Attribute& vSkew);
117 
119  static void printAttribute(std::ostream& os,
120  const std::string& name,
121  const std::string& image,
122  int& len);
123 
125  static void printAttribute(std::ostream& os,
126  const std::string& name,
127  double value,
128  int& len);
129 
130  void registerOwnership() const;
131 
132 private:
133 
134  // Not implemented.
135  OpalElement();
136  void operator=(const OpalElement&);
137 
138  // The original size of the attribute list.
139  int itsSize;
140 };
141 
142 #endif // OPAL_OpalElement_HH
const std::string getWakeConductivity() const
std::pair< ApertureType, std::vector< double > > getApert() const
void operator=(const OpalElement &)
virtual void print(std::ostream &) const
Print the object.
std::vector< double > getWakeParam() const
virtual ~OpalElement()
const std::string getTypeName() const
Return the element&#39;s type name.
const std::string getWakeGeom() const
const std::string getWakeF() const
Return the element&#39;s type name.
Interface for statements.
Definition: Statement.h:38
const std::string name
static void printMultipoleStrength(std::ostream &os, int order, int &len, const std::string &sName, const std::string &tName, const Attribute &length, const Attribute &vNorm, const Attribute &vSkew)
Print multipole components in OPAL-8 format.
const std::string getWMaterial() const
static void printAttribute(std::ostream &os, const std::string &name, const std::string &image, int &len)
Print an attribute with a OPAL-8 name (as an expression).
virtual void parse(Statement &)
Parse the element.
virtual void updateUnknown(ElementBase *)
Transmit the ``unknown&#39;&#39; (not known to OPAL) attributes to CLASSIC.
virtual double getLength() const
Return element length.
const std::string getParticleMatterInteraction() const
virtual void update()
Update the embedded CLASSIC element.
void registerOwnership() const
A representation of an Object attribute.
Definition: Attribute.h:52