Tempus
Version of the Day
Time Integration
|
TimeEventRange specifies a start, stop and stride time. More...
#include <Tempus_TimeEventRange_decl.hpp>
Public Member Functions | |
TimeEventRange () | |
Default constructor. More... | |
TimeEventRange (Scalar start, Scalar stop, Scalar stride, std::string name="", bool landOnExactly=true, Scalar relTol=std::numeric_limits< Scalar >::epsilon()*Scalar(100.0)) | |
Construct from start, stop and stride. More... | |
TimeEventRange (Scalar start, Scalar stop, int numEvents, std::string name="", bool landOnExactly=true, Scalar relTol=std::numeric_limits< Scalar >::epsilon()*Scalar(100.0)) | |
Construct from start, stop and number of events. More... | |
virtual | ~TimeEventRange () |
Destructor. More... | |
virtual void | describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const |
Describe member data. 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 | |
Scalar | start_ |
Start of time range. More... | |
Scalar | stop_ |
Stop of time range. More... | |
Scalar | stride_ |
Stride of time range. More... | |
unsigned | numEvents_ |
Number of events in time range. More... | |
Scalar | timeScale_ |
A reference time scale, max(abs(start_,stop_)). 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... | |
Accessor methods | |
virtual void | setTimeRange (Scalar start, Scalar stop, Scalar stride) |
Set the range of time events from start, stop and stride. More... | |
virtual void | setTimeRange (Scalar start, Scalar stop, int numEvents) |
Set the range of time events from start, stop and number of events. More... | |
virtual Scalar | getTimeStart () const |
Return the start of the time range. More... | |
virtual void | setTimeStart (Scalar start) |
Set the start of the time range. More... | |
virtual Scalar | getTimeStop () const |
Return the stop of the time range. More... | |
virtual void | setTimeStop (Scalar stop) |
Set the stop of the time range. More... | |
virtual Scalar | getTimeStride () const |
Return the stride of the time range. More... | |
virtual void | setTimeStride (Scalar stride) |
Set the stride of the time range. More... | |
virtual int | getNumEvents () const |
Return the number of time events in the time range. More... | |
virtual void | setNumEvents (int numEvents) |
Set the number of time 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 |
Set 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... | |
TimeEventRange specifies a start, stop and stride time.
Definition at line 28 of file Tempus_TimeEventRange_decl.hpp.
Tempus::TimeEventRange< Scalar >::TimeEventRange | ( | ) |
Default constructor.
Definition at line 18 of file Tempus_TimeEventRange_impl.hpp.
Tempus::TimeEventRange< Scalar >::TimeEventRange | ( | Scalar | start, |
Scalar | stop, | ||
Scalar | stride, | ||
std::string | name = "" , |
||
bool | landOnExactly = true , |
||
Scalar | relTol = std::numeric_limits<Scalar>::epsilon() * Scalar(100.0) |
||
) |
Construct from start, stop and stride.
Definition at line 38 of file Tempus_TimeEventRange_impl.hpp.
Tempus::TimeEventRange< Scalar >::TimeEventRange | ( | Scalar | start, |
Scalar | stop, | ||
int | numEvents, | ||
std::string | name = "" , |
||
bool | landOnExactly = true , |
||
Scalar | relTol = std::numeric_limits<Scalar>::epsilon() * Scalar(100.0) |
||
) |
Construct from start, stop and number of events.
Definition at line 65 of file Tempus_TimeEventRange_impl.hpp.
|
inlinevirtual |
Destructor.
Definition at line 46 of file Tempus_TimeEventRange_decl.hpp.
|
virtual |
Test if time is near an event (within tolerance).
Test if any of the events in the range 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 202 of file Tempus_TimeEventRange_impl.hpp.
|
virtual |
How much time until the next event.
Determine the amount of time until the next timeEvent in the range (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.
[in] | time | The input time to measure to the next TimeEvent. |
Reimplemented from Tempus::TimeEventBase< Scalar >.
Definition at line 228 of file Tempus_TimeEventRange_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 234 of file Tempus_TimeEventRange_impl.hpp.
|
virtual |
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.
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 255 of file Tempus_TimeEventRange_impl.hpp.
|
virtual |
Set the range of time events from start, stop and stride.
This will completely replace the time range.
start | [in] The start of the time range. |
stop | [in] The stop of the time range. |
stride | [in] The stride of the time range. |
Definition at line 92 of file Tempus_TimeEventRange_impl.hpp.
|
virtual |
Set the range of time events from start, stop and number of events.
This will completely replace the time range
start | [in] The start of the time range. |
stop | [in] The stop of the time range. |
numEvents | [in] The number of events in time range. |
Definition at line 107 of file Tempus_TimeEventRange_impl.hpp.
|
inlinevirtual |
Return the start of the time range.
Definition at line 125 of file Tempus_TimeEventRange_decl.hpp.
|
virtual |
Set the start of the time range.
Definition at line 122 of file Tempus_TimeEventRange_impl.hpp.
|
inlinevirtual |
Return the stop of the time range.
Definition at line 130 of file Tempus_TimeEventRange_decl.hpp.
|
virtual |
Set the stop of the time range.
Definition at line 131 of file Tempus_TimeEventRange_impl.hpp.
|
inlinevirtual |
Return the stride of the time range.
Definition at line 135 of file Tempus_TimeEventRange_decl.hpp.
|
virtual |
Set the stride of the time range.
If start_ = stop_, then stride_ = 0.0, set numEvents_ = 1, and return. If stride_ > stop_-start_ or stride_ < 2*absTol_, then stride = stop_-start_.
Reset numEvents_ = (stop_-start_)/stride_ + 1.
stride | [in] The time stride for the time range. |
Definition at line 153 of file Tempus_TimeEventRange_impl.hpp.
|
inlinevirtual |
Return the number of time events in the time range.
Definition at line 150 of file Tempus_TimeEventRange_decl.hpp.
|
virtual |
Set the number of time events.
If the resulting stride is less than twice the absolute tolerance, the stride is set to 2*absTol_.
numEvents | [in] The number of events in time range. |
Definition at line 170 of file Tempus_TimeEventRange_impl.hpp.
|
inlinevirtual |
Return the relative tolerance.
Definition at line 167 of file Tempus_TimeEventRange_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 195 of file Tempus_TimeEventRange_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_).
Reimplemented from Tempus::TimeEventBase< Scalar >.
Definition at line 188 of file Tempus_TimeEventRange_decl.hpp.
|
inlinevirtual |
Set 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 202 of file Tempus_TimeEventRange_decl.hpp.
|
inlinevirtual |
Set if the time event should be landed on exactly.
Definition at line 205 of file Tempus_TimeEventRange_decl.hpp.
|
virtual |
Describe member data.
Reimplemented from Tempus::TimeEventBase< Scalar >.
Definition at line 288 of file Tempus_TimeEventRange_impl.hpp.
|
virtual |
Return a valid ParameterList with current settings.
The returned ParameterList will contain the current parameters and can be used to reconstruct the TimeEventRange using createTimeEventRange(...). The ParameterList will have the TimeEventRange parameters along with all the parameters for the TimeEvents contained in the composite.
Reimplemented from Tempus::TimeEventBase< Scalar >.
Definition at line 311 of file Tempus_TimeEventRange_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 the range (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 140 of file Tempus_TimeEventRange_impl.hpp.
|
protected |
Start of time range.
Definition at line 236 of file Tempus_TimeEventRange_decl.hpp.
|
protected |
Stop of time range.
Definition at line 237 of file Tempus_TimeEventRange_decl.hpp.
|
protected |
Stride of time range.
Definition at line 238 of file Tempus_TimeEventRange_decl.hpp.
|
protected |
Number of events in time range.
Definition at line 239 of file Tempus_TimeEventRange_decl.hpp.
|
protected |
A reference time scale, max(abs(start_,stop_)).
Definition at line 241 of file Tempus_TimeEventRange_decl.hpp.
|
protected |
Relative time tolerance for matching time events.
Definition at line 242 of file Tempus_TimeEventRange_decl.hpp.
|
protected |
Absolute time tolerance, relTol_*timeScale_.
Definition at line 243 of file Tempus_TimeEventRange_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 244 of file Tempus_TimeEventRange_decl.hpp.