#include <Teuchos_Range1D.hpp>
Public Types | |
| typedef Teuchos_Index | Index |
| | |
| enum | EInvalidRange |
| More... | |
Public Member Functions | |
| Range1D () | |
| Constructs a range representing the entire range. | |
| Range1D (EInvalidRange) | |
| Range1D (Index lbound, Index ubound) | |
Constructs a range that represents the range [lbound, ubound]. | |
| bool | full_range () const |
| 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. | |
| Range1D & | operator+= (Index incr) |
| Increment the range by a constant. | |
| Range1D & | operator-= (Index incr) |
| Deincrement the range by a constant. | |
Static Public Attributes | |
| const Range1D | Invalid |
| Used for 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. | |
The class Range1D abstracts a 1-D, zero-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 [0, max_ubound-1] (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 [0,-1] 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 zero-based 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 74 of file Teuchos_Range1D.hpp.
|
|
Definition at line 78 of file Teuchos_Range1D.hpp. |
|
|
Definition at line 81 of file Teuchos_Range1D.hpp. |
|
|
Constructs a range representing the entire range. Postconditions:
Definition at line 238 of file Teuchos_Range1D.hpp. |
|
|
Constructs an invalid (zero) range. Postconditions:
Definition at line 243 of file Teuchos_Range1D.hpp. |
|
||||||||||||
|
Constructs a range that represents the range Preconditions:
Postconditions:
Definition at line 249 of file Teuchos_Range1D.hpp. |
|
|
Returns Definition at line 256 of file Teuchos_Range1D.hpp. |
|
|
Return lower bound of the range.
Definition at line 261 of file Teuchos_Range1D.hpp. |
|
|
Return upper bound of the range.
Definition at line 266 of file Teuchos_Range1D.hpp. |
|
|
Return the size of the range (
Definition at line 271 of file Teuchos_Range1D.hpp. |
|
|
Return true if the index is in range.
Definition at line 276 of file Teuchos_Range1D.hpp. |
|
|
Increment the range by a constant.
Definition at line 281 of file Teuchos_Range1D.hpp. |
|
|
Deincrement the range by a constant.
Definition at line 289 of file Teuchos_Range1D.hpp. |
|
||||||||||||
|
rng1 == rng2.
Definition at line 163 of file Teuchos_Range1D.hpp. |
|
||||||||||||
|
rng_lhs = rng_rhs + i. Increments the upper and lower bounds by a constant. Postcondition:
Definition at line 179 of file Teuchos_Range1D.hpp. |
|
||||||||||||
|
rng_lhs = i + rng_rhs. Increments the upper and lower bounds by a constant. Postcondition:
Definition at line 195 of file Teuchos_Range1D.hpp. |
|
||||||||||||
|
rng_lhs = rng_rhs - i. Deincrements the upper and lower bounds by a constant. Postcondition:
Definition at line 211 of file Teuchos_Range1D.hpp. |
|
||||||||||||||||
|
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 231 of file Teuchos_Range1D.hpp. |
|
|
Used for Range1D(INVALID).
|
1.3.9.1