42 : _is_lib_allocated{
false},
48 template <
typename RangeContainer>
50 : _is_lib_allocated{
true},
54 std::is_same_v<typename RangeContainer::value_type, RankRange>,
55 "Container's value_type must be RankRange!"
58 for (
size_t i = 0;
i <
ranges.size(); ++
i) {
60 _rank_range_array[
i][0] =
range.first;
61 _rank_range_array[
i][1] =
range.last;
62 _rank_range_array[
i][2] =
range.stride;
68 if (_is_lib_allocated) {
69 delete[] _rank_range_array;
76 return _rank_range_array;
88 return std::any_of(_rank_range_array, _rank_range_array + _size, [&](
auto const&
plain_rank_range) {
98 bool const _is_lib_allocated;
99 int (*_rank_range_array)[3];
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
RankRanges encapsulate multiple rank ranges which are used in functions like MPI_Group_range_incl/exc...
Definition rank_ranges.hpp:36
auto get() const
Get non-owning access to the underlying c-style array storing the rank ranges.
Definition rank_ranges.hpp:75
RankRanges(int(*rank_range_array)[3], size_t size)
Constructor taking a plain two dimension c-style array.
Definition rank_ranges.hpp:41
auto size() const
Number of ranges stored in this object.
Definition rank_ranges.hpp:81
~RankRanges()
Destroys objects and deallocates any memory allocated during construction.
Definition rank_ranges.hpp:67
bool contains(int rank) const
Checks whether the rank ranges contain a certain rank.
Definition rank_ranges.hpp:87
RankRanges(RangeContainer const &ranges)
Constructor taking any container storing RankRange objects.
Definition rank_ranges.hpp:49
Struct encapsulating a MPI rank range triplet as used in functions like MPI_Group_range_incl/excl.
Definition rank_ranges.hpp:25
int first
First rank contained in the rank range.
Definition rank_ranges.hpp:26
int stride
Stride used in the rank range.
Definition rank_ranges.hpp:28
int last
Last rank contained in the rank range.
Definition rank_ranges.hpp:27