Skip to content

Commit

Permalink
Simplify search for single rank with non-zero number of true dofs
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiangrimberg committed Jun 26, 2024
1 parent b69eeba commit ee3dbd7
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions palace/linalg/divfree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ DivFreeSolver<VecType>::DivFreeSolver(
Mpi::GlobalSum(1, &coarse_bdr_tdofs, comm);
if (coarse_bdr_tdofs == 0)
{
MPI_Comm split_comm = MPI_COMM_NULL;
int color = (h1_fespaces.GetFESpaceAtLevel(0).GetTrueVSize() > 0) ? 0 : MPI_UNDEFINED;
MPI_Comm_split(comm, color, Mpi::Rank(comm), &split_comm);
if (split_comm != MPI_COMM_NULL && Mpi::Root(split_comm))
int root = (h1_fespaces.GetFESpaceAtLevel(0).GetTrueVSize() == 0) ? Mpi::Size(comm) : Mpi::Rank(comm);
Mpi::GlobalMin(1, &root, comm);
MFEM_VERIFY(root < Mpi::Size(comm), "No root process found for single true dof constraint!");
if (root == Mpi::Rank(comm))
{
aux_tdof_lists.reserve(h1_fespaces.GetNumLevels());
for (std::size_t l = 0; l < h1_fespaces.GetNumLevels(); l++)
Expand All @@ -77,10 +77,6 @@ DivFreeSolver<VecType>::DivFreeSolver(
}
ptr_h1_bdr_tdof_lists = &aux_tdof_lists;
}
if (split_comm != MPI_COMM_NULL)
{
MPI_Comm_free(&split_comm);
}
}
}

Expand Down

0 comments on commit ee3dbd7

Please sign in to comment.