Skip to content
Snippets Groups Projects
Commit b0278d86 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Replace printLSOptions and printLSAvailable get functions

printLSOptions -> getLSOptions
printLSAvailable -> getLSAvailable

These new function do not print the result anymore but return a
string.

To display available or set options, one should now uses:
```
cout << getLSOptions() << "\n";
let available:string, available = getLSAvailable();
cout << available << "\n";
```
parent 4383cd2b
No related branches found
No related tags found
1 merge request!66Feature/reduced verbosity
...@@ -57,28 +57,35 @@ LinearSolverModule::LinearSolverModule() ...@@ -57,28 +57,35 @@ LinearSolverModule::LinearSolverModule()
)); ));
this->_addBuiltinFunction("printLSOptions", std::make_shared<BuiltinFunctionEmbedder<void()>>( this->_addBuiltinFunction("getLSOptions", std::make_shared<BuiltinFunctionEmbedder<std::string()>>(
[]() -> void { []() -> std::string {
std::cout << rang::fgB::yellow << "Linear solver options" std::ostringstream os;
<< rang::style::reset << '\n'; os << rang::fgB::yellow << "Linear solver options" << rang::style::reset
std::cout << LinearSolverOptions::default_options; << '\n';
os << LinearSolverOptions::default_options;
return os.str();
} }
)); ));
this->_addBuiltinFunction("printLSAvailable", this->_addBuiltinFunction("getLSAvailable", std::make_shared<BuiltinFunctionEmbedder<std::string()>>(
std::make_shared<BuiltinFunctionEmbedder<void()>>(
[]() -> std::string {
std::ostringstream os;
[]() -> void { os << rang::fgB::yellow << "Available linear solver options"
std::cout << rang::fgB::yellow << "Available linear solver options"
<< rang::style::reset << '\n'; << rang::style::reset << '\n';
std::cout << rang::fgB::blue << " libraries" << rang::style::reset << '\n'; os << rang::fgB::blue << " libraries" << rang::style::reset << '\n';
printLSEnumListNames<LSLibrary>(std::cout);
std::cout << rang::fgB::blue << " methods" << rang::style::reset << '\n'; printLSEnumListNames<LSLibrary>(os);
printLSEnumListNames<LSMethod>(std::cout); os << rang::fgB::blue << " methods" << rang::style::reset << '\n';
std::cout << rang::fgB::blue << " preconditioners" << rang::style::reset << '\n'; printLSEnumListNames<LSMethod>(os);
printLSEnumListNames<LSPrecond>(std::cout); os << rang::fgB::blue << " preconditioners" << rang::style::reset
<< '\n';
printLSEnumListNames<LSPrecond>(os);
return os.str();
} }
)); ));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment