5 #include "../../App/ApplicationTools.h" 16 if (find(names_.begin(), names_.end(), name) != names_.end())
17 throw Exception(
"ParameterGrid::addDimension(). A dimension with name '" + name +
"' already exists in the grid.");
18 if (values.size() == 0)
19 throw Exception(
"ParameterGrid::addDimension(). Empty vector given! The dimension should at least contain one point.");
20 names_.push_back(name);
21 grid_.push_back(values);
26 for (
unsigned int i = 0; i < names_.size(); i++)
28 if (names_[i] == name)
31 throw Exception(
"ParameterGrid::getPointsForDimension(). No dimension with name '" + name +
"' was found in the grid.");
36 if (i >= names_.size())
43 if (grid_.size() == 0)
46 for (
size_t i = 0; i < grid_.size(); i++)
60 return make_shared<DataTable>(0);
69 auto colNames = parNames;
71 colNames.push_back(
"value");
72 auto data = make_shared<DataTable>(colNames);
74 for (
unsigned int i = 0; i < n; i++)
80 unsigned int currentDimension = 0;
81 vector<unsigned int> currentPointInDimension(n);
82 vector<string> row(n + 1);
85 for (
unsigned int i = 0;
true; ++i)
89 for (
unsigned int j = 0; j < n; ++j)
97 bool dimensionChanged =
false;
98 while (currentDimension < n && currentPointInDimension[currentDimension] == points[currentDimension].size() - 1)
101 dimensionChanged =
true;
104 if (currentDimension == n)
107 currentPointInDimension[currentDimension]++;
108 if (dimensionChanged)
110 for (
unsigned int j = 0; j < currentDimension; j++)
112 currentPointInDimension[j] = 0;
114 currentDimension = 0;
118 for (
unsigned int j = 0; j < points.size(); j++)
const std::string & getDimensionName(unsigned int i) const
virtual ParameterList createSubList(const std::vector< std::string > &names) const
Get given parameters as a sublist.
This is the function abstract class.
virtual void setParameterValue(const std::string &name, double value)
Set the value of parameter with name name to be equal to value.
The parameter list object.
This class is a data structure to specify a set of parameter values (most likely for evaluation by a ...
size_t getTotalNumberOfPoints() const
const VVdouble & getPoints() const
std::vector< double > Vdouble
size_t getNumberOfDimensions() const
Exception base class. Overload exception constructor (to control the exceptions mechanism). Destructor is already virtual (from std::exception)
Index out of bounds exception class.
const Vdouble & getPointsForDimension(unsigned int i) const
void addDimension(const std::string &name, const Vdouble &values)
Add a new dimension (parameter name + corresponding values).
std::string toString(T t)
General template method to convert to a string.
std::vector< Vdouble > VVdouble
const std::vector< std::string > & getDimensionNames() const