Loading...
Searching...
No Matches
OffsetRange< IntType > Class Template Reference

A tuple of integers comprising start, size, total. More...

#include <OffsetRange.H>

Inheritance diagram for OffsetRange< IntType >:

Public Types

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.

Public Member Functions

 OffsetRange (const OffsetRange &) noexcept=default
 Copy construct.
 OffsetRange (OffsetRange &&) noexcept=default
 Move construct.
OffsetRangeoperator= (const OffsetRange &) noexcept=default
 Copy assignment.
OffsetRangeoperator= (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.

Detailed Description

template<class IntType>
class Foam::OffsetRange< IntType >

A tuple of integers comprising start, size, total.

This frequently corresponds what is termed a "hyperslab", a "slice" or a "selection" for MPI addressing. For this type of use, the OffsetRange would represent the local rank addressing. Apart from the total size, it would not have information about any other ranks (like Foam::globalIndex does).

Note
Since this range is low-level, the IO operators are defined in the separate OffsetRangeIO.H header.
See also
Foam::globalIndex Foam::GlobalOffset
Source files

Definition at line 81 of file OffsetRange.H.

Member Typedef Documentation

◆ value_type

template<class IntType>
typedef IntType value_type

Type of values contained.

Definition at line 119 of file OffsetRange.H.

◆ size_type

template<class IntType>
typedef IntType size_type

The type that can represent the size.

Definition at line 124 of file OffsetRange.H.

◆ const_iterator

template<class IntType>
using const_iterator = IndexIterator<IntType>

Input iterator with const access.

Definition at line 129 of file OffsetRange.H.

◆ const_reverse_iterator

template<class IntType>
using const_reverse_iterator = ReverseIndexIterator<IntType>

Reverse input iterator with const access.

Definition at line 134 of file OffsetRange.H.

Constructor & Destructor Documentation

◆ OffsetRange() [1/5]

template<class IntType>
OffsetRange ( const OffsetRange< IntType > & )
defaultnoexcept

◆ OffsetRange() [2/5]

template<class IntType>
OffsetRange ( OffsetRange< IntType > && )
defaultnoexcept

Move construct.

References Foam::noexcept, and OffsetRange().

Here is the call graph for this function:

◆ OffsetRange() [3/5]

template<class IntType>
OffsetRange ( )
inlineconstexprnoexcept

Default construct as (0,0,0).

Definition at line 24 of file OffsetRangeI.H.

References Foam::noexcept.

◆ OffsetRange() [4/5]

template<class IntType>
OffsetRange ( IntType len)
inlineconstexprnoexcept

Construct with start=0 and specified size, assigns total=size.

Definition at line 33 of file OffsetRangeI.H.

References Foam::noexcept.

◆ OffsetRange() [5/5]

template<class IntType>
OffsetRange ( IntType beg,
IntType len,
IntType tot )
inlineconstexprnoexcept

Construct from all components, no checks.

Definition at line 42 of file OffsetRangeI.H.

References Foam::noexcept.

Member Function Documentation

◆ operator=() [1/4]

template<class IntType>
OffsetRange & operator= ( const OffsetRange< IntType > & )
defaultnoexcept

Copy assignment.

References Foam::noexcept, and OffsetRange().

Here is the call graph for this function:

◆ operator=() [2/4]

template<class IntType>
OffsetRange & operator= ( OffsetRange< IntType > && )
defaultnoexcept

Move assignment.

References Foam::noexcept, and OffsetRange().

Here is the call graph for this function:

◆ empty()

template<class IntType>
bool empty ( ) const
inlinenoexcept

True if zero-sized.

Definition at line 193 of file OffsetRange.H.

References empty(), and Foam::noexcept.

Referenced by empty().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size() [1/2]

template<class IntType>
IntType size ( ) const
inlinenoexcept

The size.

Definition at line 198 of file OffsetRange.H.

References Foam::noexcept.

Referenced by GlobalOffset< label >::localSize().

Here is the caller graph for this function:

◆ size() [2/2]

template<class IntType>
IntType & size ( )
inlinenoexcept

Non-const access to the size.

Definition at line 203 of file OffsetRange.H.

References Foam::noexcept.

◆ start() [1/2]

template<class IntType>
IntType start ( ) const
inlinenoexcept

The lower value of the range.

Definition at line 208 of file OffsetRange.H.

References Foam::noexcept.

Referenced by GlobalOffset< label >::localStart(), and GlobalOffset< label >::toGlobal().

Here is the caller graph for this function:

◆ start() [2/2]

template<class IntType>
IntType & start ( )
inlinenoexcept

Non-const access to start of the range.

Definition at line 213 of file OffsetRange.H.

References Foam::noexcept.

◆ total() [1/2]

template<class IntType>
IntType total ( ) const
inlinenoexcept

The total size.

Definition at line 218 of file OffsetRange.H.

References Foam::noexcept.

Referenced by GlobalOffset< label >::totalSize().

Here is the caller graph for this function:

◆ total() [2/2]

template<class IntType>
IntType & total ( )
inlinenoexcept

Non-const access to the total size.

Definition at line 223 of file OffsetRange.H.

References Foam::noexcept.

◆ range()

template<class IntType>
IntRange< IntType > range ( ) const
inlinenoexcept

The (state,size) range.

Definition at line 228 of file OffsetRange.H.

References Foam::noexcept.

Referenced by GlobalOffset< IntType >::GlobalOffset().

Here is the caller graph for this function:

◆ clear()

template<class IntType>
void clear ( )
inlinenoexcept

Reset to zero.

Definition at line 93 of file OffsetRangeI.H.

References Foam::noexcept.

◆ reset() [1/2]

template<class IntType>
void reset ( IntType len)
inlinenoexcept

Reset to the specified size, with start=0 and total=size.

Can also use operator= assignment

Definition at line 102 of file OffsetRangeI.H.

Referenced by operator=(), GlobalOffset< IntType >::reset(), and GlobalOffset< IntType >::reset().

Here is the caller graph for this function:

◆ reset() [2/2]

template<class IntType>
void reset ( IntType beg,
IntType len,
IntType tot )
inlinenoexcept

Reset all components.

Definition at line 111 of file OffsetRangeI.H.

◆ equals()

template<class IntType>
bool equals ( const OffsetRange< IntType > & b) const
inlinenoexcept

Test equality of start/size/total.

Definition at line 133 of file OffsetRangeI.H.

References b, and OffsetRange().

Referenced by Foam::operator!=(), and Foam::operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compare()

template<class IntType>
int compare ( const OffsetRange< IntType > & b) const
inlinenoexcept

Compare start/size/total in that order.

Returns
-1,0,+1

Definition at line 150 of file OffsetRangeI.H.

References b, and OffsetRange().

Referenced by Foam::operator<(), Foam::operator<=(), Foam::operator>(), and Foam::operator>=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [3/4]

template<class IntType>
void operator= ( IntType len)
inlinenoexcept

Assign to the specified size, with start=0 and total=size.

Definition at line 274 of file OffsetRange.H.

References Foam::noexcept, and reset().

Here is the call graph for this function:

◆ operator=() [4/4]

template<class IntType>
template<class IntT2, class = std::enable_if_t <std::is_integral_v<IntT2> && (sizeof(IntT2) <= sizeof(IntType))>>
void operator= ( const OffsetRange< IntT2 > & rhs)
inlinenoexcept

Assign from an OffsetRange with the same or lower representation.

Definition at line 288 of file OffsetRange.H.

References OffsetRange(), and Foam::rhs().

Here is the call graph for this function:

◆ at()

template<class IntType>
const_iterator at ( IntType i) const
inline

Return const_iterator to a position within the range, with bounds checking.

Returns
iterator at the requested position, or end() for out-of-bounds

Definition at line 301 of file OffsetRange.H.

◆ operator[]()

template<class IntType>
IntType operator[] ( IntType i) const
inlineconstexprnoexcept

Offset dereference, without bounds checking.

Definition at line 174 of file OffsetRangeI.H.

◆ operator()()

template<class IntType>
bool operator() ( IntType i) const
inlinenoexcept

True if the value is between the start and size range.

Behaviour identical to contains() - usable as a predicate

Definition at line 313 of file OffsetRange.H.

References contains().

Here is the call graph for this function:

◆ contains()

template<class IntType>
bool contains ( IntType value) const
inlinenoexcept

True if the value is between the start and size range range.

Definition at line 125 of file OffsetRangeI.H.

Referenced by GlobalOffset< label >::isLocal(), and operator()().

Here is the caller graph for this function:

◆ begin_value()

template<class IntType>
IntType begin_value ( ) const
inlinenoexcept

The value at the beginning of the start/size range - same as start().

Definition at line 65 of file OffsetRangeI.H.

References Foam::noexcept.

Referenced by begin(), and cbegin().

Here is the caller graph for this function:

◆ end_value()

template<class IntType>
IntType end_value ( ) const
inlinenoexcept

The value 1 beyond the end of the start/size range.

Definition at line 72 of file OffsetRangeI.H.

References Foam::noexcept.

Referenced by cend(), and end().

Here is the caller graph for this function:

◆ rbegin_value()

template<class IntType>
IntType rbegin_value ( ) const
inlinenoexcept

The max value of the start/size range.

Definition at line 79 of file OffsetRangeI.H.

References Foam::noexcept.

Referenced by crbegin(), and rbegin().

Here is the caller graph for this function:

◆ rend_value()

template<class IntType>
IntType rend_value ( ) const
inlinenoexcept

The value 1 before the begin of start/size range.

Definition at line 86 of file OffsetRangeI.H.

References Foam::noexcept.

Referenced by crend(), and rend().

Here is the caller graph for this function:

◆ begin()

template<class IntType>
const_iterator begin ( ) const
inlinenoexcept

A const_iterator set to the beginning of the range.

Definition at line 352 of file OffsetRange.H.

References begin(), begin_value(), and Foam::noexcept.

Referenced by begin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbegin()

template<class IntType>
const_iterator cbegin ( ) const
inlinenoexcept

A const_iterator set to the beginning of the range.

Definition at line 357 of file OffsetRange.H.

References begin_value(), and Foam::noexcept.

Here is the call graph for this function:

◆ cend()

template<class IntType>
const_iterator cend ( ) const
inlinenoexcept

A const_iterator set to 1 beyond the end of the range.

Definition at line 362 of file OffsetRange.H.

References end_value(), and Foam::noexcept.

Here is the call graph for this function:

◆ end()

template<class IntType>
const_iterator end ( ) const
inlinenoexcept

A const_iterator set to 1 beyond the end of the range.

Definition at line 367 of file OffsetRange.H.

References end_value(), and Foam::noexcept.

Here is the call graph for this function:

◆ rbegin()

template<class IntType>
const_reverse_iterator rbegin ( ) const
inlinenoexcept

A const_reverse_iterator set to 1 before the end of range.

Definition at line 376 of file OffsetRange.H.

References Foam::noexcept, and rbegin_value().

Here is the call graph for this function:

◆ crbegin()

template<class IntType>
const_reverse_iterator crbegin ( ) const
inlinenoexcept

A const_reverse_iterator set to 1 before the end of range.

Definition at line 382 of file OffsetRange.H.

References Foam::noexcept, and rbegin_value().

Here is the call graph for this function:

◆ rend()

template<class IntType>
const_reverse_iterator rend ( ) const
inlinenoexcept

A const_reverse_iterator set to 1 before the begin of range.

Definition at line 387 of file OffsetRange.H.

References Foam::noexcept, and rend_value().

Here is the call graph for this function:

◆ crend()

template<class IntType>
const_reverse_iterator crend ( ) const
inlinenoexcept

A const_reverse_iterator set to 1 before the begin of range.

Definition at line 392 of file OffsetRange.H.

References Foam::noexcept, and rend_value().

Here is the call graph for this function:

The documentation for this class was generated from the following files: