From: Wolfgang Bangerth Date: Sun, 2 Jul 2023 14:36:15 +0000 (-0600) Subject: Direct-initialize matrix from dsp. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97da8d8865fabacb94ff40bd384a0438fb8a7bea;p=dealii.git Direct-initialize matrix from dsp. --- 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),