#include <Bpp/App/NumCalcApplicationTools.h>
|
static std::vector< int > | seqFromString (const std::string &s, const std::string &delim=",", const std::string &seqdelim="-") |
| Build a vector of integers as described by a string. More...
|
|
static std::vector< double > | getVector (const std::string &desc) |
| Build a vector of double from a structured text description. More...
|
|
static double | getDefaultValue (const ParameterList &pl, const std::string &name, double x) |
| Returns the value of the Parameter of the given name if it exists; otherwise returns the default value. More...
|
|
static std::shared_ptr< ParameterGrid > | getParameterGrid (std::map< std::string, std::string > ¶ms, const std::string &suffix="", bool suffixIsOptional=true, bool warn=true) |
| Design a parameter grid from input options. More...
|
|
Definition at line 16 of file NumCalcApplicationTools.h.
◆ NumCalcApplicationTools()
bpp::NumCalcApplicationTools::NumCalcApplicationTools |
( |
| ) |
|
◆ ~NumCalcApplicationTools()
virtual bpp::NumCalcApplicationTools::~NumCalcApplicationTools |
( |
| ) |
|
|
virtual |
◆ getDefaultValue()
double NumCalcApplicationTools::getDefaultValue |
( |
const ParameterList & |
pl, |
|
|
const std::string & |
name, |
|
|
double |
x |
|
) |
| |
|
static |
◆ getParameterGrid()
shared_ptr< ParameterGrid > NumCalcApplicationTools::getParameterGrid |
( |
std::map< std::string, std::string > & |
params, |
|
|
const std::string & |
suffix = "" , |
|
|
bool |
suffixIsOptional = true , |
|
|
bool |
warn = true |
|
) |
| |
|
static |
Design a parameter grid from input options.
Example:
grid.number_of_parameters=3
grid.parameter1.name=x
grid.parameter1.values=0.1,0.2,0.3,0.4,0.5
grid.parameter2.name=y
grid.parameter2.values=seq(from=0.1,
to=0.5,step=0.1)
grid.parameter3.name=z
grid.parameter3.values=seq(from=0.1,
to=0.5,size=5)
- Parameters
-
params | The attribute map where options may be found. |
suffix | A suffix to be applied to the parameter name. |
suffixIsOptional | Tell if the suffix is absolutely required. |
warn | Tell if a warning must be sent in case the parameter is not found. |
- Returns
- a parameter grid object.
Definition at line 173 of file NumCalcApplicationTools.cpp.
References bpp::ApplicationTools::displayMessage(), bpp::ApplicationTools::displayResult(), bpp::IntervalConstraint::getDescription(), bpp::ApplicationTools::getStringParameter(), bpp::VectorTools::max(), bpp::VectorTools::min(), and bpp::TextTools::toString().
◆ getVector()
vector< double > NumCalcApplicationTools::getVector |
( |
const std::string & |
desc | ) |
|
|
static |
Build a vector of double from a structured text description.
The syntax may be one of the following:
- Specified values: 1.23, 2.34, 3.45, 4.56
- Sequence macro: seq(from=1.23,to=2.45,step=0.1) or seq(from=1.23,to=2.45,size=5) The meaning of these to form is equivalent as the R function: The first one start from 1.23 and increment 0.1 until it reaches the 2.45 value, wheras the seocnd one will compute 3 values at equal distance from 1.23 and 2.45. the 'from' and 'to' values are included, except for the first syntax when the interval is not an exact multiple of the 'step' argument.
- Author
- Julien Dutheil
- Parameters
-
- Returns
- A vector containing the corresponding values as double.
- Exceptions
-
Exception | If the syntax describing the set is not correct. |
Definition at line 35 of file NumCalcApplicationTools.cpp.
References bpp::StringTokenizer::hasMoreToken(), bpp::KeyvalTools::multipleKeyvals(), bpp::StringTokenizer::nextToken(), bpp::NumConstants::TINY(), bpp::TextTools::toDouble(), and bpp::TextTools::toInt().
◆ seqFromString()
vector< int > NumCalcApplicationTools::seqFromString |
( |
const std::string & |
s, |
|
|
const std::string & |
delim = "," , |
|
|
const std::string & |
seqdelim = "-" |
|
) |
| |
|
static |
Build a vector of integers as described by a string.
Build a vector of integers following a description like: "2, 5, 7-10, 4" => [2, 5, 7, 8, 9, 10, 4]
- Author
- Sylvain Gaillard
- Parameters
-
s | The string to parse. |
delim | Delimiter between elements. |
seqdelim | Delimiter between min and max for a sequence. |
- Returns
- A vector containing the integers
Definition at line 13 of file NumCalcApplicationTools.cpp.
References bpp::VectorTools::append(), bpp::StringTokenizer::getToken(), bpp::StringTokenizer::hasMoreToken(), bpp::StringTokenizer::nextToken(), bpp::StringTokenizer::numberOfRemainingTokens(), bpp::VectorTools::seq(), and bpp::TextTools::toInt().
The documentation for this class was generated from the following files: