Commit 9457fdc7 authored by Laurent Belcour's avatar Laurent Belcour

Allowing to change the parametrization of the ABC model using command line argument

parent bab8c2e4
......@@ -326,7 +326,8 @@ class parametrized
else
{
std::cout << "<<ERROR>> an input parametrization is already defined: " << params::get_name(_in_param) << std::endl;
std::cout << "<<ERROR>> trying to change to: " << params::get_name(new_param) << std::endl;
std::cout << "<<ERROR>> changing to: " << params::get_name(new_param) << std::endl;
_in_param = new_param;
}
}
......
......@@ -143,6 +143,19 @@ void abc_function::bootstrap(const data* d, const arguments& args)
_b[i] = 1.0;
_c[i] = 1.0;
}
if(args.is_defined("param"))
{
setParametrization(params::parse_input(args["param"]));
}
else
{
setParametrization(params::COS_TH);
}
if(params::dimension(input_parametrization()) != 1)
{
std::cerr << "<<ERROR>> the parametrization specifed in the file for the ABC model is incorrect" << std::endl;
}
}
//! Load function specific files
......@@ -175,6 +188,19 @@ bool abc_function::load(std::istream& in)
std::cerr << "<<ERROR>> parsing the stream. function name is not the next token." << std::endl;
return false;
}
in >> token;
if(token.compare("#PARAM") != 0)
{
std::cerr << "<<ERROR>> parsing the stream. The #PARAM is not the next line defined." << std::endl;
return false;
}
in >> token;
setParametrization(params::parse_input(token));
if(params::dimension(input_parametrization()) != 1)
{
std::cerr << "<<ERROR>> the parametrization specifed in the file for the ABC model is incorrect" << std::endl;
}
// Parse the lobe
for(int i=0; i<_nY; ++i)
......@@ -195,6 +221,7 @@ void abc_function::save_call(std::ostream& out, const arguments& args) const
if(is_alta)
{
out << "#FUNC nonlinear_function_abc" << std::endl ;
out << "#PARAM " << params::get_name(input_parametrization()) << std::endl;
for(int i=0; i<_nY; ++i)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment