preCICE v3.1.2
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
precice::cplscheme::impl::TimeHandler Class Reference

#include <TimeHandler.hpp>

Collaboration diagram for precice::cplscheme::impl::TimeHandler:
[legend]

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 &&)
 
TimeHandleroperator= (const TimeHandler &)
 
TimeHandleroperator= (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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ TimeHandler() [1/4]

precice::cplscheme::impl::TimeHandler::TimeHandler ( )

Definition at line 25 of file TimeHandler.cpp.

◆ ~TimeHandler()

precice::cplscheme::impl::TimeHandler::~TimeHandler ( )
default

◆ TimeHandler() [2/4]

precice::cplscheme::impl::TimeHandler::TimeHandler ( std::optional< double > maxTime)

Constructor for setting an optional maximum time.

Definition at line 33 of file TimeHandler.cpp.

◆ TimeHandler() [3/4]

precice::cplscheme::impl::TimeHandler::TimeHandler ( const TimeHandler & other)

Definition at line 39 of file TimeHandler.cpp.

◆ TimeHandler() [4/4]

precice::cplscheme::impl::TimeHandler::TimeHandler ( TimeHandler && other)

Definition at line 44 of file TimeHandler.cpp.

Member Function Documentation

◆ completeTimeWindow()

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.

Here is the call graph for this function:

◆ operator=() [1/2]

TimeHandler & precice::cplscheme::impl::TimeHandler::operator= ( const TimeHandler & other)

Definition at line 49 of file TimeHandler.cpp.

◆ operator=() [2/2]

TimeHandler & precice::cplscheme::impl::TimeHandler::operator= ( TimeHandler && other)

Definition at line 55 of file TimeHandler.cpp.

Here is the call graph for this function:

◆ progressBy()

void precice::cplscheme::impl::TimeHandler::progressBy ( double dt)

Progress the time window by the given amount.

Definition at line 67 of file TimeHandler.cpp.

◆ reachedEnd()

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.

Here is the call graph for this function:

◆ reachedEndOfWindow()

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.

Here is the call graph for this function:

◆ resetProgress()

void precice::cplscheme::impl::TimeHandler::resetProgress ( )

Resets the progress of the time window back to 0.

Definition at line 72 of file TimeHandler.cpp.

◆ resetTo()

void precice::cplscheme::impl::TimeHandler::resetTo ( double timeStart)

Resets the handler to the given time.

Definition at line 61 of file TimeHandler.cpp.

Here is the call graph for this function:

◆ time()

double precice::cplscheme::impl::TimeHandler::time ( ) const

Returns the current time as a double.

Definition at line 145 of file TimeHandler.cpp.

◆ untilEnd()

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.

Here is the call graph for this function:

◆ untilProgress()

double precice::cplscheme::impl::TimeHandler::untilProgress ( double windowSize) const
private

Definition at line 150 of file TimeHandler.cpp.

◆ untilTime()

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.

◆ untilWindowEnd()

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.

Here is the call graph for this function:

◆ windowProgress()

double precice::cplscheme::impl::TimeHandler::windowProgress ( ) const

Returns the window progress as a double.

Definition at line 133 of file TimeHandler.cpp.

◆ windowStart()

double precice::cplscheme::impl::TimeHandler::windowStart ( ) const

Returns the window start as a double.

Definition at line 140 of file TimeHandler.cpp.

Member Data Documentation

◆ _impl

std::unique_ptr<Impl> precice::cplscheme::impl::TimeHandler::_impl
private

Definition at line 96 of file TimeHandler.hpp.


The documentation for this class was generated from the following files: