11 std::stringstream ss(params);
12 double slope, intercept;
13 ss >> slope >> intercept;
16 "Linear function created in the form y = m*x + b, with";
25 std::stringstream ss(params);
26 double constant, exponent, intercept = 0.0;
27 ss >> constant >> exponent;
33 "Exponential function created in the form y = a*exp(b*x) + c, with";
49 if (!params.empty()) {
50 throw Error(
"Piecewise Functions cannot be created with a list of parameters");
53 LOG(
LEV_DEBUG2,
"Funct") <<
"A piecewise function has been created: "
54 << function_->Print();
60 double starting_coord,
62 if (!function_->functions_.empty()) {
63 const PiecewiseFunction::PiecewiseFunctionInfo& last =
64 function_->functions_.back();
65 if (starting_coord <= last.xoffset) {
66 throw Error(
"Cannot append a function before the last registered function");
72 yoffset = function_->value(starting_coord) - function->value(0);
75 function_->functions_.push_back(PiecewiseFunction::PiecewiseFunctionInfo(
76 function, starting_coord, yoffset));
80std::map<std::string, BasicFunctionFactory::FunctionType>
81BasicFunctionFactory::enum_names_ =
82 std::map<std::string, BasicFunctionFactory::FunctionType>();
86 if (enum_names_.empty()) {
87 enum_names_[
"lin"] =
LIN;
88 enum_names_[
"linear"] =
LIN;
89 enum_names_[
"exp"] =
EXP;
90 enum_names_[
"exponential"] =
EXP;
97 if (enum_names_.count(type) == 0) {
98 std::stringstream err(
"");
99 err << type <<
" is not a registered function type"
100 <<
" of the basic function factory.";
101 throw Error(err.str());
104 switch (enum_names_.at(type)) {
116 throw Error(
"Function type " + type +
" not yet supported.");
A generic mechanism to manually manage exceptions.
Code providing rudimentary logging capability for the Cyclus core.
#define LOG(level, prefix)
allows easy logging via the streaming operator similar to std::cout; this is the primary way to use t...
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
@ LEV_DEBUG2
debugging information