OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
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
22
23#include <iosfwd>
24#include <string>
25#include <utility>
26#include <vector>
27
28class Attribute;
29class Statement;
30
31class OpalElement : public Element {
32public:
34 enum {
35 TYPE, // The design type.
36 APERT, // The aperture data.
37 LENGTH, // The element length.
38 ELEMEDGE, // The position of the element (in path length)
39 WAKEF, // The wake function to be used
40 PARTICLEMATTERINTERACTION, // The particle mater interaction handler to be used
41 ORIGIN, // The location of the element in floor coordinates
42 ORIENTATION, // The orientation of the element (Tait Bryan angles)
43 X, // The x-coordinate of the location of the element in floor coordinates
44 Y, // The y-coordinate of the location of the element in floor coordinates
45 Z, // The z-coordinate of the location of the element in floor coordinates
46 THETA, // The rotation about the y-axis
47 PHI, // The rotation about the x-axis
48 PSI, // The rotation about the z-axis
49 DX, // Misalignment in x (local coordinate system)
50 DY, // Misalignment in y (local coordinate system)
51 DZ, // Misalignment in z (local coordinate system)
52 DTHETA, // The rotation around y axis in rad.
53 DPHI, // The rotation around x axis in rad.
54 DPSI, // The rotation around s axis in rad.
55 OUTFN, // Output filename
56 DELETEONTRANSVERSEEXIT, // Flag whether particles should be deleted if exit transversally
57 COMMON
58 };
59
60 virtual ~OpalElement();
61
63 virtual double getLength() const;
64
66 const std::string getTypeName() const;
67
68 // return the element aperture vector
69 std::pair<ApertureType, std::vector<double>> getApert() const;
70
72 const std::string getWakeF() const;
73
74 const std::string getParticleMatterInteraction() const;
75
76 const std::string getWMaterial() const;
77
78 const std::string getWakeGeom() const;
79
80 std::vector<double> getWakeParam() const;
81
82 const std::string getWakeConductivity() const;
83
85 // This special version for elements handles unknown attributes by
86 // appending them to the attribute list.
87 virtual void parse(Statement&);
88
90 // This special version handles special printing in OPAL-8 format.
91 virtual void print(std::ostream&) const;
92
94 virtual void update();
95
97 virtual void updateUnknown(ElementBase*);
98
99protected:
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(
110 std::ostream& os, int order, int& len, const std::string& sName,
111 const std::string& tName, const Attribute& length, const Attribute& vNorm,
112 const Attribute& vSkew);
113
115 static void printAttribute(
116 std::ostream& os, const std::string& name, const std::string& image, int& len);
117
119 static void printAttribute(std::ostream& os, const std::string& name, double value, int& len);
120
121 void registerOwnership() const;
122
123private:
124 // Not implemented.
126 void operator=(const OpalElement&);
127
128 // The original size of the attribute list.
130};
131
132#endif // OPAL_OpalElement_HH
A representation of an Object attribute.
Definition Attribute.h:52
void operator=(const OpalElement &)
std::pair< ApertureType, std::vector< double > > getApert() const
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.
virtual double getLength() const
Return element length.
std::vector< double > getWakeParam() 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.
const std::string getParticleMatterInteraction() const
const std::string getWMaterial() const
const std::string getWakeGeom() const
const std::string getWakeF() const
Return the element's type name.
virtual void updateUnknown(ElementBase *)
Transmit the `‘unknown’' (not known to OPALX) attributes to OPALX.
@ DELETEONTRANSVERSEEXIT
Definition OpalElement.h:56
@ PARTICLEMATTERINTERACTION
Definition OpalElement.h:40
const std::string getTypeName() const
Return the element's type name.
const std::string getWakeConductivity() const
virtual void print(std::ostream &) const
Print the object.
virtual ~OpalElement()
virtual void update()
Update the embedded OPALX element.
void registerOwnership() const
Interface for statements.
Definition Statement.h:37