OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
OpalSource.cpp
Go to the documentation of this file.
1 
2 #include "Elements/OpalSource.h"
6 #include "Physics/Physics.h"
7 
8 
9 // Class OpalSource
10 // ------------------------------------------------------------------------
11 
13  OpalElement(SIZE, "SOURCE",
14  "The \"SOURCE\" element defines a Source.") {
16  ("DISTRIBUTION", "List of particle distributions to be used ");
17 
18  registerStringAttribute("DISTRIBUTION");
19 
21 
22  setElement((new SourceRep("SOURCE"))->makeAlignWrapper());
23 }
24 
25 
26 OpalSource::OpalSource(const std::string &name, OpalSource *parent):
27  OpalElement(name, parent) {
28  setElement((new SourceRep(name))->makeAlignWrapper());
29 }
30 
31 
33 {}
34 
35 
36 OpalSource *OpalSource::clone(const std::string &name) {
37  return new OpalSource(name, this);
38 }
39 
40 
41 void OpalSource::
44 }
45 
46 
49 
50  SourceRep *sol =
51  dynamic_cast<SourceRep *>(getElement()->removeWrappers());
52  double length = 0.05;
53 
54  sol->setElementLength(length);
55 
56  // Transmit "unknown" attributes.
58 }
The SOURCE element.
Definition: OpalSource.h:11
static AttCell * registerStringAttribute(const std::string &name)
Register a ``string&#39;&#39; element attribute.
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
OpalSource()
Exemplar constructor.
Definition: OpalSource.cpp:12
virtual ~OpalSource()
Definition: OpalSource.cpp:32
virtual ElementBase * removeWrappers()
Return the design element.
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
Attribute makeStringArray(const std::string &name, const std::string &help)
Create a string array attribute.
Definition: Attributes.cpp:373
virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag)
Fill in all registered attributes.
Definition: OpalSource.cpp:42
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 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
const std::string name
Tepresentation for a solenoid magnet.
Definition: SourceRep.h:32
virtual OpalSource * clone(const std::string &name)
Make clone.
Definition: OpalSource.cpp:36
virtual void update()
Update the embedded CLASSIC solenoid.
Definition: OpalSource.cpp:47