OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
DVar.cpp
Go to the documentation of this file.
1 #include "Optimize/DVar.h"
3 
4 namespace {
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 
26 DVar::DVar(const std::string &name, DVar *parent):
27  Definition(name, parent)
28 { }
29 
31 { }
32 
33 void DVar::execute() {
34 
35 }
36 
37 std::string DVar::getVariable() const {
38  return Attributes::getString(itsAttr[VARIABLE]);
39 }
40 
41 double DVar::getLowerBound() const {
42  return Attributes::getReal(itsAttr[LOWERBOUND]);
43 }
44 
45 double DVar::getUpperBound() const {
46  return Attributes::getReal(itsAttr[UPPERBOUND]);
47 }
The base class for all OPAL definitions.
Definition: Definition.h:30
Definition: DVar.h:6
std::string getVariable() const
Definition: DVar.cpp:37
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
Definition: Object.h:214
double getLowerBound() const
Definition: DVar.cpp:41
double getUpperBound() const
Definition: DVar.cpp:45
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
Definition: Object.cpp:194
virtual void execute()
Execute the command.
Definition: DVar.cpp:33
const std::string name
DVar()
Definition: DVar.cpp:13
~DVar()
Definition: DVar.cpp:30
double getReal(const Attribute &attr)
Return real value.
Definition: Attributes.cpp:217
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Definition: Attributes.cpp:296
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Definition: Attributes.cpp:205
std::string getString(const Attribute &attr)
Get string value.
Definition: Attributes.cpp:307