Skip to content

Commit

Permalink
completed replacing generateoutput-flag by logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklas Worschech authored and OpenModelica-Hudson committed Jul 18, 2017
1 parent 28e177d commit be4b2d9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
1 change: 0 additions & 1 deletion SimulationRuntime/cpp/Include/Solver/Nox/Nox.h
Expand Up @@ -97,7 +97,6 @@ class Nox : public IAlgLoopSolver
Teuchos::RCP<std::ostream> _output;

bool _firstCall;
bool _generateoutput;
bool _useDomainScaling;

bool _OutOfProperMethods;
Expand Down
Expand Up @@ -42,7 +42,6 @@ class NoxLapackInterface : public LOCA::LAPACK::Interface {
INonLinearAlgLoop *_algLoop;///< Algebraic loop to be solved, required to obtain value of f
double *_yScale, *_fScale, *_hugeabsolutevalues, *_xtemp, *_rhs;
int _dimSys;
bool _generateoutput;
bool _useDomainScaling;
bool _useFunctionValueScaling;
double _lambda;//homotopy parameter
Expand Down
21 changes: 7 additions & 14 deletions SimulationRuntime/cpp/Solver/Nox/Nox.cpp
Expand Up @@ -35,7 +35,6 @@ Nox::Nox(INonLinearAlgLoop* algLoop, INonLinSolverSettings* settings)
, _yScale (NULL)
, _helpArray (NULL)
, _firstCall (true)
, _generateoutput (false)
, _useDomainScaling (false)
, _currentIterate (NULL)
, _dimSys (_algLoop->getDimReal())
Expand Down Expand Up @@ -66,7 +65,6 @@ Nox::~Nox()
*/
void Nox::initialize()
{
if (_generateoutput) std::cout << "starting init" << std::endl;
_firstCall = false;
_algLoop->initialize();//this sets values in the real variable

Expand Down Expand Up @@ -114,8 +112,6 @@ void Nox::initialize()
_statusTestsCombo->addStatusTest(_statusTestStagnation);
_statusTestsCombo->addStatusTest(_statusTestDivergence);
//_statusTestsCombo->addStatusTest(_statusTestSgnChange);

if (_generateoutput) std::cout << "ending init" << std::endl;
}
/**
* \brief main solving routine
Expand Down Expand Up @@ -148,8 +144,11 @@ void Nox::solve()
LOGGER_WRITE_BEGIN("Nox: start solving algebraic loop no. " + to_string(_algLoop->getEquationIndex()) + " at Simulation time " + to_string(_algLoop->getSimTime()), _lc, LL_DEBUG);

//setup solver
if (_firstCall)
if (_firstCall){
LOGGER_WRITE("initialize...",_lc, LL_DEBUG);
initialize();
LOGGER_WRITE("init done!",_lc, LL_DEBUG);
}

// Create the list of solver parameters. For detailed calibration, check https://trilinos.org/docs/dev/packages/nox/doc/html/parameters.html
_solverParametersPtr = Teuchos::rcp(new Teuchos::ParameterList);
Expand Down Expand Up @@ -526,11 +525,7 @@ void Nox::LocaHomotopySolve(const int numberofhomotopytries)
nlPrintParams.set("Output Stream", _output);
nlPrintParams.set("Error Stream", _output);
//Set the level of output
if (_generateoutput){
nlPrintParams.set("Output Information", NOX::Utils::Details + NOX::Utils::OuterIteration + NOX::Utils::Warning + NOX::Utils::StepperIteration + NOX::Utils::StepperDetails + NOX::Utils::StepperParameters); // Should set
}else{
nlPrintParams.set("Output Information", NOX::Utils::Error); // Should set
}
nlPrintParams.set("Output Information", NOX::Utils::Details + NOX::Utils::OuterIteration + NOX::Utils::Warning + NOX::Utils::StepperIteration + NOX::Utils::StepperDetails + NOX::Utils::StepperParameters); // Should set

// Create LAPACK Factory
Teuchos::RCP<LOCA::LAPACK::Factory> lapackFactory = Teuchos::rcp(new LOCA::LAPACK::Factory);
Expand Down Expand Up @@ -944,10 +939,8 @@ void Nox::printLogger(){
void Nox::addPrintingList(const Teuchos::RCP<Teuchos::ParameterList> solverParametersPtr){
solverParametersPtr->sublist("Printing").set("Output Precision", 15);
solverParametersPtr->sublist("Printing").set("Output Information", NOX::Utils::Error + NOX::Utils::Warning + NOX::Utils::OuterIteration + NOX::Utils::InnerIteration);
if(!_generateoutput){
solverParametersPtr->sublist("Printing").set("Output Stream", _output);
solverParametersPtr->sublist("Printing").set("Error Stream", _output);
}
solverParametersPtr->sublist("Printing").set("Output Stream", _output);
solverParametersPtr->sublist("Printing").set("Error Stream", _output);
}
/**
* \brief copy solution from solver to the algLoopSolution
Expand Down
1 change: 0 additions & 1 deletion SimulationRuntime/cpp/Solver/Nox/NoxLapackInterface.cpp
Expand Up @@ -11,7 +11,6 @@
//! Constructor
NoxLapackInterface::NoxLapackInterface(INonLinearAlgLoop *algLoop)//second argument unnecessary. Just initialize _lambda to 1.0
:_algLoop(algLoop)
,_generateoutput(false)
,_useDomainScaling(false)
,_useFunctionValueScaling(true)
,_yScale(NULL)
Expand Down

0 comments on commit be4b2d9

Please sign in to comment.