|
| std::vector< std::int32_t > | compute_owned_indices (std::span< const std::int32_t > indices, const IndexMap &map) |
| | Return selected indices owned by the calling rank.
|
| std::tuple< std::int64_t, std::vector< std::int32_t >, std::vector< std::vector< std::int64_t > >, std::vector< std::vector< int > > > | stack_index_maps (const std::vector< std::pair< std::reference_wrapper< const IndexMap >, int > > &maps) |
| | Compute layout data for a concatenated index map.
|
| std::tuple< IndexMap, std::vector< std::int32_t >, bool > | create_sub_index_map (const IndexMap &imap, std::span< const std::int32_t > indices, IndexMapOrder order=IndexMapOrder::any) |
| | Create an index map from a subset of an existing map.
|
| constexpr std::array< std::int64_t, 2 > | local_range (int index, std::int64_t N, int size) |
| | Partition a global range [0, N - 1] across callers into non-overlapping sub-partitions of almost equal size. Returns the local partition for the caller. The local partition range.
|
| template<std::ranges::input_range U, std::ranges::input_range V> |
| std::pair< std::vector< typename U::value_type >, std::vector< typename V::value_type > > | sort_unique (const U &indices, const V &values) |
| | Sort two arrays based on the values in array indices.
|
| template<class T> |
| std::size_t | hash_local (const T &x) |
| | Compute a hash of a given object.
|
| template<class T> |
| std::size_t | hash_global (MPI_Comm comm, const T &x) |
| | Compute a hash for a distributed (MPI) object.
|
Miscellaneous classes, functions and types.
Generic tools.
This namespace provides utility type functions for managing subsystems, convenience classes and library-wide typedefs.
| std::vector< int32_t > compute_owned_indices |
( |
std::span< const std::int32_t > | indices, |
|
|
const IndexMap & | map ) |
Return selected indices owned by the calling rank.
Includes locally owned entries in indices and entries selected as ghosts on other ranks.
For example, on two ranks, suppose rank 0 owns global indices [0,
1] and has global index 2 as local ghost index 2, while rank 1 owns global indices [2, 3] and has global index 1 as local ghost index 2. If both ranks pass local index [2], the results are [1] on rank 0 and [0] on rank 1: each owns the global index selected as a ghost by the other rank.
- Note
- Collective
- Parameters
-
| [in] | indices | Sorted unique local indices (owned or ghost) in [0, map.size_local() + map.num_ghosts()). |
| [in] | map | The index map. |
- Precondition
- indices is sorted, unique, and in range. This condition is checked in Developer builds; callers must ensure it in Release builds.
- Returns
- Local indices owned by the calling rank.
- Exceptions
-
| std::invalid_argument | If the indices precondition is violated in a Developer build. |
| std::array< std::int64_t, 2 > local_range |
( |
int | index, |
|
|
std::int64_t | N, |
|
|
int | size ) |
|
constexpr |
Partition a global range [0, N - 1] across callers into non-overlapping sub-partitions of almost equal size. Returns the local partition for the caller. The local partition range.
Partitions [0, N) into size non-overlapping partitions [n_(i0},
n_(i1)), where i is index and n_(i1) == n_((i+1)0).
- Parameters
-
| [in] | index | Index of the partition to compute. |
| [in] | N | Global range to partition. |
| [in] | size | Number of partitions into which to partition N. |
template<std::ranges::input_range U, std::ranges::input_range V>
| std::pair< std::vector< typename U::value_type >, std::vector< typename V::value_type > > sort_unique |
( |
const U & | indices, |
|
|
const V & | values ) |
Sort two arrays based on the values in array indices.
Any duplicate indices and the corresponding value are removed. In the case of duplicates, the entry with the smallest value is retained.
- Parameters
-
| [in] | indices | Array of indices. |
| [in] | values | Array of values. |
- Returns
- Sorted (indices, values), with sorting based on indices.