A Foam::OffsetRange (start, size, total) tuple with some additional parallel functionality. A common use case for OffsetRange would be the definition of non-overlapping global addressing. More...
#include <globalOffset.H>


Public Member Functions | |
| constexpr | GlobalOffset () noexcept |
| Default construct as (0,0,0). | |
| constexpr | GlobalOffset (IntType len) noexcept |
| Construct with specified length, starting at zero (0,len,len). No communication. | |
| GlobalOffset (IntType len, int communicator, bool parallel=UPstream::parRun()) | |
| Construct from local size, with parallel coordination of the offsets and total size. | |
| GlobalOffset (const OffsetRange< IntType > &range) noexcept | |
| Copy construct from OffsetRange. | |
| GlobalOffset (Istream &is) | |
| Read construct from start/size/total tuple. | |
| IntType | localStart () const noexcept |
| Same as start() - method name as per globalIndex. | |
| IntType | localSize () const noexcept |
| Same as size() - method name as per globalIndex. | |
| IntType | totalSize () const noexcept |
| Same as total() - method name as per globalIndex. | |
| void | reset (IntType len) noexcept |
| Reset from local size with zero offset. | |
| void | reset (IntType len, int communicator, bool parallel=UPstream::parRun()) |
| Reset from local size, with parallel coordination of the offsets and total size. | |
| void | reduce (int communicator=UPstream::worldComm) |
| Based on the local input size, determine the globally-consistent start offset and total size. | |
| bool | isLocal (IntType i) const noexcept |
| Test if index is within the range. Same as contains(). | |
| template<class IntType2> | |
| IntType2 | toGlobal (IntType2 i) const noexcept |
| From local to global index. | |
| template<class IntType2> | |
| List< IntType2 > | toGlobal (const UList< IntType2 > &labels) const |
| Convert a list from local to global index. | |
| template<class IntType2> | |
| void | inplaceToGlobal (UList< IntType2 > &labels) const |
| Convert a list (inplace) from local to global index. | |
| template<class IntType2> | |
| IntType2 | toLocal (IntType2 i) const |
| From global to local. | |
| Public Member Functions inherited from OffsetRange< IntType > | |
| OffsetRange (const OffsetRange &) noexcept=default | |
| Copy construct. | |
| OffsetRange (OffsetRange &&) noexcept=default | |
| Move construct. | |
| OffsetRange & | operator= (const OffsetRange &) noexcept=default |
| Copy assignment. | |
| OffsetRange & | operator= (OffsetRange &&) noexcept=default |
| Move assignment. | |
| constexpr | OffsetRange () noexcept |
| Default construct as (0,0,0). | |
| constexpr | OffsetRange (IntType len) noexcept |
| Construct with start=0 and specified size, assigns total=size. | |
| constexpr | OffsetRange (IntType beg, IntType len, IntType tot) noexcept |
| Construct from all components, no checks. | |
| bool | empty () const noexcept |
| True if zero-sized. | |
| IntType | size () const noexcept |
| The size. | |
| IntType & | size () noexcept |
| Non-const access to the size. | |
| IntType | start () const noexcept |
| The lower value of the range. | |
| IntType & | start () noexcept |
| Non-const access to start of the range. | |
| IntType | total () const noexcept |
| The total size. | |
| IntType & | total () noexcept |
| Non-const access to the total size. | |
| IntRange< IntType > | range () const noexcept |
| The (state,size) range. | |
| void | clear () noexcept |
| Reset to zero. | |
| void | reset (IntType len) noexcept |
| Reset to the specified size, with start=0 and total=size. | |
| void | reset (IntType beg, IntType len, IntType tot) noexcept |
| Reset all components. | |
| bool | equals (const OffsetRange &b) const noexcept |
| Test equality of start/size/total. | |
| int | compare (const OffsetRange &b) const noexcept |
| Compare start/size/total in that order. | |
| void | operator= (IntType len) noexcept |
| Assign to the specified size, with start=0 and total=size. | |
| template<class IntT2, class = std::enable_if_t <std::is_integral_v<IntT2> && (sizeof(IntT2) <= sizeof(IntType))>> | |
| void | operator= (const OffsetRange< IntT2 > &rhs) noexcept |
| Assign from an OffsetRange with the same or lower representation. | |
| const_iterator | at (IntType i) const |
| Return const_iterator to a position within the range, with bounds checking. | |
| constexpr IntType | operator[] (IntType i) const noexcept |
| Offset dereference, without bounds checking. | |
| bool | operator() (IntType i) const noexcept |
| True if the value is between the start and size range. | |
| bool | contains (IntType value) const noexcept |
| True if the value is between the start and size range range. | |
| IntType | begin_value () const noexcept |
| The value at the beginning of the start/size range - same as start(). | |
| IntType | end_value () const noexcept |
| The value 1 beyond the end of the start/size range. | |
| IntType | rbegin_value () const noexcept |
| The max value of the start/size range. | |
| IntType | rend_value () const noexcept |
| The value 1 before the begin of start/size range. | |
| const_iterator | begin () const noexcept |
| A const_iterator set to the beginning of the range. | |
| const_iterator | cbegin () const noexcept |
| A const_iterator set to the beginning of the range. | |
| const_iterator | cend () const noexcept |
| A const_iterator set to 1 beyond the end of the range. | |
| const_iterator | end () const noexcept |
| A const_iterator set to 1 beyond the end of the range. | |
| const_reverse_iterator | rbegin () const noexcept |
| A const_reverse_iterator set to 1 before the end of range. | |
| const_reverse_iterator | crbegin () const noexcept |
| A const_reverse_iterator set to 1 before the end of range. | |
| const_reverse_iterator | rend () const noexcept |
| A const_reverse_iterator set to 1 before the begin of range. | |
| const_reverse_iterator | crend () const noexcept |
| A const_reverse_iterator set to 1 before the begin of range. | |
Static Public Member Functions | |
| static OffsetRange< IntType > | calculate (IntType localSize, int communicator=UPstream::worldComm, bool parallel=UPstream::parRun()) |
| Calculate a globally-consistent set of start/size/total based on the given local input size. | |
| template<class Int, class = std::enable_if_t<std::is_integral_v<Int>>> | |
| static OffsetRange< Int > | calculate (IntType localSize, int communicator=UPstream::worldComm, bool parallel=UPstream::parRun()) |
| Calculate a globally-consistent set of start/size/total based on the given local input size. | |
| template<class Int, class = std::enable_if_t<std::is_integral_v<Int>>> | |
| static List< OffsetRange< Int > > | calculate (const UList< Int > &localSizes, int communicator=UPstream::worldComm, bool parallel=UPstream::parRun()) |
| Return a list of globally-consistent start/size/total ranges based on the given local input sizes. | |
Additional Inherited Members | |
| Public Types inherited from OffsetRange< IntType > | |
| typedef IntType | value_type |
| Type of values contained. | |
| typedef IntType | size_type |
| The type that can represent the size. | |
| using | const_iterator = IndexIterator<IntType> |
| Input iterator with const access. | |
| using | const_reverse_iterator = ReverseIndexIterator<IntType> |
| Reverse input iterator with const access. | |
A Foam::OffsetRange (start, size, total) tuple with some additional parallel functionality. A common use case for OffsetRange would be the definition of non-overlapping global addressing.
OffsetRange is used for the addressing information, and GlobalOffset for creating and managing that addressing.
Definition at line 69 of file globalOffset.H.
|
inlineconstexprnoexcept |
Default construct as (0,0,0).
Definition at line 24 of file globalOffsetI.H.
References Foam::noexcept, and OffsetRange< IntType >::OffsetRange().

|
inlineconstexprnoexcept |
Construct with specified length, starting at zero (0,len,len). No communication.
Definition at line 31 of file globalOffsetI.H.
References Foam::noexcept, and OffsetRange< IntType >::OffsetRange().

|
inline |
Construct from local size, with parallel coordination of the offsets and total size.
| communicator | communicator |
| parallel | use parallel comms |
Definition at line 38 of file globalOffsetI.H.
References OffsetRange< IntType >::OffsetRange(), and reduce().

|
inlinenoexcept |
Copy construct from OffsetRange.
Should be left as implicit to allow assignment from the results of the calculate() method
Definition at line 55 of file globalOffsetI.H.
References Foam::noexcept, OffsetRange< IntType >::OffsetRange(), and OffsetRange< IntType >::range().

|
explicit |
Read construct from start/size/total tuple.
|
inlinenoexcept |
Same as start() - method name as per globalIndex.
Definition at line 148 of file globalOffset.H.
|
inlinenoexcept |
Same as size() - method name as per globalIndex.
Definition at line 153 of file globalOffset.H.
|
inlinenoexcept |
Same as total() - method name as per globalIndex.
Definition at line 158 of file globalOffset.H.
|
inlinenoexcept |
Reset from local size with zero offset.
Definition at line 67 of file globalOffsetI.H.
References OffsetRange< IntType >::reset().

|
inline |
Reset from local size, with parallel coordination of the offsets and total size.
| communicator | communicator |
| parallel | use parallel comms |
Definition at line 74 of file globalOffsetI.H.
References Foam::reduce(), and OffsetRange< IntType >::reset().

| void reduce | ( | int | communicator = UPstream::worldComm | ) |
Based on the local input size, determine the globally-consistent start offset and total size.
Referenced by GlobalOffset().

|
inlinestatic |
Calculate a globally-consistent set of start/size/total based on the given local input size.
| communicator | communicator |
| parallel | use parallel comms |
Definition at line 192 of file globalOffset.H.
|
inlinestatic |
Calculate a globally-consistent set of start/size/total based on the given local input size.
| communicator | communicator |
| parallel | use parallel comms |
Definition at line 211 of file globalOffset.H.
|
inlinestatic |
Return a list of globally-consistent start/size/total ranges based on the given local input sizes.
| communicator | communicator |
| parallel | use parallel comms |
Definition at line 230 of file globalOffset.H.
|
inlinenoexcept |
Test if index is within the range. Same as contains().
Definition at line 248 of file globalOffset.H.
|
inlinenoexcept |
From local to global index.
Definition at line 257 of file globalOffset.H.
| List< IntType2 > toGlobal | ( | const UList< IntType2 > & | labels | ) | const |
Convert a list from local to global index.
| void inplaceToGlobal | ( | UList< IntType2 > & | labels | ) | const |
Convert a list (inplace) from local to global index.
| IntType2 toLocal | ( | IntType2 | i | ) | const |
From global to local.
FatalError for an out-of-range value