MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / build_src_dest

Function build_src_dest

cpp/dolfinx/common/IndexMap.cpp:30–48  ·  view source on GitHub ↗

@brief Given source ranks (ranks that own indices ghosted by the calling rank), compute ranks that ghost indices owned by the calling rank. @param comm MPI communicator. @param owners List of ranks that own each ghost index. @return (src ranks, destination ranks). Both lists are sorted.

Source from the content-addressed store, hash-verified

28/// @param owners List of ranks that own each ghost index.
29/// @return (src ranks, destination ranks). Both lists are sorted.
30std::array<std::vector<int>, 2>
31build_src_dest(MPI_Comm comm, std::span<const int> owners, int tag)
32{
33 if (dolfinx::MPI::size(comm) == 1)
34 {
35 assert(owners.empty());
36 return std::array<std::vector<int>, 2>();
37 }
38
39 std::vector<int> src(owners.begin(), owners.end());
40 std::ranges::sort(src);
41 auto [unique_end, range_end] = std::ranges::unique(src);
42 src.erase(unique_end, range_end);
43 src.shrink_to_fit();
44 std::vector<int> dest = dolfinx::MPI::compute_graph_edges_nbx(comm, src, tag);
45 std::ranges::sort(dest);
46
47 return {std::move(src), std::move(dest)};
48}
49
50/// @brief Helper function that sends ghost indices on a given process
51/// to their owning rank, and receives indices owned by this process

Callers 1

IndexMapMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected