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

This composite TimeEvent loops over added TimeEvents. More...

#include <Tempus_TimeEventComposite.hpp>

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

Public Member Functions

 TimeEventComposite ()
 Default Constructor. More...
 
 TimeEventComposite (std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > te, std::string name="TimeEventComposite")
 Construct with full argument list of data members. More...
 
virtual ~TimeEventComposite ()
 Destructor. More...
 
void add (Teuchos::RCP< TimeEventBase< Scalar > > timeEvent)
 Add TimeEvent to the TimeEvent vector. More...
 
void remove (std::string name)
 Remove TimeEvent based on name. More...
 
Teuchos::RCP< TimeEventBase
< Scalar > > 
find (std::string name)
 Find TimeEvent based on name. More...
 
void clear ()
 Clear the TimeEvent vector. More...
 
std::size_t getSize () const
 Return the size of the TimeEvent vector. More...
 
std::string getTimeEventNames () const
 Return a string of the names of Time Events (comma separated). More...
 
virtual void describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
 Describe member data. More...
 
virtual 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 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 Attributes

std::vector< Teuchos::RCP
< TimeEventBase< Scalar > > > 
timeEvents_
 

Basic methods

virtual std::vector
< Teuchos::RCP< TimeEventBase
< Scalar > > > 
getTimeEvents () const
 Get a copy of the current set of TimeEvents. More...
 
virtual void setTimeEvents (std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > te)
 Set the TimeEvents. More...
 
virtual bool isTime (Scalar time) const
 Test if time is near a TimeEvent (within tolerance). More...
 
virtual bool isTime (Scalar time, std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &timeEvents) const
 Test if time is near a TimeEvent (within tolerance) plus the constraining TimeEvent(s). More...
 
virtual Scalar timeToNextEvent (Scalar time) const
 How much time until the next event. More...
 
virtual Scalar timeToNextEvent (Scalar time, std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &timeEvents) const
 How much time until the next event plus the constraining TimeEvent(s). More...
 
virtual Scalar timeOfNextEvent (Scalar time) const
 Return the time of the next event following the input time. More...
 
virtual Scalar timeOfNextEvent (Scalar time, std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &timeEvents) const
 Return the time of the next time event and constraining TimeEvent(s). More...
 
virtual bool eventInRange (Scalar time1, Scalar time2) const
 Test if an event occurs within the time range. More...
 
virtual bool eventInRange (Scalar time1, Scalar time2, std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &timeEvents) const
 Test if an event occurs within the time range plus the constraining TimeEvent(s). More...
 
virtual bool isIndex (int index) const
 Test if index is a time event. More...
 
virtual bool isIndex (int index, std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &timeEvents) const
 Test if index is a time event plus the constraining TimeEvent(s). More...
 
virtual int indexToNextEvent (int index) const
 How many indices until the next event. More...
 
virtual int indexToNextEvent (int index, std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &timeEvents) 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 int indexOfNextEvent (int index, std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &timeEvents) const
 Return the index of the next event following the input index plus the constraining TimeEvent(s). More...
 
virtual bool eventInRangeIndex (int index1, int index2) const
 Test if an event occurs within the index range. More...
 
virtual bool eventInRangeIndex (int index1, int index2, std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &timeEvents) const
 Test if an event occurs within the index range plus the constraining TimeEvent(s). More...
 
virtual Scalar getAbsTol () const
 Return the largest absolute tolerance from all the TimeEvents. More...
 
virtual Scalar getAbsTol (std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &timeEvents) const
 Return the largest absolute tolerance from all the TimeEvents plus the constraining TimeEvent(s). More...
 
virtual bool getLandOnExactly () const
 Return if the time events need to be landed on exactly. More...
 
virtual bool getLandOnExactly (std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &timeEvents) const
 Return if the time events need to be landed on exactly plus the constraining TimeEvent(s). More...
 

Additional Inherited Members

- Protected Member Functions inherited from Tempus::TimeEventBase< Scalar >
virtual void setType (std::string s)
 

Detailed Description

template<class Scalar>
class Tempus::TimeEventComposite< Scalar >

This composite TimeEvent loops over added TimeEvents.

Individual TimeEvents are executed in the order in which they were added.

Definition at line 31 of file Tempus_TimeEventComposite.hpp.

Constructor & Destructor Documentation

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

Default Constructor.

Definition at line 34 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
Tempus::TimeEventComposite< Scalar >::TimeEventComposite ( std::vector< Teuchos::RCP< TimeEventBase< Scalar > > >  te,
std::string  name = "TimeEventComposite< Scalar >" 
)
inline

Construct with full argument list of data members.

Definition at line 41 of file Tempus_TimeEventComposite.hpp.

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

Destructor.

Definition at line 50 of file Tempus_TimeEventComposite.hpp.

Member Function Documentation

template<class Scalar >
virtual std::vector<Teuchos::RCP<TimeEventBase<Scalar> > > Tempus::TimeEventComposite< Scalar >::getTimeEvents ( ) const
inlinevirtual

Get a copy of the current set of TimeEvents.

Definition at line 55 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
virtual void Tempus::TimeEventComposite< Scalar >::setTimeEvents ( std::vector< Teuchos::RCP< TimeEventBase< Scalar > > >  te)
inlinevirtual

Set the TimeEvents.

This completely replaces the current set of TimeEvents with the input TimeEvents

Parameters
te[in] The input set of TimeEvents.

Definition at line 69 of file Tempus_TimeEventComposite.hpp.

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

Test if time is near a TimeEvent (within tolerance).

Return true if one of the TimeEvents in the composite is within tolerance of the input time.

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

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 83 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
virtual bool Tempus::TimeEventComposite< Scalar >::isTime ( Scalar  time,
std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &  timeEvents 
) const
inlinevirtual

Test if time is near a TimeEvent (within tolerance) plus the constraining TimeEvent(s).

Return true if one of the TimeEvents in the composite is near the input time, and the constraining TimeEvent(s) so additional details about the event can be queried.

Parameters
time[in] The input time.
timeEvents[out] Vector of constraining TimeEvents.
Returns
True if time is near an event (within absolute tolerance).

Definition at line 100 of file Tempus_TimeEventComposite.hpp.

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

How much time until the next event.

Return the amount of time to the next event (i.e., time of next event minus the input time).

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

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 119 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
virtual Scalar Tempus::TimeEventComposite< Scalar >::timeToNextEvent ( Scalar  time,
std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &  timeEvents 
) const
inlinevirtual

How much time until the next event plus the constraining TimeEvent(s).

Return the amount of time to the next event (i.e., time of next event minus the input time), and the constraining TimeEvent so additional details about the event can be queried.

Parameters
time[in] The input time.
timeEvents[out] Vector of constraining TimeEvent.
Returns
The time to the next event.

Definition at line 135 of file Tempus_TimeEventComposite.hpp.

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

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

See timeOfNextEvent(time, timeEvent).

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

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 149 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
virtual Scalar Tempus::TimeEventComposite< Scalar >::timeOfNextEvent ( Scalar  time,
std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &  timeEvents 
) const
inlinevirtual

Return the time of the next time event and constraining TimeEvent(s).

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 TimeEventComposite, find the next time event from all the TimeEvents in the composite.

Additionally, output the constraining TimeEvents so additional details about the events can be queried.

Parameters
time[in] Input time.
timeEvents[out] Constraining TimeEvent.
Returns
Time of the next event.

Definition at line 174 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
virtual bool Tempus::TimeEventComposite< 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 < event-absTol and timeEvent-absTol <= time2), including the event's absolute tolerance. For TimeEventComposite, test each TimeEvent to determine if the input time is within the range.

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 213 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
virtual bool Tempus::TimeEventComposite< Scalar >::eventInRange ( Scalar  time1,
Scalar  time2,
std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &  timeEvents 
) const
inlinevirtual

Test if an event occurs within the time range plus the constraining TimeEvent(s).

Find if an event is within the input range, (time1 < event-absTol and timeEvent-absTol <= time2), including the event's absolute tolerance. For TimeEventComposite, test each TimeEvent to determine if the input time is within the range.

Additionally, the constraining TimeEvents are sorted by "time of next event", and returned, so additional details about the events can be queried.

Parameters
time1[in] Input time of one end of the range.
time2[in] Input time of the other end of the range.
timeEvents[out] Vector of sorted constraining TimeEvent(s).
Returns
True if a time event is within the range.

Definition at line 238 of file Tempus_TimeEventComposite.hpp.

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

Test if index is a time event.

Return true if one of the TimeEvents in the composite is the input index.

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

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 266 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
virtual bool Tempus::TimeEventComposite< Scalar >::isIndex ( int  index,
std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &  timeEvents 
) const
inlinevirtual

Test if index is a time event plus the constraining TimeEvent(s).

Return true if one of the TimeEvents indices in the composite is near the input index, and the constraining TimeEvent so additional details about the event can be queried.

Parameters
index[in] The input index.
timeEvents[out] Vector of constraining TimeEvents.
Returns
True if index is an event.

Definition at line 282 of file Tempus_TimeEventComposite.hpp.

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

How many indices until the next event.

Parameters
index[in] The input index.
Returns
The number of steps (indices) to the next event.

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 298 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
virtual int Tempus::TimeEventComposite< Scalar >::indexToNextEvent ( int  index,
std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &  timeEvents 
) const
inlinevirtual

How many indices until the next event.

Parameters
index[in] The input index.
timeEvents[out] The constraining TimeEvent.
Returns
The number of steps (indices) to the next event.

Definition at line 309 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
virtual int Tempus::TimeEventComposite< 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.

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

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 327 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
virtual int Tempus::TimeEventComposite< Scalar >::indexOfNextEvent ( int  index,
std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &  timeEvents 
) const
inlinevirtual

Return the index of the next event following the input index plus the constraining TimeEvent(s).

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 (a index in the distant future) is returned. If the input index is an event index, the index of the next event is returned.

Parameters
index[in] Input index.
timeEvents[out] Vector of constraining TimeEvent(s).
Returns
Index of the next event.

Definition at line 346 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
virtual bool Tempus::TimeEventComposite< 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, inclusively ( index1 <= event <= index2 ). This may require testing each event in the TimeEvent.

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

Definition at line 383 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
virtual bool Tempus::TimeEventComposite< Scalar >::eventInRangeIndex ( int  index1,
int  index2,
std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &  timeEvents 
) const
inlinevirtual

Test if an event occurs within the index range plus the constraining TimeEvent(s).

Find if an event is within the input range, inclusively ( index1 <= event <= index2 ). This may require testing each event in the TimeEvent.

Additionally, the constraining TimeEvents are sorted by "index of next event", and returned, so additional details about the events can be queried.

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

Definition at line 406 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
virtual Scalar Tempus::TimeEventComposite< Scalar >::getAbsTol ( ) const
inlinevirtual

Return the largest absolute tolerance from all the TimeEvents.

Returns
The largest absolute tolerance of all the TimeEvents.

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 430 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
virtual Scalar Tempus::TimeEventComposite< Scalar >::getAbsTol ( std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &  timeEvents) const
inlinevirtual

Return the largest absolute tolerance from all the TimeEvents plus the constraining TimeEvent(s).

All the constraining TimeEvents have the same largest absolute tolerance (within numerical tolerance).

Parameters
timeEvents[out] Vector of constraining TimeEvent(s).
Returns
The largest absolute tolerance of all the TimeEvents.

Definition at line 445 of file Tempus_TimeEventComposite.hpp.

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

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

Will return true if any of the events requires to be landed on exactly.

Parameters
LOE[in] Flag indicating if TimeEvent should land on the event exactly.

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 468 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
virtual bool Tempus::TimeEventComposite< Scalar >::getLandOnExactly ( std::vector< Teuchos::RCP< TimeEventBase< Scalar > > > &  timeEvents) const
inlinevirtual

Return if the time events need to be landed on exactly plus the constraining TimeEvent(s).

Will return true if any of the events requires to be landed on exactly. All the constraining TimeEvents that require to be landed on exactly will be returned through the input vector of TimeEvents.

Parameters
timeEvents[out] Vector of constraining TimeEvent(s).
Returns
LOE Flag indicating if TimeEvent should land on the event exactly.

Definition at line 484 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
void Tempus::TimeEventComposite< Scalar >::add ( Teuchos::RCP< TimeEventBase< Scalar > >  timeEvent)
inline

Add TimeEvent to the TimeEvent vector.

Add the TimeEvent to the composite vector. If the TimeEvent is already in the composite (based on the TimeEvent's name), the input TimeEvent will replace the one in the composite.

Parameters
timeEvent[in] The input TimeEvent.

Definition at line 504 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
void Tempus::TimeEventComposite< Scalar >::remove ( std::string  name)
inline

Remove TimeEvent based on name.

If the TimeEvent is not in the composite based on the TimeEvent's name, nothing is done.

Parameters
name[in] The name of the TimeEvent to remove.

Definition at line 527 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
Teuchos::RCP<TimeEventBase<Scalar> > Tempus::TimeEventComposite< Scalar >::find ( std::string  name)
inline

Find TimeEvent based on name.

If the TimeEvent is not found, Teuchos::null is returned.

Parameters
name[in] The name of the TimeEvent to find.
Returns
RCP of TimeEvent with matching input name.

Definition at line 545 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
void Tempus::TimeEventComposite< Scalar >::clear ( )
inline

Clear the TimeEvent vector.

Definition at line 554 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
std::size_t Tempus::TimeEventComposite< Scalar >::getSize ( ) const
inline

Return the size of the TimeEvent vector.

Definition at line 557 of file Tempus_TimeEventComposite.hpp.

template<class Scalar >
std::string Tempus::TimeEventComposite< Scalar >::getTimeEventNames ( ) const
inline

Return a string of the names of Time Events (comma separated).

Definition at line 560 of file Tempus_TimeEventComposite.hpp.

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

Describe member data.

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 571 of file Tempus_TimeEventComposite.hpp.

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

Return a valid ParameterList with current settings.

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

Returns
Teuchos::ParameterList of TimeEventComposite.

Reimplemented from Tempus::TimeEventBase< Scalar >.

Definition at line 602 of file Tempus_TimeEventComposite.hpp.

Member Data Documentation

template<class Scalar >
std::vector<Teuchos::RCP<TimeEventBase<Scalar> > > Tempus::TimeEventComposite< Scalar >::timeEvents_
protected

Definition at line 618 of file Tempus_TimeEventComposite.hpp.


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