diff --git a/include/poly_utils.h b/include/poly_utils.h index 106f1517..7e32e624 100644 --- a/include/poly_utils.h +++ b/include/poly_utils.h @@ -552,16 +552,22 @@ namespace dealii::PolyUtils output_dh->reinit(tria); output_dh->distribute_dofs(fe); - const IndexSet &locally_owned_dofs = output_dh->locally_owned_dofs(); - const IndexSet locally_relevant_dofs = - DoFTools::extract_locally_relevant_dofs(*output_dh); - + const IndexSet &locally_owned_dofs = output_dh->locally_owned_dofs(); const IndexSet &locally_owned_dofs_agglo = agglo_dh.locally_owned_dofs(); + std::conditional_t + dsp; - DynamicSparsityPattern dsp(output_dh->n_dofs(), - agglo_dh.n_dofs(), - output_dh->locally_owned_dofs()); + if constexpr (is_trilinos_vector) + dsp.reinit(locally_owned_dofs, + locally_owned_dofs_agglo, + tria.get_communicator()); + else + dsp.reinit(output_dh->n_dofs(), + agglo_dh.n_dofs(), + output_dh->locally_owned_dofs()); std::vector agglo_dof_indices(fe.dofs_per_cell); std::vector standard_dof_indices(fe.dofs_per_cell); @@ -656,16 +662,8 @@ namespace dealii::PolyUtils if constexpr (std::is_same_v) { - const MPI_Comm &communicator = tria.get_communicator(); - SparsityTools::distribute_sparsity_pattern(dsp, - locally_owned_dofs, - communicator, - locally_relevant_dofs); - - interpolation_matrix.reinit(locally_owned_dofs, - locally_owned_dofs_agglo, - dsp, - communicator); + dsp.compress(); + interpolation_matrix.reinit(dsp); dst.reinit(locally_owned_dofs); assemble_interpolation_matrix(); }