@@ -19,7 +19,6 @@ using namespace dolfinx::common;
19
19
20
20
namespace
21
21
{
22
-
23
22
// / @brief Given source ranks (ranks that own indices ghosted by the
24
23
// / calling rank), compute ranks that ghost indices owned by the calling
25
24
// / rank.
@@ -156,6 +155,7 @@ communicate_ghosts_to_owners(MPI_Comm comm, std::span<const int> src,
156
155
// / Given an index map and a subset of local indices (can be owned or
157
156
// / ghost but must be unique and sorted), compute the owned, ghost and
158
157
// / ghost owners in the submap.
158
+ // /
159
159
// / @param[in] imap An index map.
160
160
// / @param[in] indices List of entity indices (indices local to the
161
161
// / process).
@@ -175,9 +175,6 @@ compute_submap_indices(const IndexMap& imap,
175
175
std::span<const std::int32_t > indices,
176
176
IndexMapOrder order, bool allow_owner_change)
177
177
{
178
- std::span<const int > src = imap.src ();
179
- std::span<const int > dest = imap.dest ();
180
-
181
178
// Create lookup array to determine if an index is in the sub-map
182
179
std::vector<std::uint8_t > is_in_submap (imap.size_local () + imap.num_ghosts (),
183
180
0 );
@@ -210,7 +207,9 @@ compute_submap_indices(const IndexMap& imap,
210
207
// processes that can own them in the submap.
211
208
std::vector<std::pair<std::int64_t , int >> global_idx_to_possible_owner;
212
209
const std::array local_range = imap.local_range ();
210
+
213
211
// Loop through the received indices
212
+ std::span<const int > dest = imap.dest ();
214
213
for (std::size_t i = 0 ; i < recv_disp.size () - 1 ; ++i)
215
214
{
216
215
for (int j = recv_disp[i]; j < recv_disp[i + 1 ]; ++j)
@@ -249,16 +248,16 @@ compute_submap_indices(const IndexMap& imap,
249
248
// load balancing, though the impact is probably only very small
250
249
auto it = std::ranges::lower_bound (global_idx_to_possible_owner, idx,
251
250
std::ranges::less (),
252
- [](auto & e) { return e.first ; });
251
+ [](auto e) { return e.first ; });
253
252
assert (it != global_idx_to_possible_owner.end () and it->first == idx);
254
253
send_owners.push_back (it->second );
255
254
}
256
255
257
256
// Create neighbourhood comm (owner -> ghost)
258
257
MPI_Comm comm1;
259
258
int ierr = MPI_Dist_graph_create_adjacent (
260
- imap.comm (), src.size (), src.data (), MPI_UNWEIGHTED, dest. size () ,
261
- dest.data (), MPI_UNWEIGHTED, MPI_INFO_NULL, false , &comm1);
259
+ imap.comm (), imap. src () .size (), imap. src () .data (), MPI_UNWEIGHTED,
260
+ dest.size (), dest. data (), MPI_UNWEIGHTED, MPI_INFO_NULL, false , &comm1);
262
261
dolfinx::MPI::check_error (imap.comm (), ierr);
263
262
264
263
// Send the data
@@ -350,7 +349,7 @@ compute_submap_indices(const IndexMap& imap,
350
349
}
351
350
352
351
// Compute submap destination ranks
353
- // FIXME Remove call to NBX
352
+ // FIXME: Remove call to NBX
354
353
std::vector<int > submap_dest
355
354
= dolfinx::MPI::compute_graph_edges_nbx (imap.comm (), submap_src);
356
355
std::ranges::sort (submap_dest);
@@ -379,7 +378,7 @@ compute_submap_ghost_indices(std::span<const int> submap_src,
379
378
std::span<const std::int32_t > submap_owned,
380
379
std::span<const std::int64_t > submap_ghosts_global,
381
380
std::span<const std::int32_t > submap_ghost_owners,
382
- int submap_offset, const IndexMap& imap)
381
+ std:: int64_t submap_offset, const IndexMap& imap)
383
382
{
384
383
// --- Step 1 ---: Send global ghost indices (w.r.t. original imap) to
385
384
// owning rank
@@ -397,15 +396,15 @@ compute_submap_ghost_indices(std::span<const int> submap_src,
397
396
std::vector<std::int64_t > send_gidx;
398
397
{
399
398
send_gidx.reserve (recv_indices.size ());
400
- // NOTE: Received indices are owned by this process in the submap, but not
401
- // necessarily in the original imap, so we must use global_to_local to
402
- // convert rather than subtracting local_range[0]
403
- // TODO Convert recv_indices or submap_owned?
404
- std::vector<int32_t > recv_indices_local (recv_indices.size ());
399
+ // NOTE: Received indices are owned by this process in the submap,
400
+ // but not necessarily in the original imap, so we must use
401
+ // global_to_local to convert rather than subtracting local_range[0]
402
+ // TODO: Convert recv_indices or submap_owned?
403
+ std::vector<std:: int32_t > recv_indices_local (recv_indices.size ());
405
404
imap.global_to_local (recv_indices, recv_indices_local);
406
405
407
406
// Compute submap global index
408
- for (auto idx : recv_indices_local)
407
+ for (std:: int32_t idx : recv_indices_local)
409
408
{
410
409
// Could avoid search by creating look-up array
411
410
auto it = std::ranges::lower_bound (submap_owned, idx);
@@ -415,7 +414,8 @@ compute_submap_ghost_indices(std::span<const int> submap_src,
415
414
}
416
415
}
417
416
418
- // --- Step 3 ---: Send submap global indices to process that ghost them
417
+ // --- Step 3 ---: Send submap global indices to process that ghost
418
+ // them
419
419
420
420
std::vector<std::int64_t > recv_gidx (send_disp.back ());
421
421
{
0 commit comments