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

Function test_consensus_exchange

cpp/test/common/index_map.cpp:169–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169void test_consensus_exchange()
170{
171 const int mpi_size = dolfinx::MPI::size(MPI_COMM_WORLD);
172 const int mpi_rank = dolfinx::MPI::rank(MPI_COMM_WORLD);
173 const int size_local = 100;
174
175 // Create some ghost entries on next process
176 const int num_ghosts = (mpi_size - 1) * 3;
177 std::vector<std::int64_t> ghosts(num_ghosts);
178 for (int i = 0; i < num_ghosts; ++i)
179 ghosts[i] = (mpi_rank + 1) % mpi_size * size_local + i;
180
181 std::vector<int> global_ghost_owner(ghosts.size(), (mpi_rank + 1) % mpi_size);
182
183 // Create an IndexMap
184 std::vector<int> src_ranks = global_ghost_owner;
185 std::ranges::sort(src_ranks);
186 auto [unique_end, range_end] = std::ranges::unique(src_ranks);
187 src_ranks.erase(unique_end, range_end);
188
189 auto dest_ranks0
190 = dolfinx::MPI::compute_graph_edges_nbx(MPI_COMM_WORLD, src_ranks);
191 auto dest_ranks1
192 = dolfinx::MPI::compute_graph_edges_pcx(MPI_COMM_WORLD, src_ranks);
193 std::ranges::sort(dest_ranks0);
194 std::ranges::sort(dest_ranks1);
195
196 CHECK(dest_ranks0 == dest_ranks1);
197}
198
199void test_rank_split()
200{

Callers 1

index_map.cppFile · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected