From 97da8d8865fabacb94ff40bd384a0438fb8a7bea Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 2 Jul 2023 08:36:15 -0600 Subject: [PATCH] Direct-initialize matrix from dsp. --- examples/step-86/step-86.cc | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/examples/step-86/step-86.cc b/examples/step-86/step-86.cc index bad3e2f879..6981ae53d4 100644 --- a/examples/step-86/step-86.cc +++ b/examples/step-86/step-86.cc @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -74,7 +73,6 @@ namespace Step86 AffineConstraints constraints; - SparsityPattern sparsity_pattern; PETScWrappers::MPI::SparseMatrix mass_matrix; PETScWrappers::MPI::SparseMatrix laplace_matrix; PETScWrappers::MPI::SparseMatrix system_matrix; @@ -195,17 +193,11 @@ namespace Step86 dsp, constraints, /*keep_constrained_dofs = */ true); - sparsity_pattern.copy_from(dsp); - - mass_matrix.reinit(dof_handler.locally_owned_dofs(), - sparsity_pattern, - MPI_COMM_SELF); - laplace_matrix.reinit(dof_handler.locally_owned_dofs(), - sparsity_pattern, - MPI_COMM_SELF); - system_matrix.reinit(dof_handler.locally_owned_dofs(), - sparsity_pattern, - MPI_COMM_SELF); + + // directly initialize from dsp, no need for the regular sparsity pattern: + mass_matrix.reinit(dof_handler.locally_owned_dofs(), dsp, MPI_COMM_SELF); + laplace_matrix.reinit(dof_handler.locally_owned_dofs(), dsp, MPI_COMM_SELF); + system_matrix.reinit(dof_handler.locally_owned_dofs(), dsp, MPI_COMM_SELF); MatrixCreator::create_mass_matrix(dof_handler, QGauss(fe.degree + 1), -- 2.39.5