9#include "AdjacencyList.h"
38using partition_fn = std::function<graph::AdjacencyList<std::int32_t>(
40 std::optional<std::span<const std::int32_t>>,
41 std::optional<std::span<const std::int32_t>>,
bool)>;
70 MPI_Comm,
int, std::span<const double>,
int,
71 std::optional<std::span<const std::int32_t>>)>;
104 std::optional<std::span<const std::int32_t>>,
105 std::optional<std::span<const std::int32_t>>,
bool)>;
119 = std::variant<partition_fn, geom_partition_fn, hybrid_partition_fn>;
146 std::optional<std::span<const std::int32_t>> node_weights,
147 std::optional<std::span<const std::int32_t>> edge_weights,
bool ghosting);
164 std::optional<std::span<const std::int32_t>>
node_weights = std::nullopt;
201std::tuple<graph::AdjacencyList<std::int64_t>, std::vector<int>,
202 std::vector<std::int64_t>, std::vector<int>>
238std::tuple<std::vector<std::int64_t>, std::vector<int>,
239 std::vector<std::int64_t>, std::vector<int>>
240distribute(MPI_Comm comm, std::span<const std::int64_t> list,
241 std::array<std::size_t, 2> shape,
268std::vector<std::int64_t>
270 std::span<const std::int64_t> owned_indices,
271 std::span<const std::int64_t> ghost_indices,
272 std::span<const int> ghost_owners,
int num_threads);
284std::vector<std::int64_t>
286 std::span<const std::int32_t> local);
296std::vector<std::int32_t>
298 std::span<const std::int64_t> local1_to_global);
This class provides a static adjacency list data structure.
Definition AdjacencyList.h:41
Definition partition.h:170
std::vector< std::int64_t > compute_ghost_indices(MPI_Comm comm, std::span< const std::int64_t > owned_indices, std::span< const std::int64_t > ghost_indices, std::span< const int > ghost_owners, int num_threads)
Take a set of distributed input global indices, including ghosts, and determine the new global indice...
Definition partition.cpp:400
std::vector< std::int64_t > compute_local_to_global(std::span< const std::int64_t > global, std::span< const std::int32_t > local)
Definition partition.cpp:573
std::tuple< graph::AdjacencyList< std::int64_t >, std::vector< int >, std::vector< std::int64_t >, std::vector< int > > distribute(MPI_Comm comm, const graph::AdjacencyList< std::int64_t > &list, const graph::AdjacencyList< std::int32_t > &destinations)
Distribute adjacency list nodes to destination ranks.
Definition partition.cpp:157
std::vector< std::int32_t > compute_local_to_local(std::span< const std::int64_t > local0_to_global, std::span< const std::int64_t > local1_to_global)
Compute a local0-to-local1 map from two local-to-global maps with common global indices.
Definition partition.cpp:595
Graph data structures and algorithms.
Definition AdjacencyList.h:23
std::function< std::vector< int >( MPI_Comm, int, std::span< const double >, int, std::optional< std::span< const std::int32_t > >)> geom_partition_fn
Signature of functions for computing the parallel partitioning of a distributed graph from the positi...
Definition partition.h:69
bool has_partitioner(const AnyPartitionFunction &partitioner)
Whether an AnyPartitionFunction holds a callable partitioner.
Definition partition.cpp:130
std::function< graph::AdjacencyList< std::int32_t >( MPI_Comm, int, const AdjacencyList< std::int64_t > &, std::span< const double >, std::optional< std::span< const std::int32_t > >, std::optional< std::span< const std::int32_t > >, bool)> hybrid_partition_fn
Signature of functions for computing the parallel partitioning of a distributed graph using both its ...
Definition partition.h:102
AdjacencyList< std::int32_t > partition_graph(MPI_Comm comm, int nparts, const AdjacencyList< std::int64_t > &local_graph, std::optional< std::span< const std::int32_t > > node_weights, std::optional< std::span< const std::int32_t > > edge_weights, bool ghosting)
Partition graph across processes using the default graph partitioner.
Definition partition.cpp:136
std::function< graph::AdjacencyList< std::int32_t >( MPI_Comm, int, const AdjacencyList< std::int64_t > &, std::optional< std::span< const std::int32_t > >, std::optional< std::span< const std::int32_t > >, bool)> partition_fn
Signature of functions for computing the parallel partitioning of a distributed graph,...
Definition partition.h:38
std::variant< partition_fn, geom_partition_fn, hybrid_partition_fn > AnyPartitionFunction
Any of the three partitioning function shapes that mesh::create_mesh accepts: partition_fn,...
Definition partition.h:118
An AnyPartitionFunction together with the node weights it should be called with, if any.
Definition partition.h:156
std::optional< std::span< const std::int32_t > > node_weights
Definition partition.h:163
AnyPartitionFunction fn
Definition partition.h:159