OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
OpalSRot.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: OpalSRot.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: OpalSRot
10 // The class of OPAL SROT coordinate transforms.
11 //
12 // ------------------------------------------------------------------------
13 //
14 // $Date: 2000/03/27 09:33:40 $
15 // $Author: Andreas Adelmann $
16 //
17 // ------------------------------------------------------------------------
18 
19 #include "Elements/OpalSRot.h"
20 #include "Attributes/Attributes.h"
21 #include "BeamlineCore/PatchRep.h"
22 
23 
24 // Class OpalSRot
25 // ------------------------------------------------------------------------
26 
28  OpalElement(SIZE, "SROT",
29  "The \"SRot\" element defines a coordinate rotation "
30  "around the s-axis.") {
32  ("ANGLE", "Angle for the transformation");
33 
34  registerRealAttribute("ANGLE");
35 
37 
38  setElement(new PatchRep("SROT"));
39 }
40 
41 
42 OpalSRot::OpalSRot(const std::string &name, OpalSRot *parent):
43  OpalElement(name, parent) {
44  setElement(new PatchRep(name));
45 }
46 
47 
49 {}
50 
51 
52 OpalSRot *OpalSRot::clone(const std::string &name) {
53  return new OpalSRot(name, this);
54 }
55 
56 
57 void OpalSRot::
60 
61  double angle = Attributes::getReal(itsAttr[ANGLE]);
62  attributeRegistry["SANGLE"]->setReal(angle);
63 }
64 
65 
67  // Define geometry.
68  PatchRep *srot = dynamic_cast<PatchRep *>(getElement());
69  double angle = Attributes::getReal(itsAttr[ANGLE]);
70  Euclid3D rot = Euclid3D::ZRotation(angle);
71  srot->setPatch(rot);
72 
73  // Transmit "unknown" attributes.
75 }
Interface for basic beam line object.
Definition: ElementBase.h:128
virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag)
Fill in all registered attributes.
ValueFlag
Switch for value desired on ATTLIST command.
Definition: OpalElement.h:71
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
Definition: Object.h:214
Representation for a geometry patch.
Definition: PatchRep.h:33
static std::map< std::string, OwnPtr< AttCell > > attributeRegistry
The registry for named attributes.
Definition: OpalElement.h:172
virtual OpalSRot * clone(const std::string &name)
Make clone.
Definition: OpalSRot.cpp:52
virtual void update()
Update the embedded CLASSIC patch.
Definition: OpalSRot.cpp:66
Displacement and rotation in space.
Definition: Euclid3D.h:68
Base class for all beam line elements.
Definition: OpalElement.h:41
void setElement(ElementBase *)
Assign new CLASSIC element.
Definition: Element.h:133
void registerOwnership() const
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 setPatch(const Euclid3D &euclid)
Set patch.
Definition: PatchRep.cpp:134
const std::string name
OpalSRot()
Exemplar constructor.
Definition: OpalSRot.cpp:27
virtual ~OpalSRot()
Definition: OpalSRot.cpp:48
double getReal(const Attribute &attr)
Return real value.
Definition: Attributes.cpp:217
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Definition: Attributes.cpp:205
static Euclid3D ZRotation(double angle)
Make rotation.
Definition: Euclid3D.cpp:171
static AttCell * registerRealAttribute(const std::string &name)
Register a ``real&#39;&#39; element attribute.
virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag)
Fill in all registered attributes.
Definition: OpalSRot.cpp:58
The SROT element.
Definition: OpalSRot.h:28