Skip to content

Commit

Permalink
Use Trilinos sparsity pattern also durin post-processing
Browse files Browse the repository at this point in the history
  • Loading branch information
fdrmrc committed May 24, 2024
1 parent 9229c9f commit 29fa776
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions include/poly_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<is_trilinos_vector,
TrilinosWrappers::SparsityPattern,
DynamicSparsityPattern>
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<types::global_dof_index> agglo_dof_indices(fe.dofs_per_cell);
std::vector<types::global_dof_index> standard_dof_indices(fe.dofs_per_cell);
Expand Down Expand Up @@ -656,16 +662,8 @@ namespace dealii::PolyUtils

if constexpr (std::is_same_v<MatrixType, TrilinosWrappers::SparseMatrix>)
{
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();
}
Expand Down

0 comments on commit 29fa776

Please sign in to comment.