Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Tempus::TimeEventBase< Scalar > Class Template Reference

This class defines time events which can be used to "trigger" an action. More...

#include <Tempus_TimeEventBase.hpp>

Inheritance diagram for Tempus::TimeEventBase< Scalar >:
Tempus::TimeEventComposite< Scalar > Tempus::TimeEventList< Scalar > Tempus::TimeEventListIndex< Scalar > Tempus::TimeEventRange< Scalar > Tempus::TimeEventRangeIndex< Scalar >

Public Member Functions

 TimeEventBase ()
 Constructor. More...
 
virtual ~TimeEventBase ()
 Destructor. More...
 
virtual Teuchos::RCP< const
Teuchos::ParameterList
getValidParameters () const
 Return ParameterList with current values. More...
 

Protected Member Functions

virtual void setType (std::string s)
 

Private Attributes

std::string timeEventType_
 Time Event type. More...
 
std::string name_
 Name to identify the TimeEvent. More...
 
const Scalar defaultTime_
 Default time. More...
 
const Scalar defaultTol_
 Default tolerance. More...
 
const int defaultIndex_
 Default index. More...
 

Basic methods

virtual bool isTime (Scalar time) const
 Test if time is near an event (within tolerance). More...
 
virtual Scalar timeToNextEvent (Scalar time) const
 How much time until the next event. More...
 
virtual Scalar timeOfNextEvent (Scalar time) const
 Return the time of the next event following the input time. More...
 
virtual bool eventInRange (Scalar time1, Scalar time2) const
 Test if an event occurs within the time range. More...
 
virtual bool isIndex (int index) const
 Test if index is an event. More...
 
virtual int indexToNextEvent (int index) const
 How many indices until the next event. More...
 
virtual int indexOfNextEvent (int index) const
 Return the index of the next event following the input index. More...
 
virtual bool eventInRangeIndex (int index1, int index2) const
 Test if an event occurs within the index range. More...
 
virtual void describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
 Describe member data. More...
 
virtual Scalar getAbsTol () const
 Return the absolute tolerance. More...
 
virtual bool getLandOnExactly () const
 Return if the time events need to be landed on exactly. More...
 

Accessor methods

virtual std::string getName () const
 Return the name of the TimeEvent. More...
 
virtual void setName (std::string name)
 Set the name of the TimeEvent. More...
 
virtual std::string getType () const
 Return the type of TimeEvent. More...
 
virtual Scalar getDefaultTime () const
 Return the default time used for TimeEvents. More...
 
virtual Scalar getDefaultTol () const
 Return the default tolerance used by TimeEvents. More...
 
virtual int getDefaultIndex () const
 Return the default index used by TimeEvents. More...
 

Detailed Description

template<class Scalar>
class Tempus::TimeEventBase< Scalar >

This class defines time events which can be used to "trigger" an action.

Time events are points in time and/or timestep index where an an action should occur, such as, solution output (mesh and solution) diagnostic output, restart, screen dump, in-situ visualization, user-specified, or any other action.

This class will store a collection time events, so that an object may query it and take appropriate action. Time events (time and timestep index) can be specified via

Definition at line 36 of file Tempus_TimeEventBase.hpp.

Constructor & Destructor Documentation

template<class Scalar >
Tempus::TimeEventBase< Scalar >::TimeEventBase ( )
inline

Constructor.

Definition at line 39 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual Tempus::TimeEventBase< Scalar >::~TimeEventBase ( )
inlinevirtual

Destructor.

Definition at line 49 of file Tempus_TimeEventBase.hpp.

Member Function Documentation

template<class Scalar >
virtual bool Tempus::TimeEventBase< Scalar >::isTime ( Scalar  time) const
inlinevirtual

Test if time is near an event (within tolerance).

For TimeEventBase, always return false since it has no events. For TimeEvents that are not time based (e.g., index-based events - TimeEventRangeIndex), they do not do not have a time, so return false.

Parameters
time[in] The input time.
Returns
True if time is near an event (within absolute tolerance).

Reimplemented in Tempus::TimeEventComposite< Scalar >, Tempus::TimeEventRange< Scalar >, and Tempus::TimeEventList< Scalar >.

Definition at line 63 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual Scalar Tempus::TimeEventBase< Scalar >::timeToNextEvent ( Scalar  time) const
inlinevirtual

How much time until the next event.

For TimeEventBase, the time to the next event is the default time, since TimeEventBase has no events. For TimeEvents that are not time based (e.g., index-based events - TimeEventRangeIndex), they do not do not have a time to the next event, so return the default time.

Returns
The time to the next event.

Reimplemented in Tempus::TimeEventComposite< Scalar >, Tempus::TimeEventRange< Scalar >, and Tempus::TimeEventList< Scalar >.

Definition at line 75 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual Scalar Tempus::TimeEventBase< Scalar >::timeOfNextEvent ( Scalar  time) const
inlinevirtual

Return the time of the next event following the input time.

Returns the time of the next event that follows the input time. If the input time is before all events, the time of the first event is returned. If the input time is after all events, the default time (a time in the distant future) is returned. If the input time is an event time, the time of the next event is returned.

For TimeEventBase, always return the default time. For TimeEvents that are not time based (e.g., index-based events - TimeEventRangeIndex), they do not do not have a time of the next event, so return the default time.

Parameters
time[in] Input time.
Returns
Time of the next event.

Reimplemented in Tempus::TimeEventComposite< Scalar >, Tempus::TimeEventRange< Scalar >, and Tempus::TimeEventList< Scalar >.

Definition at line 93 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual bool Tempus::TimeEventBase< Scalar >::eventInRange ( Scalar  time1,
Scalar  time2 
) const
inlinevirtual

Test if an event occurs within the time range.

Find if an event is within the input range, (time1 < timeEvent-absTol and timeEvent-absTol <= time2), including the event's absolute tolerance. Note, this does not include time1, but does include time2.

For TimeEventBase, always return false since it has no events. For TimeEvents that are not time based (e.g., index-based events - TimeEventRangeIndex), there is not not event in range, so return false.

Parameters
time1[in] Input time of one end of the range.
time2[in] Input time of the other end of the range.
Returns
True if a time event is within the range.

Reimplemented in Tempus::TimeEventComposite< Scalar >, Tempus::TimeEventRange< Scalar >, and Tempus::TimeEventList< Scalar >.

Definition at line 112 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual bool Tempus::TimeEventBase< Scalar >::isIndex ( int  index) const
inlinevirtual

Test if index is an event.

For TimeEventBase, always return false since it has no events. For TimeEvents that are not index based (e.g., time-based events - TimeEventRange), they do not do not have an index, so return false.

Parameters
index[in] The input index.
Returns
True if index is an event.

Reimplemented in Tempus::TimeEventComposite< Scalar >, Tempus::TimeEventListIndex< Scalar >, and Tempus::TimeEventRangeIndex< Scalar >.

Definition at line 124 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual int Tempus::TimeEventBase< Scalar >::indexToNextEvent ( int  index) const
inlinevirtual

How many indices until the next event.

For TimeEventBase, the index to the next event is the default index. For TimeEvents that are not index based (e.g., time-based events - TimeEventRange), they do not do not have an index to the next event, so return the default index.

Returns
The index to the next event.

Reimplemented in Tempus::TimeEventComposite< Scalar >, Tempus::TimeEventListIndex< Scalar >, and Tempus::TimeEventRangeIndex< Scalar >.

Definition at line 135 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual int Tempus::TimeEventBase< Scalar >::indexOfNextEvent ( int  index) const
inlinevirtual

Return the index of the next event following the input index.

Returns the index of the next event that follows the input index. If the input index is before all events, the index of the first event is returned. If the input index is after all events, the default index (an index in the distant future) is returned. If the input index is an event index, the index of the next event is returned.

For TimeEventBase, always return the default index. For TimeEvents that are not index based (e.g., time-based events - TimeEventRange), they do not do not have an index of the next event, so return default index.

Parameters
index[in] Input index.
Returns
Index of the next event.

Reimplemented in Tempus::TimeEventComposite< Scalar >, Tempus::TimeEventListIndex< Scalar >, and Tempus::TimeEventRangeIndex< Scalar >.

Definition at line 153 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual bool Tempus::TimeEventBase< Scalar >::eventInRangeIndex ( int  index1,
int  index2 
) const
inlinevirtual

Test if an event occurs within the index range.

Find if an event is within the input range, ( index1 < event <= index2 ).

For TimeEventBase, always return false since it has no events. For TimeEvents that are not index based (e.g., time-based events - TimeEventRange), they do not do not have an index in range, so return false.

Parameters
index1[in] Input index of one end of the range.
index2[in] Input index of the other end of the range.
Returns
True if a index event is within the range.

Reimplemented in Tempus::TimeEventComposite< Scalar >, Tempus::TimeEventListIndex< Scalar >, and Tempus::TimeEventRangeIndex< Scalar >.

Definition at line 170 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual void Tempus::TimeEventBase< Scalar >::describe ( Teuchos::FancyOStream out,
const Teuchos::EVerbosityLevel  verbLevel 
) const
inlinevirtual
template<class Scalar >
virtual Scalar Tempus::TimeEventBase< Scalar >::getAbsTol ( ) const
inlinevirtual

Return the absolute tolerance.

The absolute tolerance is primarily used to determine if two times are equal (i.e., t1 is equal to t2, if t2-absTol < t1 < t2+absTol).

For TimeEventBase and TimeEvents that are not time based (e.g., index-based events - TimeEventRangeIndex), the absolute tolerance is the default tolerance.

Returns
The absolute tolerance.

Reimplemented in Tempus::TimeEventComposite< Scalar >, Tempus::TimeEventRange< Scalar >, and Tempus::TimeEventList< Scalar >.

Definition at line 195 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual bool Tempus::TimeEventBase< Scalar >::getLandOnExactly ( ) const
inlinevirtual

Return if the time events need to be landed on exactly.

If true, this returns whether the time events need to be landed on exactly, e.g., the time step needs to be adjusted so the solution is determined at the time event.

If false, this indicates that time event will still occur but can be stepped over without changing the time step.

This is for TimeEvents that are time based, e.g., TimeEventRange and TimeEventList. For TimeEvents that are not time based (e.g., index-based events - TimeEventRangeIndex and TimeEventListIndex), there is no need to flag this, so return false.

Returns
LOE Flag indicating if TimeEvent should land on the time event exactly.

Reimplemented in Tempus::TimeEventComposite< Scalar >, Tempus::TimeEventRange< Scalar >, and Tempus::TimeEventList< Scalar >.

Definition at line 214 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual std::string Tempus::TimeEventBase< Scalar >::getName ( ) const
inlinevirtual

Return the name of the TimeEvent.

The name of the TimeEvent can be used to identify specific TimeEvents in order to take action related to that TimeEvent (e.g., a name of "Output Special" may indicate to output some special information).

Returns
The name of the TimeEvent.

Definition at line 229 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual void Tempus::TimeEventBase< Scalar >::setName ( std::string  name)
inlinevirtual

Set the name of the TimeEvent.

Definition at line 231 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual std::string Tempus::TimeEventBase< Scalar >::getType ( ) const
inlinevirtual

Return the type of TimeEvent.

Each derived class of TimeEventBase has a type that can be used to identify the type of the TimeEvent.

Definition at line 237 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual Scalar Tempus::TimeEventBase< Scalar >::getDefaultTime ( ) const
inlinevirtual

Return the default time used for TimeEvents.

Definition at line 239 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual Scalar Tempus::TimeEventBase< Scalar >::getDefaultTol ( ) const
inlinevirtual

Return the default tolerance used by TimeEvents.

Definition at line 241 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual int Tempus::TimeEventBase< Scalar >::getDefaultIndex ( ) const
inlinevirtual

Return the default index used by TimeEvents.

Definition at line 243 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
virtual Teuchos::RCP<const Teuchos::ParameterList> Tempus::TimeEventBase< Scalar >::getValidParameters ( ) const
inlinevirtual
template<class Scalar >
virtual void Tempus::TimeEventBase< Scalar >::setType ( std::string  s)
inlineprotectedvirtual

Definition at line 260 of file Tempus_TimeEventBase.hpp.

Member Data Documentation

template<class Scalar >
std::string Tempus::TimeEventBase< Scalar >::timeEventType_
private

Time Event type.

Definition at line 263 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
std::string Tempus::TimeEventBase< Scalar >::name_
private

Name to identify the TimeEvent.

Definition at line 264 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
const Scalar Tempus::TimeEventBase< Scalar >::defaultTime_
private

Default time.

Definition at line 265 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
const Scalar Tempus::TimeEventBase< Scalar >::defaultTol_
private

Default tolerance.

Definition at line 266 of file Tempus_TimeEventBase.hpp.

template<class Scalar >
const int Tempus::TimeEventBase< Scalar >::defaultIndex_
private

Default index.

Definition at line 267 of file Tempus_TimeEventBase.hpp.


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