Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisrichardson committed Oct 3, 2024
1 parent 38b30ae commit 5bb9e07
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions cpp/dolfinx/graph/partition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,26 +352,28 @@ graph::build::distribute(MPI_Comm comm, std::span<const std::int64_t> list,
std::vector<int> ghost_index_owner;
std::vector<std::int64_t> global_indices, global_indices1;
std::vector<int> src_ranks, src_ranks1;
for (std::int32_t p = 0; p < recv_disp.back(); ++p)
for (std::int32_t p = 0; p < recv_disp.size(); ++p)
{
int src_rank = src[p];

std::span row(recv_buffer.data() + p * buffer_shape1, buffer_shape1);
auto info = row.last(2);
std::int64_t orig_global_index = info[1];
auto edges = row.first(shape[1]);
if (int owner = info[0]; owner == rank)
{
data.insert(data.end(), edges.begin(), edges.end());
global_indices.push_back(orig_global_index);
src_ranks.push_back(src_rank);
}
else
for (std::int32_t q = recv_disp[p]; q < recv_disp[p + 1]; ++q)
{
data1.insert(data1.end(), edges.begin(), edges.end());
global_indices1.push_back(orig_global_index);
ghost_index_owner.push_back(owner);
src_ranks1.push_back(src_rank);
std::span row(recv_buffer.data() + q * buffer_shape1, buffer_shape1);
auto info = row.last(2);
std::int64_t orig_global_index = info[1];
auto edges = row.first(shape[1]);
if (int owner = info[0]; owner == rank)
{
data.insert(data.end(), edges.begin(), edges.end());
global_indices.push_back(orig_global_index);
src_ranks.push_back(src_rank);
}
else
{
data1.insert(data1.end(), edges.begin(), edges.end());
global_indices1.push_back(orig_global_index);
ghost_index_owner.push_back(owner);
src_ranks1.push_back(src_rank);
}
}
}

Expand Down

0 comments on commit 5bb9e07

Please sign in to comment.