RangePack::Range1D Class Reference

. One-based subregion index range class. More...

#include <RangePack_Range1D.hpp>

List of all members.

Public Types

typedef RTOpPack::Index Index
 
enum  EInvalidRange
  More...

Public Member Functions

 Range1D ()
 Constructs a range representing the entire range..
 Range1D (EInvalidRange)
 Constructs an invalid (zero) range.
 Range1D (Index lbound, Index ubound)
 Constructs a range that represents the range [lbound, ubound].
bool full_range () const
 Returns true if the range represents the entire region (constructed from Range1D()).
Index lbound () const
 Return lower bound of the range.
Index ubound () const
 Return upper bound of the range.
Index size () const
 Return the size of the range (ubound() - lbound() + 1).
bool in_range (Index i) const
 Return true if the index is in range.
Range1Doperator+= (Index incr)
 Increment the range by a constant.
Range1Doperator-= (Index incr)
 Deincrement the range by a constant.

Static Public Attributes

static const Range1D Invalid
 Range1D(INVALID).

Related Functions

(Note that these are not member functions.)

bool operator== (const Range1D &rng1, const Range1D &rng2)
 rng1 == rng2.
Range1D operator+ (const Range1D &rng_rhs, Range1D::Index i)
 rng_lhs = rng_rhs + i.
Range1D operator+ (Range1D::Index i, const Range1D &rng_rhs)
 rng_lhs = i + rng_rhs.
Range1D operator- (const Range1D &rng_rhs, Range1D::Index i)
 rng_lhs = rng_rhs - i.
Range1D full_range (const Range1D &rng, Range1D::Index lbound, Range1D::Index ubound)
 Return a bounded index range from a potentially unbounded index range.
Range1D convert (const Teuchos::Range1D &rng)
 Convert from a 0-based Teuchos::Range1D object to a 1-based RangePack::Range1D object.
Teuchos::Range1D convert (const Range1D &rng)
 Convert from a 1-based RangePack::Range1D object to a 0-based Teuchos::Range1D object.


Detailed Description

. One-based subregion index range class.

The class Range1D abstracts a 1-D, 1-based, range of indexes. It is used to index into vectors and matrices and return subregions of them respectively.

Constructing using Range1D() yields a range that represents the entire dimension of an object [1, max_ubound] (an entire vector, all the rows in a matrix, or all the columns in a matrix etc.).

Constructing using Range1D(INVALID) yields an invalid range [1,0] with size() == 0. In fact the condition size() == 0 is the determining flag that a range is not valid. Once constructed with Range1D(INVALID), a Range1D object can pass through many other operations that may change lbound() and ubound() but will never change size() == 0.

Constructing using Range1D(lbound,ubound) yields a finite dimensional range. The validity of constructed range will only be checked if TEUCHOS_DEBUG is defined.

There are many non-member functions that can be used with Range1D objects.

The default copy constructor and assignment operator functions are allowed since they have the correct semantics.

Definition at line 63 of file RangePack_Range1D.hpp.


Member Typedef Documentation

typedef RTOpPack::Index RangePack::Range1D::Index

Definition at line 66 of file RangePack_Range1D.hpp.


Member Enumeration Documentation

enum RangePack::Range1D::EInvalidRange

Definition at line 68 of file RangePack_Range1D.hpp.


Constructor & Destructor Documentation

RangePack::Range1D::Range1D (  )  [inline]

Constructs a range representing the entire range..

Definition at line 230 of file RangePack_Range1D.hpp.

RangePack::Range1D::Range1D ( EInvalidRange   )  [inline]

Constructs an invalid (zero) range.

Postconditions:

Definition at line 235 of file RangePack_Range1D.hpp.

RangePack::Range1D::Range1D ( Index  lbound,
Index  ubound 
) [inline]

Constructs a range that represents the range [lbound, ubound].

Preconditions:

Postconditions:

Definition at line 241 of file RangePack_Range1D.hpp.


Member Function Documentation

bool RangePack::Range1D::full_range (  )  const [inline]

Returns true if the range represents the entire region (constructed from Range1D()).

Definition at line 248 of file RangePack_Range1D.hpp.

Range1D::Index RangePack::Range1D::lbound (  )  const [inline]

Return lower bound of the range.

Definition at line 253 of file RangePack_Range1D.hpp.

Range1D::Index RangePack::Range1D::ubound (  )  const [inline]

Return upper bound of the range.

Definition at line 258 of file RangePack_Range1D.hpp.

Range1D::Index RangePack::Range1D::size (  )  const [inline]

Return the size of the range (ubound() - lbound() + 1).

Definition at line 263 of file RangePack_Range1D.hpp.

bool RangePack::Range1D::in_range ( Index  i  )  const [inline]

Return true if the index is in range.

Definition at line 268 of file RangePack_Range1D.hpp.

Range1D & RangePack::Range1D::operator+= ( Index  incr  )  [inline]

Increment the range by a constant.

Definition at line 273 of file RangePack_Range1D.hpp.

Range1D & RangePack::Range1D::operator-= ( Index  incr  )  [inline]

Deincrement the range by a constant.

Definition at line 281 of file RangePack_Range1D.hpp.


Friends And Related Function Documentation

bool operator== ( const Range1D rng1,
const Range1D rng2 
) [related]

rng1 == rng2.

Returns:
Returns rng1.lbound() == rng2.ubound() && rng1.ubound() == rng2.ubound().

Definition at line 138 of file RangePack_Range1D.hpp.

Range1D operator+ ( const Range1D rng_rhs,
Range1D::Index  i 
) [related]

rng_lhs = rng_rhs + i.

Increments the upper and lower bounds by a constant.

Postcondition:

Definition at line 154 of file RangePack_Range1D.hpp.

Range1D operator+ ( Range1D::Index  i,
const Range1D rng_rhs 
) [related]

rng_lhs = i + rng_rhs.

Increments the upper and lower bounds by a constant.

Postcondition:

Definition at line 170 of file RangePack_Range1D.hpp.

Range1D operator- ( const Range1D rng_rhs,
Range1D::Index  i 
) [related]

rng_lhs = rng_rhs - i.

Deincrements the upper and lower bounds by a constant.

Postcondition:

Definition at line 186 of file RangePack_Range1D.hpp.

Range1D full_range ( const Range1D rng,
Range1D::Index  lbound,
Range1D::Index  ubound 
) [related]

Return a bounded index range from a potentially unbounded index range.

Return a index range of lbound to ubound if rng.full_range() == true , otherwise just return a copy of rng.

Postconditions:

Definition at line 205 of file RangePack_Range1D.hpp.

Range1D convert ( const Teuchos::Range1D rng  )  [related]

Convert from a 0-based Teuchos::Range1D object to a 1-based RangePack::Range1D object.

Definition at line 212 of file RangePack_Range1D.hpp.

Teuchos::Range1D convert ( const Range1D rng  )  [related]

Convert from a 1-based RangePack::Range1D object to a 0-based Teuchos::Range1D object.

Definition at line 219 of file RangePack_Range1D.hpp.


Member Data Documentation

const Range1D RangePack::Range1D::Invalid [static]

Range1D(INVALID).

Definition at line 70 of file RangePack_Range1D.hpp.


The documentation for this class was generated from the following files:
Generated on Tue Jul 13 09:28:35 2010 for MoochoPack: Miscellaneous Utilities for MOOCHO by  doxygen 1.4.7