OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
OpalMonitor.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: OpalMonitor.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: OpalMonitor
10 // The class of OPAL monitors for both planes.
11 //
12 // ------------------------------------------------------------------------
13 //
14 // $Date: 2000/03/27 09:33:39 $
15 // $Author: Andreas Adelmann $
16 //
17 // ------------------------------------------------------------------------
18 
19 #include "Elements/OpalMonitor.h"
21 #include "Attributes/Attributes.h"
23 #include "Utilities/Util.h"
24 
25 // Class OpalMonitor
26 // ------------------------------------------------------------------------
27 
28 extern Inform *gmsg;
29 
31  OpalElement(SIZE, "MONITOR",
32  "The \"MONITOR\" element defines a monitor for both planes.") {
34  ("OUTFN", "Monitor output filename");
35 
36  registerStringAttribute("OUTFN");
37 
39 
40  setElement((new MonitorRep("MONITOR"))->makeAlignWrapper());
41 }
42 
43 
44 OpalMonitor::OpalMonitor(const std::string &name, OpalMonitor *parent):
45  OpalElement(name, parent) {
46  setElement((new MonitorRep(name))->makeAlignWrapper());
47 }
48 
49 
51 {}
52 
53 
54 OpalMonitor *OpalMonitor::clone(const std::string &name) {
55  return new OpalMonitor(name, this);
56 }
57 
58 
61 
62  MonitorRep *mon =
63  dynamic_cast<MonitorRep *>(getElement()->removeWrappers());
64  double length = std::max(0.01, Attributes::getReal(itsAttr[LENGTH]));
65  mon->setElementLength(length);
67 
68  if (Util::toUpper(Attributes::getString(itsAttr[TYPE])) == "TEMPORAL") {
70  } else {
72  }
73 
74  // Transmit "unknown" attributes.
76 }
static AttCell * registerStringAttribute(const std::string &name)
Register a ``string&#39;&#39; element attribute.
The MONITOR element.
Definition: OpalMonitor.h:28
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Definition: ReductionLoc.h:123
virtual ElementBase * removeWrappers()
Return the design element.
virtual OpalMonitor * clone(const std::string &name)
Make clone.
Definition: OpalMonitor.cpp:54
Inform * gmsg
Definition: Main.cpp:21
std::string toUpper(const std::string &str)
Definition: Util.cpp:130
virtual void setElementLength(double length)
Set design length.
Definition: ElementBase.h:515
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
Definition: Object.h:214
OpalMonitor()
Exemplar constructor.
Definition: OpalMonitor.cpp:30
Base class for all beam line elements.
Definition: OpalElement.h:41
virtual void update()
Update the embedded CLASSIC monitor.
Definition: OpalMonitor.cpp:59
void setElement(ElementBase *)
Assign new CLASSIC element.
Definition: Element.h:133
void registerOwnership() const
virtual void update()
Update the embedded CLASSIC element.
virtual void updateUnknown(ElementBase *)
Transmit the ``unknown&#39;&#39; (not known to OPAL) attributes to CLASSIC.
ElementBase * getElement() const
Return the embedded CLASSIC element.
Definition: Element.h:128
void setType(Type type)
Definition: Monitor.h:124
virtual ~OpalMonitor()
Definition: OpalMonitor.cpp:50
const std::string name
Representation for an orbit position monitor.
Definition: MonitorRep.h:32
double getReal(const Attribute &attr)
Return real value.
Definition: Attributes.cpp:217
Definition: Inform.h:41
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Definition: Attributes.cpp:296
void setOutputFN(std::string fn)
Definition: Monitor.cpp:195
std::string getString(const Attribute &attr)
Get string value.
Definition: Attributes.cpp:307