LifeV
TimeData Class Reference

TimeData - Class for handling temporal discretization. More...

#include <TimeData.hpp>

+ Inheritance diagram for TimeData:
+ Collaboration diagram for TimeData:

Private Attributes

Real M_initialTime
 initial time More...
 
Real M_endTime
 end time More...
 
Real M_periodTime
 period time More...
 
Real M_time
 current time More...
 
Real M_timeStep
 time step More...
 
UInt M_timeStepNumber
 iteration number More...
 

Constructors & Destructor

 TimeData ()
 Empty Constructor. More...
 
 TimeData (const GetPot &dataFile, const std::string &section="time_discretization")
 Constructor. More...
 
 TimeData (const TimeData &TimeData)
 Copy constructor. More...
 
virtual ~TimeData ()
 Virtual destructor. More...
 

Methods

void setup (const GetPot &dfile, const std::string &section="time_discretization")
 Read the dataFile and set all the internal quantities. More...
 
void updateTime ()
 Update the time by a timestep. More...
 
bool canAdvance ()
 Return if we can make a new timestep. More...
 
bool isFirstTimeStep ()
 Return if it is the initial time step. More...
 
bool isLastTimeStep ()
 Return if it is the last time step. More...
 
void showMe (std::ostream &output=std::cout) const
 Display general information about the content of the class. More...
 

Utility methods

Real round (const Real &n, const Int &decimal=10) const
 

Set Methods

void setInitialTime (const Real &initialTime)
 Set the initial time step. More...
 
void setEndTime (const Real &endTime)
 Set the final time step. More...
 
void setTime (const Real &time)
 Set the present time of the simulation. More...
 
void setTimeStep (const Real &timeStep)
 Set the initial time step. More...
 
void setTimeStepNumber (const UInt &timeStepNumber)
 Set the time step number. More...
 

Get Methods

const RealinitialTime () const
 Get the initial time step. More...
 
const RealendTime () const
 Get the final time step. More...
 
const RealperiodTime () const
 Get the period. More...
 
const Realtime () const
 Get the present time. More...
 
Real leftTime () const
 Get the time left. More...
 
Real elapsedTime () const
 Get the elapsed time. More...
 
Real inCycleTime () const
 Get the present time shifted inside the first cycle (i.e. More...
 
Real previousTime () const
 Get the previous time. More...
 
Real nextTime () const
 Get the next time. More...
 
const RealtimeStep () const
 Get the time step used for advancing. More...
 
const UInttimeStepNumber () const
 Get the number of time step performed. More...
 

Detailed Description

TimeData - Class for handling temporal discretization.

Author
Cristiano Malossi

The class is a data container for the time discretization.

Definition at line 61 of file TimeData.hpp.

Constructor & Destructor Documentation

◆ TimeData() [1/3]

TimeData ( )

Empty Constructor.

Definition at line 46 of file TimeData.cpp.

◆ TimeData() [2/3]

TimeData ( const GetPot dataFile,
const std::string &  section = "time_discretization" 
)

Constructor.

Parameters
dataFileGetPot data file
sectionthe section on the data file that contains the information on the time discretization

Definition at line 56 of file TimeData.cpp.

◆ TimeData() [3/3]

TimeData ( const TimeData TimeData)

Copy constructor.

Parameters
TimeData- TimeData class

Definition at line 62 of file TimeData.cpp.

◆ ~TimeData()

virtual ~TimeData ( )
inlinevirtual

Virtual destructor.

Definition at line 85 of file TimeData.hpp.

Member Function Documentation

◆ setup()

void setup ( const GetPot dfile,
const std::string &  section = "time_discretization" 
)

Read the dataFile and set all the internal quantities.

Parameters
dataFiledata file
sectionsection of the file

Definition at line 76 of file TimeData.cpp.

+ Here is the caller graph for this function:

◆ updateTime()

void updateTime ( )
inline

Update the time by a timestep.

Definition at line 101 of file TimeData.hpp.

◆ canAdvance()

bool canAdvance ( )
inline

Return if we can make a new timestep.

Returns
true if time <= endTime, false viceversa

Definition at line 111 of file TimeData.hpp.

◆ isFirstTimeStep()

bool isFirstTimeStep ( )
inline

Return if it is the initial time step.

Returns
true if time = initial time, false viceversa

Definition at line 120 of file TimeData.hpp.

◆ isLastTimeStep()

bool isLastTimeStep ( )
inline

Return if it is the last time step.

Returns
true if time + timestep > endTime, false viceversa.

Definition at line 129 of file TimeData.hpp.

◆ showMe()

void showMe ( std::ostream &  output = std::cout) const

Display general information about the content of the class.

Parameters
output- specify the output format (std::cout by default)

Definition at line 86 of file TimeData.cpp.

◆ round()

Real round ( const Real n,
const Int decimal = 10 
) const

Definition at line 104 of file TimeData.cpp.

+ Here is the caller graph for this function:

◆ setInitialTime()

void setInitialTime ( const Real initialTime)
inline

Set the initial time step.

Parameters
initialTimeinitial time step value

Definition at line 158 of file TimeData.hpp.

◆ setEndTime()

void setEndTime ( const Real endTime)
inline

Set the final time step.

Parameters
endtimefinal time step value

Definition at line 167 of file TimeData.hpp.

◆ setTime()

void setTime ( const Real time)
inline

Set the present time of the simulation.

Parameters
timepresent time value

Definition at line 176 of file TimeData.hpp.

◆ setTimeStep()

void setTimeStep ( const Real timeStep)
inline

Set the initial time step.

Parameters
timeStepinitial time step value

Definition at line 185 of file TimeData.hpp.

◆ setTimeStepNumber()

void setTimeStepNumber ( const UInt timeStepNumber)
inline

Set the time step number.

Parameters
timeStepNumbertime step number

Definition at line 194 of file TimeData.hpp.

◆ initialTime()

const Real& initialTime ( ) const
inline

Get the initial time step.

Returns
initial time step value

Definition at line 209 of file TimeData.hpp.

◆ endTime()

const Real& endTime ( ) const
inline

Get the final time step.

Returns
final time step value

Definition at line 218 of file TimeData.hpp.

◆ periodTime()

const Real& periodTime ( ) const
inline

Get the period.

Returns
period value

Definition at line 227 of file TimeData.hpp.

◆ time()

const Real& time ( ) const
inline

Get the present time.

Returns
time value

Definition at line 236 of file TimeData.hpp.

◆ leftTime()

Real leftTime ( ) const
inline

Get the time left.

Returns
time left value

Definition at line 245 of file TimeData.hpp.

◆ elapsedTime()

Real elapsedTime ( ) const
inline

Get the elapsed time.

Returns
elapsed time value

Definition at line 254 of file TimeData.hpp.

◆ inCycleTime()

Real inCycleTime ( ) const
inline

Get the present time shifted inside the first cycle (i.e.

in the interval (M_initialTime,M_periodTime)). Useful for periodic behavior, e.g. BC.

Returns
time value in first cycle

Definition at line 265 of file TimeData.hpp.

◆ previousTime()

Real previousTime ( ) const
inline

Get the previous time.

Returns
previous time value

Definition at line 274 of file TimeData.hpp.

◆ nextTime()

Real nextTime ( ) const
inline

Get the next time.

Returns
next time value

Definition at line 283 of file TimeData.hpp.

◆ timeStep()

const Real& timeStep ( ) const
inline

Get the time step used for advancing.

Returns
time step value

Definition at line 292 of file TimeData.hpp.

◆ timeStepNumber()

const UInt& timeStepNumber ( ) const
inline

Get the number of time step performed.

Returns
time step performed

Definition at line 301 of file TimeData.hpp.

Field Documentation

◆ M_initialTime

Real M_initialTime
private

initial time

Definition at line 311 of file TimeData.hpp.

◆ M_endTime

Real M_endTime
private

end time

Definition at line 314 of file TimeData.hpp.

◆ M_periodTime

Real M_periodTime
private

period time

Definition at line 317 of file TimeData.hpp.

◆ M_time

Real M_time
private

current time

Definition at line 320 of file TimeData.hpp.

◆ M_timeStep

Real M_timeStep
private

time step

Definition at line 323 of file TimeData.hpp.

◆ M_timeStepNumber

UInt M_timeStepNumber
private

iteration number

Definition at line 326 of file TimeData.hpp.


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