OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
OpalConstantEFieldCavity.cpp
Go to the documentation of this file.
4#include "Physics/Units.h"
5
8 SIZE, "CONSTANTEFIELDCAVITY",
9 "The \"CONSTANTEFIELDCAVITY\" element defines a constant accelerating "
10 "electric field in z-direction.") {
11 itsAttr[EX] = Attributes::makeReal("EX", "Electric field strength Ex in MV/m", 0.0);
12 itsAttr[EY] = Attributes::makeReal("EY", "Electric field strength Ey in MV/m", 0.0);
13 itsAttr[EZ] = Attributes::makeReal("EZ", "Electric field strength Ez in MV/m", 0.0);
14
16
17 setElement(new ConstantEFieldCavityRep("CONSTANTEFIELDCAVITY"));
18}
19
21 const std::string& name, OpalConstantEFieldCavity* parent)
22 : OpalElement(name, parent) {
24}
25
27
29 return new OpalConstantEFieldCavity(name, this);
30}
31
34
36 if (rep) {
37 double length = getLength();
38 double exMV = Attributes::getReal(itsAttr[EX]);
39 double eyMV = Attributes::getReal(itsAttr[EY]);
40 double ezMV = Attributes::getReal(itsAttr[EZ]);
41 rep->setElementLength(length);
42 rep->setEx(exMV * Units::MVpm2Vpm);
43 rep->setEy(eyMV * Units::MVpm2Vpm);
44 rep->setEz(ezMV * Units::MVpm2Vpm);
45 }
46
48}
@ SIZE
Definition IndexMap.cpp:179
void setElementLength(double length) override
Set design length.
void setEz(double ez) override
virtual void setEx(double ex)
virtual void setEy(double ey)
ElementBase * getElement() const
Return the embedded OPALX element.
Definition Element.h:119
void setElement(ElementBase *)
Assign new OPALX element.
Definition Element.h:123
std::vector< Attribute > itsAttr
The object attributes.
Definition Object.h:210
virtual void update()
Update the embedded OPALX element.
virtual OpalConstantEFieldCavity * clone(const std::string &name)
Return a clone.
virtual double getLength() const
Return element length.
virtual void updateUnknown(ElementBase *)
Transmit the `‘unknown’' (not known to OPALX) attributes to OPALX.
virtual void update()
Update the embedded OPALX element.
void registerOwnership() const
double getReal(const Attribute &attr)
Return real value.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
constexpr double MVpm2Vpm
Definition Units.h:128