A range or interval of labels defined by a start and a size. More...


Public Member Functions | |
| constexpr | labelRange () noexcept |
| Default construct an empty range (0,0) More... | |
| constexpr | labelRange (const label len) noexcept |
| Construct a range with specified length, starting at zero (0,len) More... | |
| labelRange (const label beg, const label len) noexcept | |
| Construct a range from start/length, no checks. More... | |
| labelRange (const label beg, const label len, const bool adjustStart) noexcept | |
| Construct a range from start/size, enforces non-negative size. More... | |
| labelRange (const MinMax< label > &range) noexcept | |
| Construct from a min/max range, enforces non-negative size. Does not adjust the start. More... | |
| labelRange (Istream &is) | |
| Construct from Istream. More... | |
| label | before () const noexcept |
| The value before the start of the range. More... | |
| label | after () const noexcept |
| The value after the last element in the range. More... | |
| void | adjust () noexcept |
| Adjust the start to avoid negative indices. More... | |
| void | reset (const label beg, const label end, const bool adjustStart) noexcept |
| Reset start and length, enforces non-negative size. More... | |
| List< label > | labels () const |
| Return list of labels corresponding to the range. More... | |
| bool | overlaps (const labelRange &range, bool touches=false) const |
| Return true if the ranges overlap. More... | |
| labelRange | join (const labelRange &range) const |
| Return a joined range, squashing any gaps in between. More... | |
| labelRange | subset (const labelRange &range) const |
| Calculate the intersection of the range with another. More... | |
| labelRange | subset (const label start, const label size) const |
| Calculate the intersection with the given start/size range. More... | |
| labelRange | subset0 (const label size) const |
| Calculate the intersection with the given 0/size range. More... | |
| bool | valid () const noexcept |
| Deprecated(2020-09) True if range is non-empty. More... | |
Public Member Functions inherited from IntRange< label > | |
| constexpr | IntRange () noexcept |
| Default construct an empty range (0,0) More... | |
| constexpr | IntRange (const label len) noexcept |
| Construct a range with specified length, starting at zero (0,len) More... | |
| constexpr | IntRange (const label beg, const label len) noexcept |
| Construct a range from start/length, no checks. More... | |
| bool | empty () const noexcept |
| True if range is empty (zero-sized) More... | |
| label | size () const noexcept |
| The size of the range. More... | |
| label & | size () noexcept |
| Non-const access to size of the range. More... | |
| label | start () const noexcept |
| The (inclusive) lower value of the range. More... | |
| label & | start () noexcept |
| Non-const access to start of the range. More... | |
| label | first () const noexcept |
| The (inclusive) lower value of the range. Same as start() More... | |
| label | last () const noexcept |
| The (inclusive) upper value of the range. More... | |
| label | min () const noexcept |
| The (inclusive) lower value of the range, same as first(), start(), begin_value() More... | |
| label | max () const noexcept |
| The (inclusive) upper value of the range, same as last(), rbegin_value() More... | |
| void | clear () noexcept |
| Reset to zero start and zero size. More... | |
| void | reset (const label beg, const label len) noexcept |
| Reset start and length, no checks. More... | |
| void | setStart (const label i) noexcept |
| Set the start position, no checks. More... | |
| void | setSize (const label n) noexcept |
| Change the size, no checks. Identical to resize() More... | |
| void | resize (const label n) noexcept |
| Change the size, no checks. Identical to setSize() More... | |
| void | clampSize () noexcept |
| Enforce non-negative size. More... | |
| bool | contains (const label value) const noexcept |
| True if the (global) value is within the range. More... | |
| bool | found (const label val) const noexcept |
| True if the (global) value is within the range. More... | |
| const_iterator | at (const label i) const |
| Return const_iterator to a position within the range, with bounds checking. More... | |
| constexpr label | operator[] (const label i) const noexcept |
| Offset dereference, without bounds checking. More... | |
| bool | operator() (const label i) const noexcept |
| True if the global value is located within the range. More... | |
| label | operator++ () noexcept |
| Increase the size by 1. More... | |
| label | operator++ (int) noexcept |
| label | operator+= (const label n) noexcept |
| Increase the size by n. More... | |
| label | operator-- () noexcept |
| Decrease the size by 1, but never below 0. More... | |
| label | operator-- (int) noexcept |
| label | operator-= (const label n) noexcept |
| Decrease the size by n, but never below 0. More... | |
| operator bool () const noexcept | |
| True if range is non-empty. More... | |
| label | begin_value () const noexcept |
| The value at the beginning of the range - same as first(), start() More... | |
| label | end_value () const noexcept |
| The value 1 beyond the end of the range. More... | |
| label | rbegin_value () const noexcept |
| The last value of the range. More... | |
| label | rend_value () const noexcept |
| The value 1 before the begin of range. More... | |
| const_iterator | begin () const noexcept |
| A const_iterator set to the beginning of the range. More... | |
| const_iterator | cbegin () const noexcept |
| A const_iterator set to the beginning of the range. More... | |
| const_iterator | cend () const noexcept |
| A const_iterator set to 1 beyond the end of the range. More... | |
| const_iterator | end () const noexcept |
| A const_iterator set to 1 beyond the end of the range. More... | |
| const_reverse_iterator | rbegin () const noexcept |
| A const_reverse_iterator set to 1 before the end of range. More... | |
| const_reverse_iterator | crbegin () const noexcept |
| A const_reverse_iterator set to 1 before the end of range. More... | |
| const_reverse_iterator | rend () const noexcept |
| A const_reverse_iterator set to 1 before the begin of range. More... | |
| const_reverse_iterator | crend () const noexcept |
| A const_reverse_iterator set to 1 before the begin of range. More... | |
Static Public Attributes | |
| static int | debug |
| Debugging. More... | |
Additional Inherited Members | |
Public Types inherited from IntRange< label > | |
| typedef label | value_type |
| Type of values the range contains. More... | |
| typedef label | size_type |
| The type that can represent the size of the range. More... | |
A range or interval of labels defined by a start and a size.
Definition at line 51 of file labelRange.H.
|
inlinenoexcept |
Default construct an empty range (0,0)
Definition at line 24 of file labelRangeI.H.
|
inlineexplicitnoexcept |
Construct a range with specified length, starting at zero (0,len)
Definition at line 30 of file labelRangeI.H.
|
inlinenoexcept |
Construct a range from start/length, no checks.
Definition at line 37 of file labelRangeI.H.
|
inlinenoexcept |
Construct a range from start/size, enforces non-negative size.
Optionally adjust the start to avoid any negative indices.
Definition at line 49 of file labelRangeI.H.
|
explicitnoexcept |
Construct from a min/max range, enforces non-negative size. Does not adjust the start.
Passing an invalid min/max range results in an empty labelRange
Definition at line 37 of file labelRange.C.
References range.
|
explicit |
Construct from Istream.
Definition at line 49 of file labelRange.C.
|
inlinenoexcept |
The value before the start of the range.
Definition at line 132 of file labelRange.H.
References IntRange< label >::rend_value().

|
inlinenoexcept |
The value after the last element in the range.
This is identical to the value of cend()
Definition at line 139 of file labelRange.H.
References IntRange< label >::end_value().

|
noexcept |
Adjust the start to avoid negative indices.
The size is decreased accordingly, but will never become negative. Eg, adjusting (-10, 15) becomes (0,5). adjusting (-20, 15) becomes (0,0)
Definition at line 74 of file labelRange.C.
Referenced by Foam::BitOps::set(), and bitSet::set().

|
inlinenoexcept |
Reset start and length, enforces non-negative size.
Optionally adjust the start to avoid any negative indices.
Definition at line 71 of file labelRangeI.H.
Referenced by meshSearch::boundaryTree(), and labelRanges::remove().

| Foam::List< Foam::label > labels | ( | ) | const |
Return list of labels corresponding to the range.
Same as Foam::identity()
Definition at line 59 of file labelRange.C.
References UList< T >::begin(), and UList< T >::end().

| bool overlaps | ( | const labelRange & | range, |
| bool | touches = false |
||
| ) | const |
Return true if the ranges overlap.
Optional test for ranges that also just touch each other
Definition at line 89 of file labelRange.C.
References range.
Referenced by labelRanges::add().

| Foam::labelRange join | ( | const labelRange & | range | ) | const |
Return a joined range, squashing any gaps in between.
A prior overlaps() check can be used to avoid squashing gaps.
Definition at line 112 of file labelRange.C.
References IntRange< IntType >::clampSize(), Foam::stringOps::lower(), Foam::max(), Foam::min(), range, and Foam::stringOps::upper().
Referenced by labelRanges::add().


| Foam::labelRange subset | ( | const labelRange & | range | ) | const |
Calculate the intersection of the range with another.
If there is no intersection, it returns an empty range with zero for start/size.
Definition at line 137 of file labelRange.C.
References Foam::stringOps::lower(), Foam::max(), Foam::min(), range, and Foam::stringOps::upper().

| Foam::labelRange subset | ( | const label | start, |
| const label | size | ||
| ) | const |
Calculate the intersection with the given start/size range.
If there is no intersection, it returns an empty range with zero for start/size.
Definition at line 155 of file labelRange.C.
References Foam::stringOps::lower(), Foam::max(), Foam::min(), and Foam::stringOps::upper().

| Foam::labelRange subset0 | ( | const label | size | ) | const |
Calculate the intersection with the given 0/size range.
If there is no intersection, it returns an empty range with zero for start/size.
Definition at line 175 of file labelRange.C.
References Foam::stringOps::lower(), Foam::max(), Foam::min(), and Foam::stringOps::upper().
Referenced by UList< Foam::vector >::validateRange().


|
inlinenoexcept |
Deprecated(2020-09) True if range is non-empty.
Definition at line 227 of file labelRange.H.
References IntRange< label >::empty().

|
static |
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.