OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
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
24
26 OpalElement(COMMON, "MONITOR",
27 "The \"MONITOR\" element defines a monitor for both planes.") {
28
30
31 setElement(new MonitorRep("MONITOR"));
32}
33
34
35OpalMonitor::OpalMonitor(const std::string& name, OpalMonitor* parent):
36 OpalElement(name, parent) {
38}
39
40
42{}
43
44
45OpalMonitor* OpalMonitor::clone(const std::string& name) {
46 return new OpalMonitor(name, this);
47}
48
49
52
53 MonitorRep* mon =
54 dynamic_cast<MonitorRep*>(getElement());
55
56 double length = std::max(0.01, Attributes::getReal(itsAttr[LENGTH]));
57 mon->setElementLength(length);
59
60 if (Attributes::getString(itsAttr[TYPE]) == "TEMPORAL") {
62 } else {
64 }
65
66 // Transmit "unknown" attributes.
68}
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Definition: ReductionLoc.h:84
const std::string name
double getReal(const Attribute &attr)
Return real value.
Definition: Attributes.cpp:252
std::string getString(const Attribute &attr)
Get string value.
Definition: Attributes.cpp:343
ElementBase * getElement() const
Return the embedded CLASSIC element.
Definition: Element.h:120
void setElement(ElementBase *)
Assign new CLASSIC element.
Definition: Element.h:125
std::vector< Attribute > itsAttr
The object attributes.
Definition: Object.h:216
virtual void setElementLength(double length)
Set design length.
Definition: ElementBase.h:418
void setOutputFN(std::string fn)
Set output filename.
void setCollectionType(CollectionType type)
Definition: Monitor.h:114
virtual void updateUnknown(ElementBase *)
Transmit the `‘unknown’' (not known to OPAL) attributes to CLASSIC.
virtual void update()
Update the embedded CLASSIC element.
void registerOwnership() const
virtual ~OpalMonitor()
Definition: OpalMonitor.cpp:41
OpalMonitor()
Exemplar constructor.
Definition: OpalMonitor.cpp:25
virtual void update()
Update the embedded CLASSIC monitor.
Definition: OpalMonitor.cpp:50
virtual OpalMonitor * clone(const std::string &name)
Make clone.
Definition: OpalMonitor.cpp:45