]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Enable MatrixCreator functions also for FullMatrix 16624/head
authorPeter Munch <peterrmuench@gmail.com>
Sat, 10 Feb 2024 11:48:15 +0000 (12:48 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Thu, 4 Apr 2024 19:27:50 +0000 (21:27 +0200)
include/deal.II/numerics/matrix_creator.h
include/deal.II/numerics/matrix_creator.templates.h
source/numerics/solution_transfer.cc

index bf9e6ec86feb319b1d16d9e1cf932f251acc486d..8717d5c2354b8d7855c83cb0a09210feb7bb4d0f 100644 (file)
@@ -75,7 +75,7 @@ namespace hp
  * mapping than a (bi-/tri-)linear one, then you need to call the functions
  * <b>with</b> mapping argument should be used.
  *
- * All functions take a sparse matrix object to hold the matrix to be created.
+ * All functions take a matrix object to hold the matrix to be created.
  * The functions assume that the matrix is initialized with a sparsity pattern
  * (SparsityPattern) corresponding to the given degree of freedom handler,
  * i.e. the sparsity structure is already as needed. You can do this by
@@ -213,32 +213,32 @@ namespace MatrixCreator
    *
    * See the general documentation of this namespace for more information.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
-    const Mapping<dim, spacedim>    &mapping,
-    const DoFHandler<dim, spacedim> &dof,
-    const Quadrature<dim>           &q,
-    SparseMatrixType                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    const Mapping<dim, spacedim>                                    &mapping,
+    const DoFHandler<dim, spacedim>                                 &dof,
+    const Quadrature<dim>                                           &q,
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
   /**
    * Call the create_mass_matrix() function, see above, with
    * <tt>mapping=MappingQ@<dim@>(1)</tt>.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
-    const DoFHandler<dim, spacedim> &dof,
-    const Quadrature<dim>           &q,
-    SparseMatrixType                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    const DoFHandler<dim, spacedim>                                 &dof,
+    const Quadrature<dim>                                           &q,
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
   /**
    * Assemble the @ref GlossMassMatrix "mass matrix" and a right hand side vector. If no coefficient
@@ -259,98 +259,98 @@ namespace MatrixCreator
    *
    * See the general documentation of this namespace for more information.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
     const Mapping<dim, spacedim>                                    &mapping,
     const DoFHandler<dim, spacedim>                                 &dof,
     const Quadrature<dim>                                           &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type>       &rhs,
+    Vector<typename MatrixType::value_type>                         &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
   /**
    * Call the create_mass_matrix() function, see above, with
    * <tt>mapping=MappingQ@<dim@>(1)</tt>.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
     const DoFHandler<dim, spacedim>                                 &dof,
     const Quadrature<dim>                                           &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type>       &rhs,
+    Vector<typename MatrixType::value_type>                         &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
   /**
    * Same function as above, but for hp-objects.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
-    const hp::MappingCollection<dim, spacedim> &mapping,
-    const DoFHandler<dim, spacedim>            &dof,
-    const hp::QCollection<dim>                 &q,
-    SparseMatrixType                           &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    const hp::MappingCollection<dim, spacedim>                      &mapping,
+    const DoFHandler<dim, spacedim>                                 &dof,
+    const hp::QCollection<dim>                                      &q,
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
   /**
    * Same function as above, but for hp-objects.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
-    const DoFHandler<dim, spacedim> &dof,
-    const hp::QCollection<dim>      &q,
-    SparseMatrixType                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    const DoFHandler<dim, spacedim>                                 &dof,
+    const hp::QCollection<dim>                                      &q,
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
   /**
    * Same function as above, but for hp-objects.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
     const hp::MappingCollection<dim, spacedim>                      &mapping,
     const DoFHandler<dim, spacedim>                                 &dof,
     const hp::QCollection<dim>                                      &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type>       &rhs,
+    Vector<typename MatrixType::value_type>                         &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
   /**
    * Same function as above, but for hp-objects.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
     const DoFHandler<dim, spacedim>                                 &dof,
     const hp::QCollection<dim>                                      &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type>       &rhs,
+    Vector<typename MatrixType::value_type>                         &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
 
   /**
@@ -462,32 +462,32 @@ namespace MatrixCreator
    *
    * See the general documentation of this namespace for more information.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
-    const Mapping<dim, spacedim>    &mapping,
-    const DoFHandler<dim, spacedim> &dof,
-    const Quadrature<dim>           &q,
-    SparseMatrixType                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    const Mapping<dim, spacedim>                                    &mapping,
+    const DoFHandler<dim, spacedim>                                 &dof,
+    const Quadrature<dim>                                           &q,
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
   /**
    * Call the create_laplace_matrix() function, see above, with
    * <tt>mapping=MappingQ@<dim@>(1)</tt>.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
-    const DoFHandler<dim, spacedim> &dof,
-    const Quadrature<dim>           &q,
-    SparseMatrixType                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    const DoFHandler<dim, spacedim>                                 &dof,
+    const Quadrature<dim>                                           &q,
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
   /**
    * Assemble the Laplace matrix and a right hand side vector. If no
@@ -507,98 +507,98 @@ namespace MatrixCreator
    *
    * See the general documentation of this namespace for more information.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
     const Mapping<dim, spacedim>                                    &mapping,
     const DoFHandler<dim, spacedim>                                 &dof,
     const Quadrature<dim>                                           &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type>       &rhs,
+    Vector<typename MatrixType::value_type>                         &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
   /**
    * Call the create_laplace_matrix() function, see above, with
    * <tt>mapping=MappingQ@<dim@>(1)</tt>.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
     const DoFHandler<dim, spacedim>                                 &dof,
     const Quadrature<dim>                                           &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type>       &rhs,
+    Vector<typename MatrixType::value_type>                         &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
   /**
    * Like the functions above, but for hp-objects.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
-    const hp::MappingCollection<dim, spacedim> &mapping,
-    const DoFHandler<dim, spacedim>            &dof,
-    const hp::QCollection<dim>                 &q,
-    SparseMatrixType                           &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    const hp::MappingCollection<dim, spacedim>                      &mapping,
+    const DoFHandler<dim, spacedim>                                 &dof,
+    const hp::QCollection<dim>                                      &q,
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
   /**
    * Like the functions above, but for hp-objects.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
-    const DoFHandler<dim, spacedim> &dof,
-    const hp::QCollection<dim>      &q,
-    SparseMatrixType                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    const DoFHandler<dim, spacedim>                                 &dof,
+    const hp::QCollection<dim>                                      &q,
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
   /**
    * Like the functions above, but for hp-objects.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
     const hp::MappingCollection<dim, spacedim>                      &mapping,
     const DoFHandler<dim, spacedim>                                 &dof,
     const hp::QCollection<dim>                                      &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type>       &rhs,
+    Vector<typename MatrixType::value_type>                         &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
   /**
    * Like the functions above, but for hp-objects.
    */
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
     const DoFHandler<dim, spacedim>                                 &dof,
     const hp::QCollection<dim>                                      &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type> *const a =
+    MatrixType                                                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type>       &rhs,
+    Vector<typename MatrixType::value_type>                         &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type> *const a =
       nullptr,
-    const AffineConstraints<typename SparseMatrixType::value_type> &
-      constraints = AffineConstraints<typename SparseMatrixType::value_type>());
+    const AffineConstraints<typename MatrixType::value_type> &constraints =
+      AffineConstraints<typename MatrixType::value_type>());
 
   /**
    * Exception
index d50a9026af1b010d71fdeaf9fb29b2db0d559816..fecebdea7e08ec393ca364b948e946494df7ef44 100644 (file)
@@ -631,22 +631,57 @@ namespace MatrixCreator
 
 
     } // namespace AssemblerBoundary
-  }   // namespace internal
+
+
+
+    template <typename T>
+    using compress_t = decltype(std::declval<T>().compress(
+      std::declval<VectorOperation::values>()));
+
+
+
+    template <typename T>
+    constexpr bool has_compress =
+      dealii::internal::is_supported_operation<compress_t, T>;
+
+
+
+    template <
+      typename MatrixType,
+      std::enable_if_t<has_compress<MatrixType>, MatrixType> * = nullptr>
+    void
+    compress(MatrixType &A, const VectorOperation::values operation)
+    {
+      A.compress(operation);
+    }
+
+
+
+    template <
+      typename MatrixType,
+      std::enable_if_t<!has_compress<MatrixType>, MatrixType> * = nullptr>
+    void
+    compress(MatrixType &, const VectorOperation::values)
+    {
+      // nothing to do
+    }
+
+  } // namespace internal
 } // namespace MatrixCreator
 
 
 namespace MatrixCreator
 {
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
     const Mapping<dim, spacedim>    &mapping,
     const DoFHandler<dim, spacedim> &dof,
     const Quadrature<dim>           &q,
-    SparseMatrixType                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    MatrixType                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     Assert(matrix.m() == dof.n_dofs(),
            ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
@@ -657,7 +692,7 @@ namespace MatrixCreator
     hp::QCollection<dim> q_collection(q);
     hp::MappingCollection<dim, spacedim> mapping_collection(mapping);
     MatrixCreator::internal::AssemblerData::
-      Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+      Scratch<dim, spacedim, typename MatrixType::value_type>
         assembler_data(fe_collection,
                        update_values | update_JxW_values |
                          (coefficient != nullptr ? update_quadrature_points :
@@ -668,7 +703,7 @@ namespace MatrixCreator
                        mapping_collection);
 
     MatrixCreator::internal::AssemblerData::CopyData<
-      typename SparseMatrixType::value_type>
+      typename MatrixType::value_type>
       copy_data;
     copy_data.cell_matrix.reinit(
       assembler_data.fe_collection.max_dofs_per_cell(),
@@ -686,32 +721,32 @@ namespace MatrixCreator
         dim,
         spacedim,
         typename DoFHandler<dim, spacedim>::active_cell_iterator,
-        typename SparseMatrixType::value_type>,
-      [&matrix](const internal::AssemblerData::CopyData<
-                typename SparseMatrixType::value_type> &data) {
+        typename MatrixType::value_type>,
+      [&matrix](
+        const internal::AssemblerData::CopyData<typename MatrixType::value_type>
+          &data) {
         MatrixCreator::internal::copy_local_to_global(
           data,
           &matrix,
-          static_cast<Vector<typename SparseMatrixType::value_type> *>(
-            nullptr));
+          static_cast<Vector<typename MatrixType::value_type> *>(nullptr));
       },
       assembler_data,
       copy_data);
 
-    matrix.compress(VectorOperation::add);
+    internal::compress(matrix, VectorOperation::add);
   }
 
 
 
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
     const DoFHandler<dim, spacedim> &dof,
     const Quadrature<dim>           &q,
-    SparseMatrixType                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    MatrixType                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     create_mass_matrix(get_default_linear_mapping(dof.get_triangulation()),
                        dof,
@@ -723,18 +758,18 @@ namespace MatrixCreator
 
 
 
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
-    const Mapping<dim, spacedim>                                    &mapping,
-    const DoFHandler<dim, spacedim>                                 &dof,
-    const Quadrature<dim>                                           &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    const Mapping<dim, spacedim>                              &mapping,
+    const DoFHandler<dim, spacedim>                           &dof,
+    const Quadrature<dim>                                     &q,
+    MatrixType                                                &matrix,
+    const Function<spacedim, typename MatrixType::value_type> &rhs,
+    Vector<typename MatrixType::value_type>                   &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     Assert(matrix.m() == dof.n_dofs(),
            ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
@@ -745,7 +780,7 @@ namespace MatrixCreator
     hp::QCollection<dim> q_collection(q);
     hp::MappingCollection<dim, spacedim> mapping_collection(mapping);
     MatrixCreator::internal::AssemblerData::
-      Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+      Scratch<dim, spacedim, typename MatrixType::value_type>
         assembler_data(fe_collection,
                        update_values | update_JxW_values |
                          update_quadrature_points,
@@ -754,7 +789,7 @@ namespace MatrixCreator
                        q_collection,
                        mapping_collection);
     MatrixCreator::internal::AssemblerData::CopyData<
-      typename SparseMatrixType::value_type>
+      typename MatrixType::value_type>
       copy_data;
     copy_data.cell_matrix.reinit(
       assembler_data.fe_collection.max_dofs_per_cell(),
@@ -772,9 +807,10 @@ namespace MatrixCreator
         dim,
         spacedim,
         typename DoFHandler<dim, spacedim>::active_cell_iterator,
-        typename SparseMatrixType::value_type>,
-      [&matrix, &rhs_vector](const internal::AssemblerData::CopyData<
-                             typename SparseMatrixType::value_type> &data) {
+        typename MatrixType::value_type>,
+      [&matrix, &rhs_vector](
+        const internal::AssemblerData::CopyData<typename MatrixType::value_type>
+          &data) {
         MatrixCreator::internal::copy_local_to_global(data,
                                                       &matrix,
                                                       &rhs_vector);
@@ -782,22 +818,22 @@ namespace MatrixCreator
       assembler_data,
       copy_data);
 
-    matrix.compress(VectorOperation::add);
+    internal::compress(matrix, VectorOperation::add);
   }
 
 
 
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
-    const DoFHandler<dim, spacedim>                                 &dof,
-    const Quadrature<dim>                                           &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    const DoFHandler<dim, spacedim>                           &dof,
+    const Quadrature<dim>                                     &q,
+    MatrixType                                                &matrix,
+    const Function<spacedim, typename MatrixType::value_type> &rhs,
+    Vector<typename MatrixType::value_type>                   &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     create_mass_matrix(get_default_linear_mapping(dof.get_triangulation()),
                        dof,
@@ -811,16 +847,16 @@ namespace MatrixCreator
 
 
 
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
     const hp::MappingCollection<dim, spacedim> &mapping,
     const DoFHandler<dim, spacedim>            &dof,
     const hp::QCollection<dim>                 &q,
-    SparseMatrixType                           &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    MatrixType                                 &matrix,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     Assert(matrix.m() == dof.n_dofs(),
            ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
@@ -828,7 +864,7 @@ namespace MatrixCreator
            ExcDimensionMismatch(matrix.n(), dof.n_dofs()));
 
     MatrixCreator::internal::AssemblerData::
-      Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+      Scratch<dim, spacedim, typename MatrixType::value_type>
         assembler_data(dof.get_fe_collection(),
                        update_values | update_JxW_values |
                          (coefficient != nullptr ? update_quadrature_points :
@@ -838,7 +874,7 @@ namespace MatrixCreator
                        q,
                        mapping);
     MatrixCreator::internal::AssemblerData::CopyData<
-      typename SparseMatrixType::value_type>
+      typename MatrixType::value_type>
       copy_data;
     copy_data.cell_matrix.reinit(
       assembler_data.fe_collection.max_dofs_per_cell(),
@@ -856,32 +892,32 @@ namespace MatrixCreator
         dim,
         spacedim,
         typename DoFHandler<dim, spacedim>::active_cell_iterator,
-        typename SparseMatrixType::value_type>,
-      [&matrix](const internal::AssemblerData::CopyData<
-                typename SparseMatrixType::value_type> &data) {
+        typename MatrixType::value_type>,
+      [&matrix](
+        const internal::AssemblerData::CopyData<typename MatrixType::value_type>
+          &data) {
         MatrixCreator::internal::copy_local_to_global(
           data,
           &matrix,
-          static_cast<Vector<typename SparseMatrixType::value_type> *>(
-            nullptr));
+          static_cast<Vector<typename MatrixType::value_type> *>(nullptr));
       },
       assembler_data,
       copy_data);
 
-    matrix.compress(VectorOperation::add);
+    internal::compress(matrix, VectorOperation::add);
   }
 
 
 
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
     const DoFHandler<dim, spacedim> &dof,
     const hp::QCollection<dim>      &q,
-    SparseMatrixType                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    MatrixType                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     create_mass_matrix(hp::StaticMappingQ1<dim, spacedim>::mapping_collection,
                        dof,
@@ -893,18 +929,18 @@ namespace MatrixCreator
 
 
 
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
-    const hp::MappingCollection<dim, spacedim>                      &mapping,
-    const DoFHandler<dim, spacedim>                                 &dof,
-    const hp::QCollection<dim>                                      &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    const hp::MappingCollection<dim, spacedim>                &mapping,
+    const DoFHandler<dim, spacedim>                           &dof,
+    const hp::QCollection<dim>                                &q,
+    MatrixType                                                &matrix,
+    const Function<spacedim, typename MatrixType::value_type> &rhs,
+    Vector<typename MatrixType::value_type>                   &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     Assert(matrix.m() == dof.n_dofs(),
            ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
@@ -912,7 +948,7 @@ namespace MatrixCreator
            ExcDimensionMismatch(matrix.n(), dof.n_dofs()));
 
     MatrixCreator::internal::AssemblerData::
-      Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+      Scratch<dim, spacedim, typename MatrixType::value_type>
         assembler_data(dof.get_fe_collection(),
                        update_values | update_JxW_values |
                          update_quadrature_points,
@@ -921,7 +957,7 @@ namespace MatrixCreator
                        q,
                        mapping);
     MatrixCreator::internal::AssemblerData::CopyData<
-      typename SparseMatrixType::value_type>
+      typename MatrixType::value_type>
       copy_data;
     copy_data.cell_matrix.reinit(
       assembler_data.fe_collection.max_dofs_per_cell(),
@@ -939,9 +975,10 @@ namespace MatrixCreator
         dim,
         spacedim,
         typename DoFHandler<dim, spacedim>::active_cell_iterator,
-        typename SparseMatrixType::value_type>,
-      [&matrix, &rhs_vector](const internal::AssemblerData::CopyData<
-                             typename SparseMatrixType::value_type> &data) {
+        typename MatrixType::value_type>,
+      [&matrix, &rhs_vector](
+        const internal::AssemblerData::CopyData<typename MatrixType::value_type>
+          &data) {
         MatrixCreator::internal::copy_local_to_global(data,
                                                       &matrix,
                                                       &rhs_vector);
@@ -949,22 +986,22 @@ namespace MatrixCreator
       assembler_data,
       copy_data);
 
-    matrix.compress(VectorOperation::add);
+    internal::compress(matrix, VectorOperation::add);
   }
 
 
 
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_mass_matrix(
-    const DoFHandler<dim, spacedim>                                 &dof,
-    const hp::QCollection<dim>                                      &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    const DoFHandler<dim, spacedim>                           &dof,
+    const hp::QCollection<dim>                                &q,
+    MatrixType                                                &matrix,
+    const Function<spacedim, typename MatrixType::value_type> &rhs,
+    Vector<typename MatrixType::value_type>                   &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     create_mass_matrix(hp::StaticMappingQ1<dim, spacedim>::mapping_collection,
                        dof,
@@ -1920,16 +1957,16 @@ namespace MatrixCreator
 
 
 
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
     const Mapping<dim, spacedim>    &mapping,
     const DoFHandler<dim, spacedim> &dof,
     const Quadrature<dim>           &q,
-    SparseMatrixType                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    MatrixType                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     Assert(matrix.m() == dof.n_dofs(),
            ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
@@ -1940,7 +1977,7 @@ namespace MatrixCreator
     hp::QCollection<dim> q_collection(q);
     hp::MappingCollection<dim, spacedim> mapping_collection(mapping);
     MatrixCreator::internal::AssemblerData::
-      Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+      Scratch<dim, spacedim, typename MatrixType::value_type>
         assembler_data(fe_collection,
                        update_gradients | update_JxW_values |
                          (coefficient != nullptr ? update_quadrature_points :
@@ -1950,7 +1987,7 @@ namespace MatrixCreator
                        q_collection,
                        mapping_collection);
     MatrixCreator::internal::AssemblerData::CopyData<
-      typename SparseMatrixType::value_type>
+      typename MatrixType::value_type>
       copy_data;
     copy_data.cell_matrix.reinit(
       assembler_data.fe_collection.max_dofs_per_cell(),
@@ -1968,32 +2005,32 @@ namespace MatrixCreator
         dim,
         spacedim,
         typename DoFHandler<dim, spacedim>::active_cell_iterator,
-        typename SparseMatrixType::value_type>,
-      [&matrix](const internal::AssemblerData::CopyData<
-                typename SparseMatrixType::value_type> &data) {
+        typename MatrixType::value_type>,
+      [&matrix](
+        const internal::AssemblerData::CopyData<typename MatrixType::value_type>
+          &data) {
         MatrixCreator::internal::copy_local_to_global(
           data,
           &matrix,
-          static_cast<Vector<typename SparseMatrixType::value_type> *>(
-            nullptr));
+          static_cast<Vector<typename MatrixType::value_type> *>(nullptr));
       },
       assembler_data,
       copy_data);
 
-    matrix.compress(VectorOperation::add);
+    internal::compress(matrix, VectorOperation::add);
   }
 
 
 
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
     const DoFHandler<dim, spacedim> &dof,
     const Quadrature<dim>           &q,
-    SparseMatrixType                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    MatrixType                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     create_laplace_matrix(get_default_linear_mapping(dof.get_triangulation()),
                           dof,
@@ -2005,18 +2042,18 @@ namespace MatrixCreator
 
 
 
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
-    const Mapping<dim, spacedim>                                    &mapping,
-    const DoFHandler<dim, spacedim>                                 &dof,
-    const Quadrature<dim>                                           &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    const Mapping<dim, spacedim>                              &mapping,
+    const DoFHandler<dim, spacedim>                           &dof,
+    const Quadrature<dim>                                     &q,
+    MatrixType                                                &matrix,
+    const Function<spacedim, typename MatrixType::value_type> &rhs,
+    Vector<typename MatrixType::value_type>                   &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     Assert(matrix.m() == dof.n_dofs(),
            ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
@@ -2027,7 +2064,7 @@ namespace MatrixCreator
     hp::QCollection<dim> q_collection(q);
     hp::MappingCollection<dim, spacedim> mapping_collection(mapping);
     MatrixCreator::internal::AssemblerData::
-      Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+      Scratch<dim, spacedim, typename MatrixType::value_type>
         assembler_data(fe_collection,
                        update_gradients | update_values | update_JxW_values |
                          update_quadrature_points,
@@ -2036,7 +2073,7 @@ namespace MatrixCreator
                        q_collection,
                        mapping_collection);
     MatrixCreator::internal::AssemblerData::CopyData<
-      typename SparseMatrixType::value_type>
+      typename MatrixType::value_type>
       copy_data;
     copy_data.cell_matrix.reinit(
       assembler_data.fe_collection.max_dofs_per_cell(),
@@ -2054,9 +2091,10 @@ namespace MatrixCreator
         dim,
         spacedim,
         typename DoFHandler<dim, spacedim>::active_cell_iterator,
-        typename SparseMatrixType::value_type>,
-      [&matrix, &rhs_vector](const internal::AssemblerData::CopyData<
-                             typename SparseMatrixType::value_type> &data) {
+        typename MatrixType::value_type>,
+      [&matrix, &rhs_vector](
+        const internal::AssemblerData::CopyData<typename MatrixType::value_type>
+          &data) {
         MatrixCreator::internal::copy_local_to_global(data,
                                                       &matrix,
                                                       &rhs_vector);
@@ -2064,22 +2102,22 @@ namespace MatrixCreator
       assembler_data,
       copy_data);
 
-    matrix.compress(VectorOperation::add);
+    internal::compress(matrix, VectorOperation::add);
   }
 
 
 
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
-    const DoFHandler<dim, spacedim>                                 &dof,
-    const Quadrature<dim>                                           &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    const DoFHandler<dim, spacedim>                           &dof,
+    const Quadrature<dim>                                     &q,
+    MatrixType                                                &matrix,
+    const Function<spacedim, typename MatrixType::value_type> &rhs,
+    Vector<typename MatrixType::value_type>                   &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     create_laplace_matrix(get_default_linear_mapping(dof.get_triangulation()),
                           dof,
@@ -2093,16 +2131,16 @@ namespace MatrixCreator
 
 
 
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
     const hp::MappingCollection<dim, spacedim> &mapping,
     const DoFHandler<dim, spacedim>            &dof,
     const hp::QCollection<dim>                 &q,
-    SparseMatrixType                           &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    MatrixType                                 &matrix,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     Assert(matrix.m() == dof.n_dofs(),
            ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
@@ -2110,7 +2148,7 @@ namespace MatrixCreator
            ExcDimensionMismatch(matrix.n(), dof.n_dofs()));
 
     MatrixCreator::internal::AssemblerData::
-      Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+      Scratch<dim, spacedim, typename MatrixType::value_type>
         assembler_data(dof.get_fe_collection(),
                        update_gradients | update_JxW_values |
                          (coefficient != nullptr ? update_quadrature_points :
@@ -2120,7 +2158,7 @@ namespace MatrixCreator
                        q,
                        mapping);
     MatrixCreator::internal::AssemblerData::CopyData<
-      typename SparseMatrixType::value_type>
+      typename MatrixType::value_type>
       copy_data;
     copy_data.cell_matrix.reinit(
       assembler_data.fe_collection.max_dofs_per_cell(),
@@ -2138,14 +2176,14 @@ namespace MatrixCreator
         dim,
         spacedim,
         typename DoFHandler<dim, spacedim>::active_cell_iterator,
-        typename SparseMatrixType::value_type>,
-      [&matrix](const internal::AssemblerData::CopyData<
-                typename SparseMatrixType::value_type> &data) {
+        typename MatrixType::value_type>,
+      [&matrix](
+        const internal::AssemblerData::CopyData<typename MatrixType::value_type>
+          &data) {
         MatrixCreator::internal::copy_local_to_global(
           data,
           &matrix,
-          static_cast<Vector<typename SparseMatrixType::value_type> *>(
-            nullptr));
+          static_cast<Vector<typename MatrixType::value_type> *>(nullptr));
       },
       assembler_data,
       copy_data);
@@ -2155,15 +2193,15 @@ namespace MatrixCreator
 
 
 
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
     const DoFHandler<dim, spacedim> &dof,
     const hp::QCollection<dim>      &q,
-    SparseMatrixType                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    MatrixType                      &matrix,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     create_laplace_matrix(
       hp::StaticMappingQ1<dim, spacedim>::mapping_collection,
@@ -2176,18 +2214,18 @@ namespace MatrixCreator
 
 
 
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
-    const hp::MappingCollection<dim, spacedim>                      &mapping,
-    const DoFHandler<dim, spacedim>                                 &dof,
-    const hp::QCollection<dim>                                      &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    const hp::MappingCollection<dim, spacedim>                &mapping,
+    const DoFHandler<dim, spacedim>                           &dof,
+    const hp::QCollection<dim>                                &q,
+    MatrixType                                                &matrix,
+    const Function<spacedim, typename MatrixType::value_type> &rhs,
+    Vector<typename MatrixType::value_type>                   &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     Assert(matrix.m() == dof.n_dofs(),
            ExcDimensionMismatch(matrix.m(), dof.n_dofs()));
@@ -2195,7 +2233,7 @@ namespace MatrixCreator
            ExcDimensionMismatch(matrix.n(), dof.n_dofs()));
 
     MatrixCreator::internal::AssemblerData::
-      Scratch<dim, spacedim, typename SparseMatrixType::value_type>
+      Scratch<dim, spacedim, typename MatrixType::value_type>
         assembler_data(dof.get_fe_collection(),
                        update_gradients | update_values | update_JxW_values |
                          update_quadrature_points,
@@ -2204,7 +2242,7 @@ namespace MatrixCreator
                        q,
                        mapping);
     MatrixCreator::internal::AssemblerData::CopyData<
-      typename SparseMatrixType::value_type>
+      typename MatrixType::value_type>
       copy_data;
     copy_data.cell_matrix.reinit(
       assembler_data.fe_collection.max_dofs_per_cell(),
@@ -2222,9 +2260,10 @@ namespace MatrixCreator
         dim,
         spacedim,
         typename DoFHandler<dim, spacedim>::active_cell_iterator,
-        typename SparseMatrixType::value_type>,
-      [&matrix, &rhs_vector](const internal::AssemblerData::CopyData<
-                             typename SparseMatrixType::value_type> &data) {
+        typename MatrixType::value_type>,
+      [&matrix, &rhs_vector](
+        const internal::AssemblerData::CopyData<typename MatrixType::value_type>
+          &data) {
         MatrixCreator::internal::copy_local_to_global(data,
                                                       &matrix,
                                                       &rhs_vector);
@@ -2237,17 +2276,17 @@ namespace MatrixCreator
 
 
 
-  template <int dim, int spacedim, typename SparseMatrixType>
+  template <int dim, int spacedim, typename MatrixType>
   void
   create_laplace_matrix(
-    const DoFHandler<dim, spacedim>                                 &dof,
-    const hp::QCollection<dim>                                      &q,
-    SparseMatrixType                                                &matrix,
-    const Function<spacedim, typename SparseMatrixType::value_type> &rhs,
-    Vector<typename SparseMatrixType::value_type>                   &rhs_vector,
-    const Function<spacedim, typename SparseMatrixType::value_type>
-      *const                                                        coefficient,
-    const AffineConstraints<typename SparseMatrixType::value_type> &constraints)
+    const DoFHandler<dim, spacedim>                           &dof,
+    const hp::QCollection<dim>                                &q,
+    MatrixType                                                &matrix,
+    const Function<spacedim, typename MatrixType::value_type> &rhs,
+    Vector<typename MatrixType::value_type>                   &rhs_vector,
+    const Function<spacedim, typename MatrixType::value_type>
+      *const                                                  coefficient,
+    const AffineConstraints<typename MatrixType::value_type> &constraints)
   {
     create_laplace_matrix(
       hp::StaticMappingQ1<dim, spacedim>::mapping_collection,
index 81c87c503e26d43c361735091c74f57271bf8815..9ddf9c72c4f04bb304321c05b54e875659501bfc 100644 (file)
@@ -585,7 +585,16 @@ SolutionTransfer<dim, VectorType, spacedim>::interpolate(
   // We have written into the output vectors. If this was a PETSc vector, for
   // example, then we need to compress these to make future operations safe:
   for (auto &vec : all_out)
-    vec.compress(VectorOperation::insert);
+    {
+      if constexpr (std::is_same<VectorType,
+                                 LinearAlgebra::distributed::Vector<
+                                   typename VectorType::value_type>>::value)
+        for (unsigned int i = 0; i < vec.size(); ++i)
+          std::cout << vec[i] << " ";
+      std::cout << std::endl;
+
+      vec.compress(VectorOperation::insert);
+    }
 }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.