OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
OpalMonitor.cpp
Go to the documentation of this file.
1//
2// Class OpalMonitor
3// The MONITOR element.
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//
22#include "Utilities/Util.h"
23
25 : OpalElement(COMMON, "MONITOR", "The \"MONITOR\" element defines a monitor for both planes.") {
27
28 setElement(new MonitorRep("MONITOR"));
29}
30
31OpalMonitor::OpalMonitor(const std::string& name, OpalMonitor* parent) : OpalElement(name, parent) {
32 setElement(new MonitorRep(name));
33}
34
36
37OpalMonitor* OpalMonitor::clone(const std::string& name) { return new OpalMonitor(name, this); }
38
41
42 MonitorRep* mon = dynamic_cast<MonitorRep*>(getElement());
43
44 double length = std::max(0.01, Attributes::getReal(itsAttr[LENGTH]));
45 mon->setElementLength(length);
47
48 if (Attributes::getString(itsAttr[TYPE]) == "TEMPORAL") {
50 } else {
52 }
53
54 // Transmit "unknown" attributes.
56}
virtual void setElementLength(double length)
Set design length.
void setOutputFN(std::string fn)
Set output filename.
ElementBase * getElement() const
Return the embedded OPALX element.
Definition Element.h:119
void setElement(ElementBase *)
Assign new OPALX element.
Definition Element.h:123
void setCollectionType(CollectionType type)
Definition Monitor.h:118
std::vector< Attribute > itsAttr
The object attributes.
Definition Object.h:210
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
virtual ~OpalMonitor()
OpalMonitor()
Exemplar constructor.
virtual void update()
Update the embedded OPALX monitor.
virtual OpalMonitor * clone(const std::string &name)
Make clone.
double getReal(const Attribute &attr)
Return real value.
std::string getString(const Attribute &attr)
Get string value.