OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
OpalEnge.cpp
Go to the documentation of this file.
1
2#include "Elements/OpalEnge.h"
3
6#include "Physics/Units.h"
7
8extern 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
33OpalEnge::OpalEnge(const std::string &name, OpalEnge *parent):
34 OpalElement(name, parent) {
35}
36
37
38OpalEnge *OpalEnge::clone(const std::string &name) {
39 return new OpalEnge(name, this);
40}
@ SIZE
Definition: IndexMap.cpp:174
Inform * gmsg
Definition: Main.cpp:61
const std::string name
double getReal(const Attribute &attr)
Return real value.
Definition: Attributes.cpp:252
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Definition: Attributes.cpp:240
Attribute makeRealArray(const std::string &name, const std::string &help)
Create real array attribute.
Definition: Attributes.cpp:289
std::vector< double > getRealArray(const Attribute &attr)
Get array value.
Definition: Attributes.cpp:294
const std::string & getOpalName() const
Return object name.
Definition: Object.cpp:310
std::vector< Attribute > itsAttr
The object attributes.
Definition: Object.h:216
static void setEndFieldModel(std::string name, std::shared_ptr< EndFieldModel > efm)
void registerOwnership() const
virtual OpalEnge * clone(const std::string &name)
Definition: OpalEnge.cpp:38
OpalEnge()
Definition: OpalEnge.cpp:10
virtual void update()
Definition: OpalEnge.cpp:23
@ COEFFICIENTS
Definition: OpalEnge.h:15
@ LAMBDA
Definition: OpalEnge.h:14
Definition: Inform.h:42