Rythmos - Transient Integration for Differential Equations  Version of the Day
 All Classes Functions Variables Typedefs Pages
Public Member Functions | Related Functions | List of all members
Rythmos::TimeRange< Scalar > Class Template Reference

Represent a time range. More...

#include <Rythmos_TimeRange_decl.hpp>

Inheritance diagram for Rythmos::TimeRange< Scalar >:
Inheritance graph
[legend]

Public Member Functions

 TimeRange ()
 Construct an invalid range. More...
 
 TimeRange (const TimeType &my_lower, const TimeType &my_upper)
 Construct a valid range. More...
 
 TimeRange (const TimeRange< TimeType > &tr)
 Copy constructor. More...
 
virtual ~TimeRange ()
 
bool isValid () const
 
TimeType lower () const
 
TimeType upper () const
 
TimeType length () const
 
virtual bool isInRange (const TimeType &t) const
 
TimeRange< TimeType > copyAndScale (const TimeType &scale) const
 

Related Functions

(Note that these are not member functions.)

template<class TimeType >
int compareTimeValues (const TimeType &t1, const TimeType &t2)
 Compare two times taking into account floating point errors. More...
 
template<class TimeType >
TimeRange< TimeType > timeRange (const TimeType my_lower, const TimeType my_upper)
 Nonmember constructor. More...
 
template<class TimeType >
TimeRange< TimeType > invalidTimeRange ()
 Nonmember constructor. More...
 
template<class TimeType >
std::ostream & operator<< (std::ostream &out, const TimeRange< TimeType > &range)
 Output operator. More...
 
template<class TimeType >
bool isInRange_cc (const TimeRange< TimeType > &tr, const TimeType &p)
 Nonmember isInRange function [closed, closed]. More...
 
template<class TimeType >
bool isInRange_oc (const TimeRange< TimeType > &tr, const TimeType &p)
 Nonmember isInRange function (open, closed]. More...
 
template<class TimeType >
bool isInRange_co (const TimeRange< TimeType > &tr, const TimeType &p)
 Nonmember isInRange function [closed, open). More...
 
template<class TimeType >
bool isInRange_oo (const TimeRange< TimeType > &tr, const TimeType &p)
 Nonmember isInRange function (open, open). More...
 

Detailed Description

template<class Scalar>
class Rythmos::TimeRange< Scalar >

Represent a time range.

The compiler-generated default constructor, copy constructor, and assignment operators are allowed and perform correctly.

ToDo: Put in checks for the range if needed.

Definition at line 15 of file Rythmos_IntegrationControlStrategyBase.hpp.

Constructor & Destructor Documentation

template<class Scalar>
Rythmos::TimeRange< Scalar >::TimeRange ( )
inline

Construct an invalid range.

Definition at line 76 of file Rythmos_TimeRange_decl.hpp.

template<class Scalar>
Rythmos::TimeRange< Scalar >::TimeRange ( const TimeType &  my_lower,
const TimeType &  my_upper 
)
inline

Construct a valid range.

Definition at line 80 of file Rythmos_TimeRange_decl.hpp.

template<class Scalar>
Rythmos::TimeRange< Scalar >::TimeRange ( const TimeRange< TimeType > &  tr)
inline

Copy constructor.

Definition at line 85 of file Rythmos_TimeRange_decl.hpp.

template<class Scalar>
virtual Rythmos::TimeRange< Scalar >::~TimeRange ( )
inlinevirtual

Definition at line 90 of file Rythmos_TimeRange_decl.hpp.

Member Function Documentation

template<class Scalar>
bool Rythmos::TimeRange< Scalar >::isValid ( ) const
inline

Definition at line 92 of file Rythmos_TimeRange_decl.hpp.

template<class Scalar>
TimeType Rythmos::TimeRange< Scalar >::lower ( ) const
inline

Definition at line 94 of file Rythmos_TimeRange_decl.hpp.

template<class Scalar>
TimeType Rythmos::TimeRange< Scalar >::upper ( ) const
inline

Definition at line 96 of file Rythmos_TimeRange_decl.hpp.

template<class Scalar>
TimeType Rythmos::TimeRange< Scalar >::length ( ) const
inline

Definition at line 98 of file Rythmos_TimeRange_decl.hpp.

template<class Scalar>
virtual bool Rythmos::TimeRange< Scalar >::isInRange ( const TimeType &  t) const
inlinevirtual

Definition at line 100 of file Rythmos_TimeRange_decl.hpp.

template<class Scalar>
TimeRange<TimeType> Rythmos::TimeRange< Scalar >::copyAndScale ( const TimeType &  scale) const
inline

Definition at line 108 of file Rythmos_TimeRange_decl.hpp.

Friends And Related Function Documentation

template<class TimeType >
int compareTimeValues ( const TimeType &  t1,
const TimeType &  t2 
)
related

Compare two times taking into account floating point errors.

Returns
Return -1 if t1 < t2 , 0 if t1 == t2 and +1 if t1 > t2 .

Note that this function compares t1 to t2 and not the other way around.

This function is designed to solve the problem where in:

const TimeType timeStep = endTime - time;
const TimeType updatedEndTime = time + timeStep;
const bool isAtOrPastEndTime = ( updatedEndTime >= endTime );

the bool isAtOrPastEndTime may actually be false! This is especially a danger if IEEE floating point numerics are not being used (and there are many systems that do not for speed and other reasons).

template<class TimeType >
TimeRange< TimeType > timeRange ( const TimeType  my_lower,
const TimeType  my_upper 
)
related

Nonmember constructor.

template<class TimeType >
TimeRange< TimeType > invalidTimeRange ( )
related

Nonmember constructor.

template<class TimeType >
std::ostream & operator<< ( std::ostream &  out,
const TimeRange< TimeType > &  range 
)
related

Output operator.

template<class TimeType >
bool isInRange_cc ( const TimeRange< TimeType > &  tr,
const TimeType &  p 
)
related

Nonmember isInRange function [closed, closed].

tr.lower() <= p <= tr.upper()

template<class TimeType >
bool isInRange_oc ( const TimeRange< TimeType > &  tr,
const TimeType &  p 
)
related

Nonmember isInRange function (open, closed].

tr.lower() < p <= tr.upper()

template<class TimeType >
bool isInRange_co ( const TimeRange< TimeType > &  tr,
const TimeType &  p 
)
related

Nonmember isInRange function [closed, open).

tr.lower() <= p < tr.upper()

template<class TimeType >
bool isInRange_oo ( const TimeRange< TimeType > &  tr,
const TimeType &  p 
)
related

Nonmember isInRange function (open, open).

tr.lower() < p < tr.upper()


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