OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
DVar.cpp
Go to the documentation of this file.
1#include "Optimize/DVar.h"
3
4namespace {
5 enum {
6 VARIABLE,
7 LOWERBOUND,
8 UPPERBOUND,
9 SIZE
10 };
11}
12
14 Definition(SIZE, "DVAR", "The DVAR statement defines a variable for optimization")
15{
16 itsAttr[VARIABLE] = Attributes::makeString("VARIABLE",
17 "Variable name that should be varied during optimization");
18 itsAttr[LOWERBOUND] = Attributes::makeReal("LOWERBOUND",
19 "Lower limit of the range of values that the variable should assume");
20 itsAttr[UPPERBOUND] = Attributes::makeReal("UPPERBOUND",
21 "Upper limit of the range of values that the variable should assume");
22
24}
25
26DVar::DVar(const std::string &name, DVar *parent):
27 Definition(name, parent)
28{ }
29
31{ }
32
34
35}
36
37std::string DVar::getVariable() const {
38 return Attributes::getString(itsAttr[VARIABLE]);
39}
40
41double DVar::getLowerBound() const {
42 return Attributes::getReal(itsAttr[LOWERBOUND]);
43}
44
45double DVar::getUpperBound() const {
46 return Attributes::getReal(itsAttr[UPPERBOUND]);
47}
@ SIZE
Definition: IndexMap.cpp:174
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
std::string getString(const Attribute &attr)
Get string value.
Definition: Attributes.cpp:343
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Definition: Attributes.cpp:332
The base class for all OPAL definitions.
Definition: Definition.h:30
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
Definition: Object.cpp:191
std::vector< Attribute > itsAttr
The object attributes.
Definition: Object.h:216
Definition: DVar.h:6
~DVar()
Definition: DVar.cpp:30
std::string getVariable() const
Definition: DVar.cpp:37
virtual void execute()
Execute the command.
Definition: DVar.cpp:33
double getUpperBound() const
Definition: DVar.cpp:45
DVar()
Definition: DVar.cpp:13
double getLowerBound() const
Definition: DVar.cpp:41