OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Objective.cpp
Go to the documentation of this file.
3
4namespace {
5 enum {
6 EXPR,
7 SIZE
8 };
9}
10
12 Definition(SIZE, "OBJECTIVE", "The OBJECTIVE statement defines an objective for optimization")
13{
14 itsAttr[EXPR] = Attributes::makeString("EXPR",
15 "Expression to minimize during optimization");
16
18}
19
20Objective::Objective(const std::string &name, Objective *parent):
21 Definition(name, parent)
22{ }
23
25{ }
26
28
29}
30
31std::string Objective::getExpression() const {
32 std::string expr = Attributes::getString(itsAttr[EXPR]);
33
34 return expr;
35}
@ SIZE
Definition: IndexMap.cpp:174
const std::string name
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
virtual void execute()
Execute the command.
Definition: Objective.cpp:27
std::string getExpression() const
Definition: Objective.cpp:31