mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-18 21:43:27 -06:00
Allow to prevent SimulatorReport for printing to std::cout.
This commit adds a verbose flag to the constructor of SimulatorReport to allow for deactivating any output to std:cout. This is handy for parallel runs where we only want to print statistics on one process.
This commit is contained in:
parent
a87b46a037
commit
802895acaf
@ -23,12 +23,13 @@
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
SimulatorReport::SimulatorReport()
|
||||
SimulatorReport::SimulatorReport(bool verbose)
|
||||
: pressure_time(0.0),
|
||||
transport_time(0.0),
|
||||
total_time(0.0),
|
||||
total_newton_iterations( 0 ),
|
||||
total_linear_iterations( 0 )
|
||||
total_linear_iterations( 0 ),
|
||||
verbose_(verbose)
|
||||
{
|
||||
}
|
||||
|
||||
@ -43,31 +44,40 @@ namespace Opm
|
||||
|
||||
void SimulatorReport::report(std::ostream& os)
|
||||
{
|
||||
os << "Total time taken: " << total_time
|
||||
<< "\n Pressure time: " << pressure_time
|
||||
<< "\n Transport time: " << transport_time
|
||||
<< "\n Overall Newton Iterations: " << total_newton_iterations
|
||||
<< "\n Overall Linear Iterations: " << total_linear_iterations
|
||||
<< std::endl;
|
||||
if ( verbose_ )
|
||||
{
|
||||
os << "Total time taken: " << total_time
|
||||
<< "\n Pressure time: " << pressure_time
|
||||
<< "\n Transport time: " << transport_time
|
||||
<< "\n Overall Newton Iterations: " << total_newton_iterations
|
||||
<< "\n Overall Linear Iterations: " << total_linear_iterations
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void SimulatorReport::reportFullyImplicit(std::ostream& os)
|
||||
{
|
||||
os << "Total time taken (seconds): " << total_time
|
||||
<< "\nSolver time (seconds): " << pressure_time
|
||||
<< "\nOverall Newton Iterations: " << total_newton_iterations
|
||||
<< "\nOverall Linear Iterations: " << total_linear_iterations
|
||||
<< std::endl;
|
||||
if ( verbose_ )
|
||||
{
|
||||
os << "Total time taken (seconds): " << total_time
|
||||
<< "\nSolver time (seconds): " << pressure_time
|
||||
<< "\nOverall Newton Iterations: " << total_newton_iterations
|
||||
<< "\nOverall Linear Iterations: " << total_linear_iterations
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void SimulatorReport::reportParam(std::ostream& os)
|
||||
{
|
||||
os << "/timing/total_time=" << total_time
|
||||
<< "\n/timing/pressure/total_time=" << pressure_time
|
||||
<< "\n/timing/transport/total_time=" << transport_time
|
||||
<< "\n/timing/newton/iterations=" << total_newton_iterations
|
||||
<< "\n/timing/linear/iterations=" << total_linear_iterations
|
||||
<< std::endl;
|
||||
if ( verbose_ )
|
||||
{
|
||||
os << "/timing/total_time=" << total_time
|
||||
<< "\n/timing/pressure/total_time=" << pressure_time
|
||||
<< "\n/timing/transport/total_time=" << transport_time
|
||||
<< "\n/timing/newton/iterations=" << total_newton_iterations
|
||||
<< "\n/timing/linear/iterations=" << total_linear_iterations
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ namespace Opm
|
||||
unsigned int total_linear_iterations;
|
||||
|
||||
/// Default constructor initializing all times to 0.0.
|
||||
SimulatorReport();
|
||||
SimulatorReport(bool verbose=true);
|
||||
/// Increment this report's times by those in sr.
|
||||
void operator+=(const SimulatorReport& sr);
|
||||
/// Print a report to the given stream.
|
||||
@ -44,6 +44,9 @@ namespace Opm
|
||||
/// Print a report, leaving out the transport time.
|
||||
void reportFullyImplicit(std::ostream& os);
|
||||
void reportParam(std::ostream& os);
|
||||
private:
|
||||
// Whether to print statistics to std::cout
|
||||
bool verbose_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
Loading…
Reference in New Issue
Block a user