mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Moved SimulatorReport class into its own file, for reusability.
This commit is contained in:
parent
5a055ee933
commit
98de826397
47
opm/core/simulator/SimulatorReport.cpp
Normal file
47
opm/core/simulator/SimulatorReport.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright 2012 SINTEF ICT, Applied Mathematics.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <opm/core/simulator/SimulatorReport.hpp>
|
||||
#include <iostream>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
SimulatorReport::SimulatorReport()
|
||||
: pressure_time(0.0),
|
||||
transport_time(0.0),
|
||||
total_time(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
void SimulatorReport::operator+=(const SimulatorReport& sr)
|
||||
{
|
||||
pressure_time += sr.pressure_time;
|
||||
transport_time += sr.transport_time;
|
||||
total_time += sr.total_time;
|
||||
}
|
||||
|
||||
void SimulatorReport::report(std::ostream& os)
|
||||
{
|
||||
os << "Total time taken: " << total_time
|
||||
<< "\n Pressure time: " << pressure_time
|
||||
<< "\n Transport time: " << total_time << std::endl;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Opm
|
45
opm/core/simulator/SimulatorReport.hpp
Normal file
45
opm/core/simulator/SimulatorReport.hpp
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
Copyright 2012 SINTEF ICT, Applied Mathematics.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_SIMULATORREPORT_HEADER_INCLUDED
|
||||
#define OPM_SIMULATORREPORT_HEADER_INCLUDED
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
/// A struct for returning timing data from a simulator to its caller.
|
||||
struct SimulatorReport
|
||||
{
|
||||
double pressure_time;
|
||||
double transport_time;
|
||||
double total_time;
|
||||
|
||||
/// Default constructor initializing all times to 0.0.
|
||||
SimulatorReport();
|
||||
/// Increment this report's times by those in sr.
|
||||
void operator+=(const SimulatorReport& sr);
|
||||
/// Print a report to the given stream.
|
||||
void report(std::ostream& os);
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_SIMULATORREPORT_HEADER_INCLUDED
|
Loading…
Reference in New Issue
Block a user