Flow123d  release_2.2.0-22-g936454a
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TimeStep Class Reference

Representation of one time step.. More...

#include <time_governor.hh>

Public Member Functions

 TimeStep (double init_time)
 
 TimeStep ()
 
 TimeStep (const TimeStep &other)
 
TimeStep make_next (double new_length) const
 
TimeStep make_next (double new_lenght, double end_time) const
 
unsigned int index () const
 
double length () const
 
double end () const
 
bool gt (double other_time) const
 
bool ge (double other_time) const
 
bool lt (double other_time) const
 
bool le (double other_time) const
 
bool eq (double other_time) const
 
bool contains (double other_time) const
 
bool operator== (const TimeStep &other)
 

Private Member Functions

bool safe_compare (double t1, double t0) const
 

Private Attributes

unsigned int index_
 Index of the step is index if the end time. Zero time step is artificial. More...
 
double length_
 
double end_
 End time point of the time step. More...
 

Detailed Description

Representation of one time step..

Time step consists of the time step length() and from time step () time. More over we store the index of the time step within it time governor.

The reason to store both the end time and the length of the time step is to allow safe comparisons of the time with safety margin small relative to the time step length.

Definition at line 54 of file time_governor.hh.

Constructor & Destructor Documentation

TimeStep::TimeStep ( double  init_time)

Constructor of the zero time step.

Definition at line 68 of file time_governor.cc.

TimeStep::TimeStep ( )

Default constructor. Creates undefined time step.

Definition at line 76 of file time_governor.cc.

Here is the caller graph for this function:

TimeStep::TimeStep ( const TimeStep other)

Copy constructor.

Definition at line 85 of file time_governor.cc.

Member Function Documentation

bool TimeStep::contains ( double  other_time) const
inline

Definition at line 125 of file time_governor.hh.

Here is the caller graph for this function:

double TimeStep::end ( ) const
inline

Definition at line 92 of file time_governor.hh.

Here is the caller graph for this function:

bool TimeStep::eq ( double  other_time) const
inline

Definition at line 122 of file time_governor.hh.

Here is the caller graph for this function:

bool TimeStep::ge ( double  other_time) const
inline

Definition at line 104 of file time_governor.hh.

Here is the caller graph for this function:

TimeStep::gt ( double  other_time) const
inline

Performs rounding safe comparison time > other_time, i.e. time is strictly greater than given parameter other_time with precision relative to the magnitude of the numbers time step. TODO: introduce type TimeDouble with overloaded comparison operators, use it consistently in TimeMarks.

Performs rounding safe comparison time >= other_time See

Performs rounding safe comparison time < other_time. See

Performs rounding safe comparison time <= other_time. See

Performs rounding safe comparison time (step) == other_time. See

Definition at line 98 of file time_governor.hh.

Here is the caller graph for this function:

unsigned int TimeStep::index ( ) const
inline

Getters.

Definition at line 90 of file time_governor.hh.

Here is the caller graph for this function:

bool TimeStep::le ( double  other_time) const
inline

Definition at line 116 of file time_governor.hh.

double TimeStep::length ( ) const
inline

Definition at line 91 of file time_governor.hh.

Here is the caller graph for this function:

bool TimeStep::lt ( double  other_time) const
inline

Definition at line 110 of file time_governor.hh.

Here is the caller graph for this function:

TimeStep TimeStep::make_next ( double  new_length) const

Create subsequent time step.

Definition at line 93 of file time_governor.cc.

Here is the caller graph for this function:

TimeStep TimeStep::make_next ( double  new_lenght,
double  end_time 
) const

Create subsequent time step, with the explicitly specified. This allow slight discrepancy to overcome rounding errors in the case of fixed time step. Otherwise using small fixed time step, we may miss long term fixed goal time.

Definition at line 100 of file time_governor.cc.

bool TimeStep::operator== ( const TimeStep other)
inline

Returns true if two time steps are exactly the same.

Definition at line 131 of file time_governor.hh.

bool TimeStep::safe_compare ( double  t1,
double  t0 
) const
private

Definition at line 111 of file time_governor.cc.

Member Data Documentation

double TimeStep::end_
private

End time point of the time step.

Definition at line 149 of file time_governor.hh.

unsigned int TimeStep::index_
private

Index of the step is index if the end time. Zero time step is artificial.

Definition at line 144 of file time_governor.hh.

double TimeStep::length_
private

Length of the time step. Theoretically end minus end of the previous time step. However may be slightly different due to rounding errors.

Definition at line 147 of file time_governor.hh.


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