OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
OpalDrift.cpp
Go to the documentation of this file.
1//
2// Class OpalDrift
3// The class of OPAL drift spaces.
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#include "Elements/OpalDrift.h"
21
23 OpalElement(SIZE, "DRIFT",
24 "The \"DRIFT\" element defines a drift space.")
25{
27 ("GEOMETRY", "BoundaryGeometry for Drifts");
28
30 ("NSLICES", "The number of slices/ steps for this element in Map Tracking", 1);
31
33
34 setElement(new DriftRep("DRIFT"));
35}
36
37
38OpalDrift::OpalDrift(const std::string& name, OpalDrift* parent):
39 OpalElement(name, parent)
40{
41 setElement(new DriftRep(name));
42}
43
44
47
48
49OpalDrift* OpalDrift::clone(const std::string& name) {
50 return new OpalDrift(name, this);
51}
52
53
54bool OpalDrift::isDrift() const {
55 return true;
56}
57
58
61
62 // DriftRep* drf = static_cast<DriftRep*>(getElement());
63
64 //drf->setElementLength(Attributes::getReal(itsAttr[LENGTH]));
65
66 auto drf = getElement();
67 if (drf) {
69 drf->setElementLength(L);
70 }
71 else
72 std::cout << "error drf->setElementLength " << std::endl;
73
74 // Transmit "unknown" attributes.
76}
double getReal(const Attribute &attr)
Return real value.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
ElementBase * getElement() const
Return the embedded CLASSIC element.
Definition Element.h:121
void setElement(ElementBase *)
Assign new CLASSIC element.
Definition Element.h:126
std::vector< Attribute > itsAttr
The object attributes.
Definition Object.h:216
virtual bool isDrift() const
Test for drift.
Definition OpalDrift.cpp:54
virtual void update()
Update the embedded CLASSIC drift.
Definition OpalDrift.cpp:59
OpalDrift()
Exemplar constructor.
Definition OpalDrift.cpp:22
virtual ~OpalDrift()
Definition OpalDrift.cpp:45
virtual OpalDrift * clone(const std::string &name)
Make clone.
Definition OpalDrift.cpp:49
virtual void updateUnknown(ElementBase *)
Transmit the ``unknown'' (not known to OPAL) attributes to CLASSIC.
virtual void update()
Update the embedded CLASSIC element.
OpalElement(int size, const char *name, const char *help)
Exemplar constructor.
void registerOwnership() const