Let OpmLog control output.

This commit is contained in:
Liu Ming 2016-05-10 13:51:10 +08:00
parent 431a21d632
commit f5a57b8a26
3 changed files with 2 additions and 10 deletions

View File

@ -285,7 +285,6 @@ namespace detail {
if (terminalOutputEnabled()) { if (terminalOutputEnabled()) {
std::string msg = " Oscillating behavior detected: Relaxation set to " std::string msg = " Oscillating behavior detected: Relaxation set to "
+ std::to_string(current_relaxation_); + std::to_string(current_relaxation_);
std::cout << msg << std::endl;
OpmLog::info(msg); OpmLog::info(msg);
} }
} }
@ -1108,7 +1107,6 @@ namespace detail {
if (converged) { if (converged) {
if ( terminal_output_ ) { if ( terminal_output_ ) {
std::cout << "well converged iter: " << it << std::endl;
OpmLog::info("well converged iter: " + std::to_string(it)); OpmLog::info("well converged iter: " + std::to_string(it));
} }
const int nw = wells().number_of_wells; const int nw = wells().number_of_wells;
@ -1910,7 +1908,6 @@ namespace detail {
msg += " W-FLUX(" + materialName(idx).substr(0, 1) + ")"; msg += " W-FLUX(" + materialName(idx).substr(0, 1) + ")";
} }
// std::cout << " WELL-CONT "; // std::cout << " WELL-CONT ";
std::cout << msg << std::endl;
OpmLog::info(msg); OpmLog::info(msg);
} }
std::ostringstream ss; std::ostringstream ss;
@ -1930,7 +1927,6 @@ namespace detail {
ss.precision(oprec); ss.precision(oprec);
ss.flags(oflags); ss.flags(oflags);
OpmLog::info(ss.str()); OpmLog::info(ss.str());
std::cout << ss.str() << std::endl;
} }
for (int idx = 0; idx < nm; ++idx) { for (int idx = 0; idx < nm; ++idx) {
@ -2019,7 +2015,6 @@ namespace detail {
msg += " W-FLUX(" + materialName(idx).substr(0, 1) + ")"; msg += " W-FLUX(" + materialName(idx).substr(0, 1) + ")";
} }
OpmLog::info(msg); OpmLog::info(msg);
std::cout << msg << std::endl;
} }
std::ostringstream ss; std::ostringstream ss;
const std::streamsize oprec = ss.precision(3); const std::streamsize oprec = ss.precision(3);
@ -2031,7 +2026,6 @@ namespace detail {
ss.precision(oprec); ss.precision(oprec);
ss.flags(oflags); ss.flags(oflags);
OpmLog::info(ss.str()); OpmLog::info(ss.str());
std::cout << ss.str() << std::endl;
} }
return converged; return converged;
} }

View File

@ -369,7 +369,9 @@ namespace Opm
ParserPtr parser(new Parser()); ParserPtr parser(new Parser());
{ {
std::shared_ptr<EclipsePRTLog> prtLog = std::make_shared<EclipsePRTLog>(logFile_ , Log::DefaultMessageTypes); std::shared_ptr<EclipsePRTLog> prtLog = std::make_shared<EclipsePRTLog>(logFile_ , Log::DefaultMessageTypes);
std::shared_ptr<StreamLog> streamLog = std::make_shared<StreamLog>(std::cout, Log::DefaultMessageTypes);
OpmLog::addBackend( "ECLIPSEPRTLOG" , prtLog ); OpmLog::addBackend( "ECLIPSEPRTLOG" , prtLog );
OpmLog::addBackend( "STREAMLOG", streamLog);
} }
// Create Deck and EclipseState. // Create Deck and EclipseState.
@ -679,7 +681,6 @@ namespace Opm
if (output_cout_) { if (output_cout_) {
std::string msg; std::string msg;
msg = "\n\n================ Starting main simulation loop ===============\n"; msg = "\n\n================ Starting main simulation loop ===============\n";
std::cout << msg << std::endl;
OpmLog::info(msg); OpmLog::info(msg);
} }
@ -689,7 +690,6 @@ namespace Opm
std::ostringstream ss; std::ostringstream ss;
ss << "\n\n================ End of simulation ===============\n\n"; ss << "\n\n================ End of simulation ===============\n\n";
fullReport.reportFullyImplicit(ss); fullReport.reportFullyImplicit(ss);
std::cout << ss.str() << std::endl;
OpmLog::info(ss.str()); OpmLog::info(ss.str());
if (param_.anyUnused()) { if (param_.anyUnused()) {
// This allows a user to catch typos and misunderstandings in the // This allows a user to catch typos and misunderstandings in the

View File

@ -132,7 +132,6 @@ namespace Opm
std::ostringstream ss; std::ostringstream ss;
timer.report(ss); timer.report(ss);
OpmLog::info(ss.str()); OpmLog::info(ss.str());
std::cout << ss.str();
} }
// Create wells and well state. // Create wells and well state.
@ -215,7 +214,6 @@ namespace Opm
std::string msg; std::string msg;
msg = "Fully implicit solver took: " + std::to_string(st) + " seconds. Total solver time taken: " + std::to_string(stime) + " seconds."; msg = "Fully implicit solver took: " + std::to_string(st) + " seconds. Total solver time taken: " + std::to_string(stime) + " seconds.";
OpmLog::info(msg); OpmLog::info(msg);
std::cout << msg << std::endl;
} }
if ( output_writer_.output() ) { if ( output_writer_.output() ) {