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