OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
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", "The \"DRIFT\" element defines a drift space.") {
24 itsAttr[GEOMETRY] = Attributes::makeString("GEOMETRY", "BoundaryGeometry for Drifts");
25
27 "NSLICES", "The number of slices/ steps for this element in Map Tracking", 1);
28
30
31 setElement(new DriftRep("DRIFT"));
32}
33
34OpalDrift::OpalDrift(const std::string& name, OpalDrift* parent) : OpalElement(name, parent) {
35 setElement(new DriftRep(name));
36}
37
39
40OpalDrift* OpalDrift::clone(const std::string& name) { return new OpalDrift(name, this); }
41
42bool OpalDrift::isDrift() const { return true; }
43
46
47 // DriftRep* drf = static_cast<DriftRep*>(getElement());
48
49 // drf->setElementLength(Attributes::getReal(itsAttr[LENGTH]));
50
51 auto drf = getElement();
52 if (drf) {
54 drf->setElementLength(L);
55 } else
56 std::cout << "error drf->setElementLength " << std::endl;
57
58 // Transmit "unknown" attributes.
60}
@ SIZE
Definition IndexMap.cpp:179
ElementBase * getElement() const
Return the embedded OPALX element.
Definition Element.h:119
void setElement(ElementBase *)
Assign new OPALX element.
Definition Element.h:123
std::vector< Attribute > itsAttr
The object attributes.
Definition Object.h:210
virtual bool isDrift() const
Test for drift.
Definition OpalDrift.cpp:42
virtual void update()
Update the embedded OPALX drift.
Definition OpalDrift.cpp:44
OpalDrift()
Exemplar constructor.
Definition OpalDrift.cpp:22
virtual ~OpalDrift()
Definition OpalDrift.cpp:38
virtual OpalDrift * clone(const std::string &name)
Make clone.
Definition OpalDrift.cpp:40
virtual void updateUnknown(ElementBase *)
Transmit the `‘unknown’' (not known to OPALX) attributes to OPALX.
virtual void update()
Update the embedded OPALX element.
void registerOwnership() const
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.