MOOCHO (Single Doxygen Collection)
Version of the Day
|
. One-based subregion index range class. More...
#include <RangePack_Range1D.hpp>
Public Types | |
enum | EInvalidRange { INVALID } |
typedef RTOpPack::Ordinal | Index |
Public Member Functions | |
Range1D () | |
Constructs a range representing the entire range. More... | |
Range1D (EInvalidRange) | |
Constructs an invalid (zero) range. More... | |
Range1D (Index lbound, Index ubound) | |
Constructs a range that represents the range [lbound, ubound] . More... | |
bool | full_range () const |
Returns true if the range represents the entire region (constructed from Range1D() ) More... | |
Index | lbound () const |
Return lower bound of the range. More... | |
Index | ubound () const |
Return upper bound of the range. More... | |
Index | size () const |
Return the size of the range (ubound() - lbound() + 1 ) More... | |
bool | in_range (Index i) const |
Return true if the index is in range. More... | |
Range1D & | operator+= (Index incr) |
Increment the range by a constant. More... | |
Range1D & | operator-= (Index incr) |
Deincrement the range by a constant. More... | |
Static Public Attributes | |
static const Range1D | Invalid |
Range1D(INVALID) More... | |
Private Member Functions | |
void | assert_valid_range (Index lbound, Index ubound) const |
Private Attributes | |
Index | lbound_ |
Index | ubound_ |
Related Functions | |
(Note that these are not member functions.) | |
bool | operator== (const Range1D &rng1, const Range1D &rng2) |
rng1 == rng2. More... | |
Range1D | operator+ (const Range1D &rng_rhs, Range1D::Index i) |
rng_lhs = rng_rhs + i. More... | |
Range1D | operator+ (Range1D::Index i, const Range1D &rng_rhs) |
rng_lhs = i + rng_rhs. More... | |
Range1D | operator- (const Range1D &rng_rhs, Range1D::Index i) |
rng_lhs = rng_rhs - i. More... | |
Range1D | full_range (const Range1D &rng, Range1D::Index lbound, Range1D::Index ubound) |
Return a bounded index range from a potentially unbounded index range. More... | |
Range1D | convert (const Teuchos::Range1D &rng) |
Convert from a 0-based Teuchos::Range1D object to a 1-based RangePack::Range1D object. More... | |
Teuchos::Range1D | convert (const Range1D &rng) |
Convert from a 1-based RangePack::Range1D object to a 0-based Teuchos::Range1D object. More... | |
. 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 76 of file RangePack_Range1D.hpp.
typedef RTOpPack::Ordinal RangePack::Range1D::Index |
Definition at line 79 of file RangePack_Range1D.hpp.
Enumerator | |
---|---|
INVALID |
Definition at line 81 of file RangePack_Range1D.hpp.
|
inline |
Constructs a range representing the entire range.
Postconditions:
this->full_range() == true
this->size() ==
a very large number this->lbound() == 1
this->ubound() ==
a very large number .
Definition at line 268 of file RangePack_Range1D.hpp.
|
inline |
Constructs an invalid (zero) range.
Postconditions:
this->full_range() == false
this->size() == 0
this->lbound() == 1
this->ubound() == 0
Definition at line 273 of file RangePack_Range1D.hpp.
Constructs a range that represents the range [lbound, ubound]
.
Preconditions:
lbound >= 1
(throw range_error
) lbound <= ubound
(throw range_error
) Postconditions:
this->full_range() == false
this->size() == ubound - lbound + 1
this->lbound() == lbound
this->ubound() == ubound
Definition at line 279 of file RangePack_Range1D.hpp.
|
inline |
Returns true
if the range represents the entire region (constructed from Range1D()
)
Definition at line 286 of file RangePack_Range1D.hpp.
|
inline |
Return lower bound of the range.
Definition at line 291 of file RangePack_Range1D.hpp.
|
inline |
Return upper bound of the range.
Definition at line 296 of file RangePack_Range1D.hpp.
|
inline |
Return the size of the range (ubound() - lbound() + 1
)
Definition at line 301 of file RangePack_Range1D.hpp.
|
inline |
Return true if the index is in range.
Definition at line 306 of file RangePack_Range1D.hpp.
Increment the range by a constant.
Definition at line 311 of file RangePack_Range1D.hpp.
Deincrement the range by a constant.
Definition at line 319 of file RangePack_Range1D.hpp.
Definition at line 328 of file RangePack_Range1D.hpp.
rng1 == rng2.
rng1.lbound() == rng2.ubound() && rng1.ubound() == rng2.ubound()
. Definition at line 150 of file RangePack_Range1D.hpp.
|
related |
rng_lhs = rng_rhs + i.
Increments the upper and lower bounds by a constant.
Postcondition:
rng_lhs.lbound() == rng_rhs.lbound() + i
rng_lhs.ubound() == rng_rhs.ubound() + i
Definition at line 166 of file RangePack_Range1D.hpp.
|
related |
rng_lhs = i + rng_rhs.
Increments the upper and lower bounds by a constant.
Postcondition:
rng_lhs.lbound() == i + rng_rhs.lbound()
rng_lhs.ubound() == i + rng_rhs.ubound()
Definition at line 182 of file RangePack_Range1D.hpp.
|
related |
rng_lhs = rng_rhs - i.
Deincrements the upper and lower bounds by a constant.
Postcondition:
rng_lhs.lbound() == rng_rhs.lbound() - 1
rng_lhs.ubound() == rng_rhs.ubound() - 1
Definition at line 198 of file RangePack_Range1D.hpp.
|
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:
rng.full_range() == true
] return.lbound() == lbound
rng.full_range() == true
] return.ubound() == ubound
rng.full_range() == false
] return.lbound() == rng.lbound()
rng.full_range() == false
] return.ubound() == rng.ubound()
Definition at line 217 of file RangePack_Range1D.hpp.
|
related |
Convert from a 0-based Teuchos::Range1D object to a 1-based RangePack::Range1D object.
Definition at line 224 of file RangePack_Range1D.hpp.
|
related |
Convert from a 1-based RangePack::Range1D object to a 0-based Teuchos::Range1D object.
Definition at line 246 of file RangePack_Range1D.hpp.
|
static |
Range1D(INVALID)
Definition at line 83 of file RangePack_Range1D.hpp.
|
private |
Definition at line 136 of file RangePack_Range1D.hpp.
|
private |
Definition at line 137 of file RangePack_Range1D.hpp.