OPAL (Object Oriented Parallel Accelerator Library) 2024.2
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}
Inform * gmsg
Definition Main.cpp:70
const std::string name
double getReal(const Attribute &attr)
Return real value.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Attribute makeRealArray(const std::string &name, const std::string &help)
Create real array attribute.
std::vector< double > getRealArray(const Attribute &attr)
Get array value.
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)
OpalElement(int size, const char *name, const char *help)
Exemplar constructor.
void registerOwnership() const
virtual OpalEnge * clone(const std::string &name)
Definition OpalEnge.cpp:38
virtual void update()
Definition OpalEnge.cpp:23
@ COEFFICIENTS
Definition OpalEnge.h:15