Tempus
Version of the Day
Time Integration
|
TimeEventList specifies a list of time events. More...
#include <Tempus_TimeEventList_decl.hpp>
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... | |
TimeEventList specifies a list of time events.
Definition at line 28 of file Tempus_TimeEventList_decl.hpp.
Tempus::TimeEventList< Scalar >::TimeEventList | ( | ) |
Default constructor.
Definition at line 18 of file Tempus_TimeEventList_impl.hpp.
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.
|
inlinevirtual |
Destructor.
Definition at line 40 of file Tempus_TimeEventList_decl.hpp.
|
virtual |
Test if time is near an event (within tolerance).
Test if any of the events in the list is near the input time.
[in] | time | The input time to check if it is near an event. |
Reimplemented from Tempus::TimeEventBase< Scalar >.
Definition at line 121 of file Tempus_TimeEventList_impl.hpp.
|
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.
time | [in] The input time. |
Reimplemented from Tempus::TimeEventBase< Scalar >.
Definition at line 130 of file Tempus_TimeEventList_impl.hpp.
|
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.
time | [in] Input time. |
Reimplemented from Tempus::TimeEventBase< Scalar >.
Definition at line 136 of file Tempus_TimeEventList_impl.hpp.
|
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.
time1 | [in] Input time of one end of the range. |
time2 | [in] Input time of the other end of the range. |
Reimplemented from Tempus::TimeEventBase< Scalar >.
Definition at line 158 of file Tempus_TimeEventList_impl.hpp.
|
virtual |
Describe member data.
Reimplemented from Tempus::TimeEventBase< Scalar >.
Definition at line 175 of file Tempus_TimeEventList_impl.hpp.
|
inlinevirtual |
Return the list of time events.
Definition at line 103 of file Tempus_TimeEventList_decl.hpp.
|
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).
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.
|
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.
time | [in] Time to insert to vector of events. |
Definition at line 80 of file Tempus_TimeEventList_impl.hpp.
|
inlinevirtual |
Clear the vector of all events.
Definition at line 128 of file Tempus_TimeEventList_decl.hpp.
|
inlinevirtual |
Return the relative tolerance.
Definition at line 131 of file Tempus_TimeEventList_decl.hpp.
|
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().
relTol | [in] The input relative tolerance. |
Definition at line 114 of file Tempus_TimeEventList_impl.hpp.
|
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,
Reimplemented from Tempus::TimeEventBase< Scalar >.
Definition at line 154 of file Tempus_TimeEventList_decl.hpp.
|
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.
Reimplemented from Tempus::TimeEventBase< Scalar >.
Definition at line 168 of file Tempus_TimeEventList_decl.hpp.
|
inlinevirtual |
Set if the time event should be landed on exactly.
Definition at line 171 of file Tempus_TimeEventList_decl.hpp.
|
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.
Reimplemented from Tempus::TimeEventBase< Scalar >.
Definition at line 203 of file Tempus_TimeEventList_impl.hpp.
|
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.
|
protected |
Sorted and unique list of time events.
Definition at line 197 of file Tempus_TimeEventList_decl.hpp.
|
protected |
A reference time scale.
Definition at line 199 of file Tempus_TimeEventList_decl.hpp.
|
protected |
Relative time tolerance for matching time events.
Definition at line 200 of file Tempus_TimeEventList_decl.hpp.
|
protected |
Absolute time tolerance, relTol_*timeScale_.
Definition at line 201 of file Tempus_TimeEventList_decl.hpp.
|
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.