45 #include "RTOpPack_Types.hpp"
79 typedef RTOpPack::Ordinal
Index;
230 else if (rng.
size() == -1) {
233 else if (rng.
size() == 0) {
252 else if (rng.
size() == 0) {
269 : lbound_(1), ubound_(std::numeric_limits<
Index>::max()-1)
274 : lbound_(1), ubound_(0)
280 : lbound_(lbound), ubound_(ubound)
282 assert_valid_range(lbound,ubound);
287 return ubound_ == (std::numeric_limits<Index>::max()-1);
302 return 1 + ubound_ - lbound_;
307 return lbound_ <= i && i <= ubound_;
312 assert_valid_range( lbound_ + incr, ubound_ + incr );
320 assert_valid_range( lbound_ - incr, ubound_ - incr );
328 void Range1D::assert_valid_range(Index lbound, Index ubound)
const {
331 lbound < 1, std::range_error
332 ,
"Range1D::assert_valid_range(): Error, lbound ="<<lbound<<
" must be greater than 0." );
334 lbound > ubound, std::range_error
335 ,
"Range1D::assert_valid_range(): Error, lbound = "<<lbound<<
" > ubound = "<<ubound );
341 #endif // end RANGE1D_H
bool operator==(const Range1D &rng1, const Range1D &rng2)
rng1 == rng2.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Index size() const
Return the size of the range (ubound() - lbound() + 1)
Index ubound() const
Return upper bound of the range.
Range1D & operator+=(Index incr)
Increment the range by a constant.
Range1D operator-(const Range1D &rng_rhs, Range1D::Index i)
rng_lhs = rng_rhs - i.
. One-based subregion index range class.
Range1D()
Constructs a range representing the entire range.
Teuchos::Range1D convert(const Range1D &rng)
Convert from a 1-based RangePack::Range1D object to a 0-based Teuchos::Range1D object.
Range1D operator+(Range1D::Index i, const Range1D &rng_rhs)
rng_lhs = i + rng_rhs.
bool full_range() const
Returns true if the range represents the entire region (constructed from Range1D()) ...
Range1D full_range(const Range1D &rng, Range1D::Index lbound, Range1D::Index ubound)
Return a bounded index range from a potentially unbounded index range.
bool in_range(Index i) const
Return true if the index is in range.
static const Range1D Invalid
static const Range1D Invalid
Range1D(INVALID)
Index lbound() const
Return lower bound of the range.
Range1D convert(const Teuchos::Range1D &rng)
Convert from a 0-based Teuchos::Range1D object to a 1-based RangePack::Range1D object.
Range1D operator+(const Range1D &rng_rhs, Range1D::Index i)
rng_lhs = rng_rhs + i.
Range1D & operator-=(Index incr)
Deincrement the range by a constant.