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)
|
||||
{
|
||||
}
|
||||
|
||||
@ -42,6 +43,8 @@ namespace Opm
|
||||
}
|
||||
|
||||
void SimulatorReport::report(std::ostream& os)
|
||||
{
|
||||
if ( verbose_ )
|
||||
{
|
||||
os << "Total time taken: " << total_time
|
||||
<< "\n Pressure time: " << pressure_time
|
||||
@ -50,8 +53,11 @@ namespace Opm
|
||||
<< "\n Overall Linear Iterations: " << total_linear_iterations
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void SimulatorReport::reportFullyImplicit(std::ostream& os)
|
||||
{
|
||||
if ( verbose_ )
|
||||
{
|
||||
os << "Total time taken (seconds): " << total_time
|
||||
<< "\nSolver time (seconds): " << pressure_time
|
||||
@ -59,8 +65,11 @@ namespace Opm
|
||||
<< "\nOverall Linear Iterations: " << total_linear_iterations
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void SimulatorReport::reportParam(std::ostream& os)
|
||||
{
|
||||
if ( verbose_ )
|
||||
{
|
||||
os << "/timing/total_time=" << total_time
|
||||
<< "\n/timing/pressure/total_time=" << pressure_time
|
||||
@ -69,6 +78,7 @@ namespace Opm
|
||||
<< "\n/timing/linear/iterations=" << total_linear_iterations
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -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