mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-22 09:16:27 -06:00
SimulatorTimerInterface: avoid boost includes in header
This commit is contained in:
parent
14ea3e6dd1
commit
ce01d780cf
@ -51,6 +51,7 @@ list (APPEND MAIN_SOURCE_FILES
|
||||
opm/simulators/timestepping/AdaptiveTimeSteppingEbos.cpp
|
||||
opm/simulators/timestepping/TimeStepControl.cpp
|
||||
opm/simulators/timestepping/SimulatorTimer.cpp
|
||||
opm/simulators/timestepping/SimulatorTimerInterface.cpp
|
||||
opm/simulators/timestepping/gatherConvergenceReport.cpp
|
||||
opm/simulators/utils/DeferredLogger.cpp
|
||||
opm/simulators/utils/gatherDeferredLogger.cpp
|
||||
|
40
opm/simulators/timestepping/SimulatorTimerInterface.cpp
Normal file
40
opm/simulators/timestepping/SimulatorTimerInterface.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
Copyright (c) 2014 IRIS AS
|
||||
|
||||
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 <config.h>
|
||||
#include <opm/simulators/timestepping/SimulatorTimerInterface.hpp>
|
||||
|
||||
#include <boost/date_time/posix_time/conversion.hpp>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
boost::posix_time::ptime SimulatorTimerInterface::currentDateTime() const
|
||||
{
|
||||
return startDateTime() + boost::posix_time::seconds( (int) simulationTimeElapsed());
|
||||
//boost::posix_time::ptime(startDate()) + boost::posix_time::seconds( (int) simulationTimeElapsed());
|
||||
}
|
||||
|
||||
time_t SimulatorTimerInterface::currentPosixTime() const
|
||||
{
|
||||
tm t = boost::posix_time::to_tm(currentDateTime());
|
||||
return std::mktime(&t);
|
||||
}
|
||||
|
||||
} // namespace Opm
|
@ -22,9 +22,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <boost/date_time/gregorian/gregorian.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
#include <boost/date_time/posix_time/conversion.hpp>
|
||||
namespace boost { namespace posix_time { class ptime; } }
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
@ -90,19 +88,11 @@ namespace Opm
|
||||
virtual boost::posix_time::ptime startDateTime() const = 0;
|
||||
|
||||
/// Return the current time as a posix time object.
|
||||
virtual boost::posix_time::ptime currentDateTime() const
|
||||
{
|
||||
return startDateTime() + boost::posix_time::seconds( (int) simulationTimeElapsed());
|
||||
//boost::posix_time::ptime(startDate()) + boost::posix_time::seconds( (int) simulationTimeElapsed());
|
||||
}
|
||||
virtual boost::posix_time::ptime currentDateTime() const;
|
||||
|
||||
/// Time elapsed since the start of the POSIX epoch (Jan 1st,
|
||||
/// 1970) until the current time step begins [s].
|
||||
virtual time_t currentPosixTime() const
|
||||
{
|
||||
tm t = boost::posix_time::to_tm(currentDateTime());
|
||||
return std::mktime(&t);
|
||||
}
|
||||
virtual time_t currentPosixTime() const;
|
||||
|
||||
/// Return true if last time step failed
|
||||
virtual bool lastStepFailed() const = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user