OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
OpalCyclotronValley.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: OpalCyclotronValley.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: OpalCyclotronValley
10 // The class of OPAL CyclotronValley for Multipacting Simulation.
11 //
12 // ------------------------------------------------------------------------
13 //
14 // $Date: 2010/12/8 14:47:39 $
15 // $Author: Chuan Wang $
16 //
17 // ------------------------------------------------------------------------
18 
21 #include "Attributes/Attributes.h"
23 #include "Physics/Physics.h"
24 
25 extern Inform *gmsg;
26 
27 // Class OpalCyclotronValley
28 // ------------------------------------------------------------------------
29 
31  OpalElement(SIZE, "CYCLOTRONVALLEY",
32  "The \"CYCLOTRONVALLEY\" element defines a CyclotronValley for Multipacting Simulation.") {
33 
35  ("FMAPFN", "Filename for the fieldmap");
37  ("BFLG", "B flag");
38  registerStringAttribute("FMAPFN");
39  registerRealAttribute("BFLG");
40 
42 
43  setElement((new CyclotronValleyRep("CyclotronValley"))->makeAlignWrapper());
44 }
45 
46 
48  OpalElement(name, parent) {
49  setElement((new CyclotronValleyRep(name))->makeAlignWrapper());
50 }
51 
52 
54 
55 }
56 
57 
59  return new OpalCyclotronValley(name, this);
60 }
61 
62 
65 
66  if(flag != ERROR_FLAG) {
67  const CyclotronValleyRep *cv =
68  dynamic_cast<const CyclotronValleyRep *>(base.removeWrappers());
69  attributeRegistry["FMAPFN"]->setString(cv->getFieldMapFN());
70 
71  attributeRegistry["BFLG"]->setReal(1.0);
72  }
73 }
74 
75 
78 
79  using Physics::two_pi;
80  CyclotronValleyRep *cv =
81  dynamic_cast<CyclotronValleyRep *>(getElement()->removeWrappers());
82 
83 
84  std::string fmapfm = Attributes::getString(itsAttr[FMAPFN]);
85 
86  cv->setFieldMapFN(fmapfm);
87 
88  cv->setFast(false);//fast flag for cyclotronvalley has not been implemented yet.
89 
90  // Transmit "unknown" attributes.
92 }
void setFast(bool fast)
static AttCell * registerStringAttribute(const std::string &name)
Register a ``string&#39;&#39; element attribute.
std::string getFieldMapFN() const
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
virtual OpalCyclotronValley * clone(const std::string &name)
Make clone.
constexpr double two_pi
The value of .
Definition: Physics.h:34
virtual ElementBase * removeWrappers()
Return the design element.
Inform * gmsg
Definition: Main.cpp:21
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
Definition: Object.h:214
virtual void update()
Update the embedded CLASSIC cavity.
virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag)
Fill in all registered attributes.
OpalCyclotronValley()
Exemplar constructor.
static std::map< std::string, OwnPtr< AttCell > > attributeRegistry
The registry for named attributes.
Definition: OpalElement.h:172
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.
void setFieldMapFN(std::string fmapfn)
Set the name of the field map.
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
Representation for a Cyclotron Valley.
const std::string name
Definition: Inform.h:41
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Definition: Attributes.cpp:296
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.
std::string getString(const Attribute &attr)
Get string value.
Definition: Attributes.cpp:307