OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
OpalAsymmetricEnge.cpp
Go to the documentation of this file.
1 
3 
6 #include "Physics/Units.h"
7 
8 extern Inform *gmsg;
9 
11  OpalElement(SIZE, "ASYMMETRIC_ENGE",
12  "The \"ASYMMETRIC_ENGE\" element defines an enge field fall off for"
13  "plugging into analytical field models. The Asymmetric version"
14  "has different parameters for the start and end of the field.") {
16  "Offset of the central region of the enge element from the start.");
17  itsAttr[LAMBDA_START] = Attributes::makeReal("LAMBDA_START",
18  "Scales the field rise at the element entrance.");
20  "Polynomial coefficients for the Enge function at the element entrance.");
22  "Offset of the central region of the enge function element from the end.");
23  itsAttr[LAMBDA_END] = Attributes::makeReal("LAMBDA_END",
24  "Scales the field rise at the element exit.");
26  "Polynomial coefficients for the Enge function at the element exit.");
28 }
29 
31  // getOpalName() comes from AbstractObjects/Object.h
32  double x0Start = Attributes::getReal(itsAttr[X0_START]);
33  double lambdaStart = Attributes::getReal(itsAttr[LAMBDA_START]);
34  std::vector<double> aVecStart =
36  double x0End = Attributes::getReal(itsAttr[X0_END]);
37  double lambdaEnd = Attributes::getReal(itsAttr[LAMBDA_END]);
38  std::vector<double> aVecEnd =
40 
42  std::make_shared<endfieldmodel::AsymmetricEnge>(aVecStart,
43  x0Start,
44  lambdaStart,
45  aVecEnd,
46  x0End,
47  lambdaEnd));
48 
49 }
50 
52  OpalAsymmetricEnge *parent):
53  OpalElement(name, parent) {
54 }
55 
56 
58  return new OpalAsymmetricEnge(name, this);
59 }
60 
62 
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Definition: Attributes.cpp:240
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
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
virtual OpalAsymmetricEnge * clone(const std::string &name)
static void setEndFieldModel(std::string name, std::shared_ptr< EndFieldModel > efm)
Inform * gmsg
Definition: Main.cpp:70
void registerOwnership() const