42 #include "../../App/ApplicationTools.h"
53 if (find(names_.begin(), names_.end(), name) != names_.end())
54 throw Exception(
"ParameterGrid::addDimension(). A dimension with name '" + name +
"' already exists in the grid.");
55 if (values.size() == 0)
56 throw Exception(
"ParameterGrid::addDimension(). Empty vector given! The dimension should at least contain one point.");
57 names_.push_back(name);
58 grid_.push_back(values);
63 for (
unsigned int i = 0; i < names_.size(); i++)
65 if (names_[i] == name)
68 throw Exception(
"ParameterGrid::getPointsForDimension(). No dimension with name '" + name +
"' was found in the grid.");
73 if (i >= names_.size())
80 if (grid_.size() == 0)
83 for (
size_t i = 0; i < grid_.size(); i++)
105 for (
unsigned int i = 0; i < n; i++)
111 unsigned int currentDimension = 0;
112 vector<unsigned int> currentPointInDimension(n);
113 vector<double> row(n + 1);
116 for (
unsigned int i = 0;
true; i++)
120 for (
unsigned int j = 0; j < n; j++)
122 row[j] = pl[j].getValue();
124 row[n] =
function.f(pl);
125 data->push_back(row);
128 bool dimensionChanged =
false;
129 while (currentDimension < n && currentPointInDimension[currentDimension] == points[currentDimension].size() - 1)
132 dimensionChanged =
true;
135 if (currentDimension == n)
138 currentPointInDimension[currentDimension]++;
139 if (dimensionChanged)
141 for (
unsigned int j = 0; j < currentDimension; j++)
143 currentPointInDimension[j] = 0;
145 currentDimension = 0;
149 for (
unsigned int j = 0; j < points.size(); j++)
Exception base class. Overload exception constructor (to control the exceptions mechanism)....
This is the function abstract class.
Index out of bounds exception class.
This class is a data structure to specify a set of parameter values (most likely for evaluation by a ...
const Vdouble & getPointsForDimension(unsigned int i) const
const std::vector< std::string > & getDimensionNames() const
const VVdouble & getPoints() const
const std::string & getDimensionName(unsigned int i) const
size_t getTotalNumberOfPoints() const
void addDimension(const std::string &name, const Vdouble &values)
Add a new dimension (parameter name + corresponding values).
size_t getNumberOfDimensions() const
The parameter list object.
virtual void setParameterValue(const std::string &name, double value)
Set the value of parameter with name name to be equal to value.
virtual ParameterList createSubList(const std::vector< std::string > &names) const
Get given parameters as a sublist.
std::vector< double > Vdouble
std::vector< Vdouble > VVdouble