5 #include "../Numeric/NumConstants.h" 6 #include "../Text/KeyvalTools.h" 37 vector<double> values;
40 if (desc.substr(0, 3) ==
"seq")
42 map<string, string> keyvals;
44 if (keyvals.find(
"from") == keyvals.end())
45 throw Exception(
"Unvalid sequence specification, missing 'from' key: " + desc.substr(3, desc.size() - 5));
46 if (keyvals.find(
"to") == keyvals.end())
47 throw Exception(
"Unvalid sequence specification, missing 'to' key: " + desc.substr(3, desc.size() - 5));
48 if (keyvals.find(
"step") == keyvals.end() && keyvals.find(
"size") == keyvals.end())
49 throw Exception(
"Unvalid sequence specification, missing 'step' or 'size' key: " + desc.substr(3, desc.size() - 5));
58 if (keyvals.find(
"scale") != keyvals.end())
60 string sc=keyvals[
"scale"];
70 throw Exception(
"Unknown scale " + sc +
" for vector. Ask developpers.");
77 if (keyvals.find(
"step") != keyvals.end())
106 double step = (end - start) / (
double)size;
107 for (
int i = 0; i < size - 1; i++)
109 double x = start + i * step;
163 for (
unsigned int i = 0; i < pl.
size(); i++)
174 map<string, string>& params,
175 const string& suffix,
176 bool suffixIsOptional,
181 unsigned int nbParams = ApplicationTools::getParameter<unsigned int>(
"grid.number_of_parameters", params, 1, suffix, suffixIsOptional, warn);
182 auto grid = std::make_shared<ParameterGrid>();
183 for (
unsigned int i = 0; i < nbParams; i++)
187 grid->addDimension(name, values);
double toDouble(const std::string &s, char dec, char scientificNotation)
Convert from string to double.
An interval, either bounded or not, which can also have infinite bounds.
const std::string & nextToken()
Get the next available token. If no token is availbale, throw an Exception.
bool hasMoreToken() const
Tell if some tokens are still available.
This class is designed to facilitate the manipulation of parameters.
The parameter list object.
const std::string & getToken(size_t pos) const
Get a particular token.
size_t numberOfRemainingTokens() const
Tell how many tokens are available.
std::string getDescription() const override
Give a short description on the type of constraint.
virtual const std::string & getName() const
Get the name of this parameter.
Exception base class. Overload exception constructor (to control the exceptions mechanism). Destructor is already virtual (from std::exception)
int toInt(const std::string &s, char scientificNotation)
Convert from string to int.
virtual double getValue() const
Get the value of this parameter.
std::string toString(T t)
General template method to convert to a string.