preCICE v3.1.2
|
#include <TimeHandler.hpp>
Classes | |
struct | Impl |
Public Member Functions | |
TimeHandler () | |
~TimeHandler () | |
TimeHandler (std::optional< double > maxTime) | |
Constructor for setting an optional maximum time. | |
TimeHandler (const TimeHandler &) | |
TimeHandler (TimeHandler &&) | |
TimeHandler & | operator= (const TimeHandler &) |
TimeHandler & | operator= (TimeHandler &&) |
State altering functions | |
void | resetTo (double timeStart) |
Resets the handler to the given time. | |
void | progressBy (double dt) |
Progress the time window by the given amount. | |
void | resetProgress () |
Resets the progress of the time window back to 0. | |
void | completeTimeWindow (double timeWindowSize) |
Queries about reaching ends | |
bool | reachedEndOfWindow (double timeWindowSize) const |
bool | reachedEnd () const |
Time differences | |
double | untilWindowEnd (double timeWindowSize) const |
Returns the time distance to the possibly truncated end of the current time window. | |
double | untilTime (double t) const |
Returns the time difference until the overall time reaches the given time. | |
double | untilEnd () const |
double | windowProgress () const |
Returns the window progress as a double. | |
Time points | |
double | windowStart () const |
Returns the window start as a double. | |
double | time () const |
Returns the current time as a double. | |
Private Member Functions | |
double | untilProgress (double windowSize) const |
Private Attributes | |
std::unique_ptr< Impl > | _impl |
Handler for stepping forward in time using time windows
The handler respects a maximum time if it was set in the constructor.
The goal of this class is to handle all computation around time and time steps with maximizing accuracy and simplifying calling code.
Definition at line 15 of file TimeHandler.hpp.
precice::cplscheme::impl::TimeHandler::TimeHandler | ( | ) |
Definition at line 25 of file TimeHandler.cpp.
|
default |
precice::cplscheme::impl::TimeHandler::TimeHandler | ( | std::optional< double > | maxTime | ) |
Constructor for setting an optional maximum time.
Definition at line 33 of file TimeHandler.cpp.
precice::cplscheme::impl::TimeHandler::TimeHandler | ( | const TimeHandler & | other | ) |
Definition at line 39 of file TimeHandler.cpp.
precice::cplscheme::impl::TimeHandler::TimeHandler | ( | TimeHandler && | other | ) |
Definition at line 44 of file TimeHandler.cpp.
void precice::cplscheme::impl::TimeHandler::completeTimeWindow | ( | double | timeWindowSize | ) |
Complete the time window moving the start of the time window
The given exact time window size will be used if it is approximately equal to the accumulated progress.
Definition at line 77 of file TimeHandler.cpp.
TimeHandler & precice::cplscheme::impl::TimeHandler::operator= | ( | const TimeHandler & | other | ) |
Definition at line 49 of file TimeHandler.cpp.
TimeHandler & precice::cplscheme::impl::TimeHandler::operator= | ( | TimeHandler && | other | ) |
void precice::cplscheme::impl::TimeHandler::progressBy | ( | double | dt | ) |
Progress the time window by the given amount.
Definition at line 67 of file TimeHandler.cpp.
bool precice::cplscheme::impl::TimeHandler::reachedEnd | ( | ) | const |
Has the end of the overall time been reached? This is always false if no max time has been defined.
Definition at line 99 of file TimeHandler.cpp.
bool precice::cplscheme::impl::TimeHandler::reachedEndOfWindow | ( | double | timeWindowSize | ) | const |
Has the end of the time window been reached? This respects max time.
Definition at line 94 of file TimeHandler.cpp.
void precice::cplscheme::impl::TimeHandler::resetProgress | ( | ) |
Resets the progress of the time window back to 0.
Definition at line 72 of file TimeHandler.cpp.
void precice::cplscheme::impl::TimeHandler::resetTo | ( | double | timeStart | ) |
Resets the handler to the given time.
Definition at line 61 of file TimeHandler.cpp.
double precice::cplscheme::impl::TimeHandler::time | ( | ) | const |
Returns the current time as a double.
Definition at line 145 of file TimeHandler.cpp.
double precice::cplscheme::impl::TimeHandler::untilEnd | ( | ) | const |
Returns the time difference until the end of the overall time. This returns infinity if there is no maximum time defined.
Definition at line 125 of file TimeHandler.cpp.
|
private |
Definition at line 150 of file TimeHandler.cpp.
double precice::cplscheme::impl::TimeHandler::untilTime | ( | double | t | ) | const |
Returns the time difference until the overall time reaches the given time.
Definition at line 119 of file TimeHandler.cpp.
double precice::cplscheme::impl::TimeHandler::untilWindowEnd | ( | double | timeWindowSize | ) | const |
Returns the time distance to the possibly truncated end of the current time window.
Definition at line 109 of file TimeHandler.cpp.
double precice::cplscheme::impl::TimeHandler::windowProgress | ( | ) | const |
Returns the window progress as a double.
Definition at line 133 of file TimeHandler.cpp.
double precice::cplscheme::impl::TimeHandler::windowStart | ( | ) | const |
Returns the window start as a double.
Definition at line 140 of file TimeHandler.cpp.
|
private |
Definition at line 96 of file TimeHandler.hpp.