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 | Protected Attributes | List of all members
Tempus::TimeEventList< Scalar > Class Template Reference

TimeEventList specifies a list of time events. More...

#include <Tempus_TimeEventList_decl.hpp>

Inheritance diagram for Tempus::TimeEventList< Scalar >:
Tempus::TimeEventBase< Scalar >

Public Member Functions

 TimeEventList ()
 Default constructor. More...
 
 TimeEventList (std::vector< Scalar > timeList, std::string name="TimeEventList", bool landOnExactly=true, Scalar relTol=std::numeric_limits< Scalar >::epsilon()*Scalar(100.0))
 Construct with full argument list of data members. More...
 
virtual ~TimeEventList ()
 Destructor. More...
 
Teuchos::RCP< const
Teuchos::ParameterList
getValidParameters () const
 Return a valid ParameterList with current settings. More...
 
- Public Member Functions inherited from Tempus::TimeEventBase< Scalar >
 TimeEventBase ()
 Constructor. More...
 
virtual ~TimeEventBase ()
 Destructor. 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 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...
 

Protected Member Functions

virtual void setTimeScale ()
 Set the time scale for the time events. More...
 
- Protected Member Functions inherited from Tempus::TimeEventBase< Scalar >
virtual void setType (std::string s)
 

Protected Attributes

std::vector< Scalar > timeList_
 Sorted and unique list of time events. More...
 
Scalar timeScale_
 A reference time scale. More...
 
Scalar relTol_
 Relative time tolerance for matching time events. More...
 
Scalar absTol_
 Absolute time tolerance, relTol_*timeScale_. More...
 
bool landOnExactly_
 

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 void describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
 Describe member data. More...
 

Accessor methods

virtual std::vector< Scalar > getTimeList () const
 Return the list of time events. More...
 
virtual void setTimeList (std::vector< Scalar > timeList, bool sort=true)
 Set the list of time events. More...
 
virtual void addTime (Scalar time)
 Add the time to event vector. More...
 
virtual void clearTimeList ()
 Clear the vector of all events. More...
 
virtual Scalar getRelTol () const
 Return the relative tolerance. More...
 
virtual void setRelTol (Scalar relTol)
 Set the relative tolerance. 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...
 
virtual void setLandOnExactly (bool LOE)
 Set if the time event should be landed on exactly. More...
 

Detailed Description

template<class Scalar>
class Tempus::TimeEventList< Scalar >

TimeEventList specifies a list of time events.

Definition at line 28 of file Tempus_TimeEventList_decl.hpp.

Constructor & Destructor Documentation

template<class Scalar >
Tempus::TimeEventList< Scalar >::TimeEventList ( )

Default constructor.

Definition at line 18 of file Tempus_TimeEventList_impl.hpp.

template<class Scalar >
Tempus::TimeEventList< Scalar >::TimeEventList ( std::vector< Scalar >  timeList,
std::string  name = "TimeEventList< Scalar >",
bool  landOnExactly = true,
Scalar  relTol = std::numeric_limits<Scalar>::epsilon() * Scalar(100.0) 
)

Construct with full argument list of data members.

Definition at line 32 of file Tempus_TimeEventList_impl.hpp.

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

Destructor.

Definition at line 40 of file Tempus_TimeEventList_decl.hpp.

Member Function Documentation

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

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

Test if any of the events in the list is near the input time.

Parameters
[in]timeThe input time to check if it is near an event.
Returns
Return true if time is near a TimeEvent ( timeEvent-absTol < time < timeEvent+absTol ), otherwise return false.

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 121 of file Tempus_TimeEventList_impl.hpp.

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

How much time until the next event.

Determine the amount of time until the next timeEvent in the list (i.e., time of next event minus the input time). If the input time is after all events, the default time (a time in the distant future) minus the input time is returned.

Parameters
time[in] The input time.
Returns
The time to the next event.

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 130 of file Tempus_TimeEventList_impl.hpp.

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

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.

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

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 136 of file Tempus_TimeEventList_impl.hpp.

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

Test if an event occurs within the time range.

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

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 from Tempus::TimeEventBase< Scalar >.

Definition at line 158 of file Tempus_TimeEventList_impl.hpp.

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

Describe member data.

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 175 of file Tempus_TimeEventList_impl.hpp.

template<class Scalar >
virtual std::vector<Scalar> Tempus::TimeEventList< Scalar >::getTimeList ( ) const
inlinevirtual

Return the list of time events.

Definition at line 103 of file Tempus_TimeEventList_decl.hpp.

template<class Scalar >
void Tempus::TimeEventList< Scalar >::setTimeList ( std::vector< Scalar >  timeList,
bool  sort = true 
)
virtual

Set the list of time events.

This will completely replace the vector of time events. If sort=true, the vector will be sorted and duplicate entries removed (i.e., only has unique entries).

Parameters
timeList[in] Vector of time event.
sort[in] Sort vector into ascending order, if true.

Definition at line 69 of file Tempus_TimeEventList_impl.hpp.

template<class Scalar >
void Tempus::TimeEventList< Scalar >::addTime ( Scalar  time)
virtual

Add the time to event vector.

The input time will be inserted into the vector of events in ascending order. If the time is already present (within tolerance), it is not added to keep the vector unique.

Parameters
time[in] Time to insert to vector of events.

Definition at line 80 of file Tempus_TimeEventList_impl.hpp.

template<class Scalar >
virtual void Tempus::TimeEventList< Scalar >::clearTimeList ( )
inlinevirtual

Clear the vector of all events.

Definition at line 128 of file Tempus_TimeEventList_decl.hpp.

template<class Scalar >
virtual Scalar Tempus::TimeEventList< Scalar >::getRelTol ( ) const
inlinevirtual

Return the relative tolerance.

Definition at line 131 of file Tempus_TimeEventList_decl.hpp.

template<class Scalar >
void Tempus::TimeEventList< Scalar >::setRelTol ( Scalar  relTol)
virtual

Set the relative tolerance.

The relative tolerance is used to set the absolute tolerance along with the TimeEvent time scale i.e., absTol_ = timeScale_ * relTol_. Also see getAbsTol() and setTimeScale().

Parameters
relTol[in] The input relative tolerance.

Definition at line 114 of file Tempus_TimeEventList_impl.hpp.

template<class Scalar >
virtual Scalar Tempus::TimeEventList< 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 TimeEventList,

Returns
The absolute tolerance.

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 154 of file Tempus_TimeEventList_decl.hpp.

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

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

If true, this sets 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.

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

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 168 of file Tempus_TimeEventList_decl.hpp.

template<class Scalar >
virtual void Tempus::TimeEventList< Scalar >::setLandOnExactly ( bool  LOE)
inlinevirtual

Set if the time event should be landed on exactly.

Definition at line 171 of file Tempus_TimeEventList_decl.hpp.

template<class Scalar >
Teuchos::RCP< const Teuchos::ParameterList > Tempus::TimeEventList< Scalar >::getValidParameters ( ) const
virtual

Return a valid ParameterList with current settings.

The returned ParameterList will contain the current parameters and can be used to reconstruct the TimeEventList using createTimeEventList(...). The ParameterList will have the TimeEventList parameters along with all the parameters for the TimeEvents contained in the composite.

Returns
Teuchos::ParameterList of TimeEventList.

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 203 of file Tempus_TimeEventList_impl.hpp.

template<class Scalar >
void Tempus::TimeEventList< Scalar >::setTimeScale ( )
protectedvirtual

Set the time scale for the time events.

This sets the reference time scale, which is solely determined from the time events in timeList_ (this is why it is a protected function). It tries to find an appropriate scale for the time events, e.g., max(t0, ..., tn).

Definition at line 49 of file Tempus_TimeEventList_impl.hpp.

Member Data Documentation

template<class Scalar >
std::vector<Scalar> Tempus::TimeEventList< Scalar >::timeList_
protected

Sorted and unique list of time events.

Definition at line 197 of file Tempus_TimeEventList_decl.hpp.

template<class Scalar >
Scalar Tempus::TimeEventList< Scalar >::timeScale_
protected

A reference time scale.

Definition at line 199 of file Tempus_TimeEventList_decl.hpp.

template<class Scalar >
Scalar Tempus::TimeEventList< Scalar >::relTol_
protected

Relative time tolerance for matching time events.

Definition at line 200 of file Tempus_TimeEventList_decl.hpp.

template<class Scalar >
Scalar Tempus::TimeEventList< Scalar >::absTol_
protected

Absolute time tolerance, relTol_*timeScale_.

Definition at line 201 of file Tempus_TimeEventList_decl.hpp.

template<class Scalar >
bool Tempus::TimeEventList< Scalar >::landOnExactly_
protected

Should these time events be landed on exactly, i.e, adjust the timestep to hit time event, versus stepping over and keeping the time step unchanged.

Definition at line 202 of file Tempus_TimeEventList_decl.hpp.


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