OGS
NumLib::TimeStep Class Referencefinal

Detailed Description

Time step object.

TimeStep class contains previous time( \(t_{n}\)), current time ( \(t_{n+1}\)), time step length ( \(\Delta t_{n+1}\)), and the number of time steps ( \(n+1\)).

Definition at line 30 of file TimeStep.h.

#include <TimeStep.h>

Collaboration diagram for NumLib::TimeStep:
[legend]

Public Member Functions

 TimeStep (Time const &current_time)
 
 TimeStep (Time const &previous_time, Time const &current_time, std::size_t n)
 
 TimeStep (const TimeStep &src)=default
 copy a time step
 
TimeStepoperator= (const TimeStep &src)=default
 copy a time step
 
TimeStepoperator+= (const double dt)
 increment time step
 
Time previous () const
 return previous time step
 
Time current () const
 return current time step
 
double dt () const
 time step size from _previous
 
std::size_t timeStepNumber () const
 the time step number
 
void setAccepted (bool const accepted)
 
bool isAccepted () const
 

Private Attributes

Time _previous
 previous time step
 
Time _current
 current time step
 
double _dt
 time step size
 
std::size_t _time_step_number
 the number of time steps
 
bool _is_accepted = true
 is the timestep accepted
 

Constructor & Destructor Documentation

◆ TimeStep() [1/3]

NumLib::TimeStep::TimeStep ( Time const & current_time)
inlineexplicit

Initialize a time step

Parameters
current_timecurrent time

Definition at line 37 of file TimeStep.h.

38 : _previous(current_time),
39 _current(current_time),
40 _dt(0.0),
42 {
43 }
Time _current
current time step
Definition TimeStep.h:91
Time _previous
previous time step
Definition TimeStep.h:89
std::size_t _time_step_number
the number of time steps
Definition TimeStep.h:95
double _dt
time step size
Definition TimeStep.h:93

◆ TimeStep() [2/3]

NumLib::TimeStep::TimeStep ( Time const & previous_time,
Time const & current_time,
std::size_t n )
inline

Initialize a time step

Parameters
previous_timeprevious time
current_timecurrent time
nthe number of time steps

Definition at line 51 of file TimeStep.h.

52 : _previous(previous_time),
53 _current(current_time),
54 _dt(_current() - _previous()),
56 {
57 }

◆ TimeStep() [3/3]

NumLib::TimeStep::TimeStep ( const TimeStep & src)
default

copy a time step

Member Function Documentation

◆ current()

Time NumLib::TimeStep::current ( ) const
inline

◆ dt()

◆ isAccepted()

bool NumLib::TimeStep::isAccepted ( ) const
inline

◆ operator+=()

TimeStep & NumLib::TimeStep::operator+= ( const double dt)
inline

increment time step

Definition at line 66 of file TimeStep.h.

67 {
69 _current += dt;
70 _dt = dt;
72 return *this;
73 }
double dt() const
time step size from _previous
Definition TimeStep.h:80

References _current, _dt, _previous, _time_step_number, and dt().

◆ operator=()

TimeStep & NumLib::TimeStep::operator= ( const TimeStep & src)
default

copy a time step

◆ previous()

Time NumLib::TimeStep::previous ( ) const
inline

return previous time step

Definition at line 76 of file TimeStep.h.

76{ return _previous; }

References _previous.

Referenced by NumLib::IterationNumberBasedTimeStepping::next().

◆ setAccepted()

void NumLib::TimeStep::setAccepted ( bool const accepted)
inline

Definition at line 84 of file TimeStep.h.

84{ _is_accepted = accepted; }

References _is_accepted.

Referenced by NumLib::EvolutionaryPIDcontroller::next().

◆ timeStepNumber()

std::size_t NumLib::TimeStep::timeStepNumber ( ) const
inline

Member Data Documentation

◆ _current

Time NumLib::TimeStep::_current
private

current time step

Definition at line 91 of file TimeStep.h.

Referenced by current(), and operator+=().

◆ _dt

double NumLib::TimeStep::_dt
private

time step size

Definition at line 93 of file TimeStep.h.

Referenced by dt(), and operator+=().

◆ _is_accepted

bool NumLib::TimeStep::_is_accepted = true
private

is the timestep accepted

Definition at line 97 of file TimeStep.h.

Referenced by isAccepted(), and setAccepted().

◆ _previous

Time NumLib::TimeStep::_previous
private

previous time step

Definition at line 89 of file TimeStep.h.

Referenced by operator+=(), and previous().

◆ _time_step_number

std::size_t NumLib::TimeStep::_time_step_number
private

the number of time steps

Definition at line 95 of file TimeStep.h.

Referenced by operator+=(), and timeStepNumber().


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