OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
OpalEnge.cpp
Go to the documentation of this file.
1 
2 #include "Elements/OpalEnge.h"
3 
6 #include "Physics/Units.h"
7 
8 extern Inform *gmsg;
9 
11  OpalElement(SIZE, "ENGE",
12  "The \"ENGE\" element defines an enge field fall off for plugging"
13  "into analytical field models.") {
15  "Length of the central region of the enge element.");
17  "Scales the end field fall off.");
19  "Polynomial coefficients for the Enge function.");
21 }
22 
24  // getOpalName() comes from AbstractObjects/Object.h
25  double x0 = Attributes::getReal(itsAttr[X0]);
26  double lambda = Attributes::getReal(itsAttr[LAMBDA]);
27  std::vector<double> aVec = Attributes::getRealArray(itsAttr[COEFFICIENTS]);
28 
30  std::make_shared<endfieldmodel::Enge>(aVec, x0, lambda));
31 }
32 
33 OpalEnge::OpalEnge(const std::string &name, OpalEnge *parent):
34  OpalElement(name, parent) {
35 }
36 
37 
38 OpalEnge *OpalEnge::clone(const std::string &name) {
39  return new OpalEnge(name, this);
40 }
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Definition: Attributes.cpp:240
virtual OpalEnge * clone(const std::string &name)
Definition: OpalEnge.cpp:38
virtual void update()
Definition: OpalEnge.cpp:23
std::vector< double > getRealArray(const Attribute &attr)
Get array value.
Definition: Attributes.cpp:294
Attribute makeRealArray(const std::string &name, const std::string &help)
Create real array attribute.
Definition: Attributes.cpp:289
OpalEnge()
Definition: OpalEnge.cpp:10
Definition: Inform.h:42
const std::string & getOpalName() const
Return object name.
Definition: Object.cpp:310
std::vector< Attribute > itsAttr
The object attributes.
Definition: Object.h:216
const std::string name
double getReal(const Attribute &attr)
Return real value.
Definition: Attributes.cpp:252
static void setEndFieldModel(std::string name, std::shared_ptr< EndFieldModel > efm)
Inform * gmsg
Definition: Main.cpp:70
void registerOwnership() const