]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Exchange NodeType with MemorySpace 16288/head
authorSebastian Kinnewig <sebastian@kinnewig.org>
Tue, 9 Jan 2024 18:45:35 +0000 (19:45 +0100)
committerSebastian Kinnewig <sebastian@kinnewig.org>
Tue, 9 Jan 2024 18:57:38 +0000 (19:57 +0100)
include/deal.II/base/template_constraints.h
include/deal.II/lac/trilinos_tpetra_sparse_matrix.h
include/deal.II/lac/trilinos_tpetra_sparse_matrix.templates.h
include/deal.II/lac/trilinos_tpetra_sparsity_pattern.h
source/lac/trilinos_tpetra_sparsity_pattern.cc

index ba3f8fb1e8ffac142e95c035ada5c7dcb07b0c86..8f5374df5b1a3000a6690ee3ad1b5d716ed79be4 100644 (file)
@@ -671,7 +671,7 @@ namespace LinearAlgebra
     template <typename Number>
     class Vector;
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     class SparseMatrix;
   } // namespace TpetraWrappers
 #  endif
index ce4acdc172b3e0d2f86c04fd639cb82dcfccf71e..6af4632bbfa71d91189b4f746748efc2625fd2d3 100644 (file)
@@ -40,7 +40,7 @@ namespace LinearAlgebra
 {
   namespace TpetraWrappers
   {
-    template <typename NodeType>
+    template <typename MemorySpace>
     class SparsityPattern;
   } // namespace TpetraWrappers
 } // namespace LinearAlgebra
@@ -89,9 +89,7 @@ namespace LinearAlgebra
      * SparseMatrix::resume_fill() first. Once you finish modifying
      * the matrix, you must call SparseMatrix::compress() again.
      */
-    template <typename Number,
-              typename NodeType =
-                Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
+    template <typename Number, typename MemorySpace = dealii::MemorySpace::Host>
     class SparseMatrix : public Subscriptor
     {
     public:
@@ -106,22 +104,33 @@ namespace LinearAlgebra
        */
       using value_type = Number;
 
+      /**
+       * Typedef for the NodeType
+       */
+      using NodeType = Tpetra::KokkosCompat::KokkosDeviceWrapperNode<
+        typename MemorySpace::kokkos_space::execution_space,
+        typename MemorySpace::kokkos_space>;
+
       /**
        * Typedef for Tpetra::CrsMatrix
        */
       using MatrixType =
-        Tpetra::CrsMatrix<Number, int, dealii::types::signed_global_dof_index>;
+        Tpetra::CrsMatrix<Number,
+                          int,
+                          dealii::types::signed_global_dof_index,
+                          NodeType>;
 
       /**
        * Typedef for Tpetra::Map
        */
-      using MapType = Tpetra::Map<int, dealii::types::signed_global_dof_index>;
+      using MapType =
+        Tpetra::Map<int, dealii::types::signed_global_dof_index, NodeType>;
 
       /**
        * Typedef for Tpetra::CrsGraph
        */
       using GraphType =
-        Tpetra::CrsGraph<int, dealii::types::signed_global_dof_index>;
+        Tpetra::CrsGraph<int, dealii::types::signed_global_dof_index, NodeType>;
 
       /**
        * @name Constructors and initialization.
@@ -135,30 +144,30 @@ namespace LinearAlgebra
       /**
        * Generate a matrix from a TpetraWrappers::SparsityPattern object.
        */
-      SparseMatrix(const SparsityPattern<NodeType> &sparsity_pattern);
+      SparseMatrix(const SparsityPattern<MemorySpace> &sparsity_pattern);
 
       /**
        * Move constructor. Create a new sparse matrix by stealing the internal
        * data of the `other` object.
        */
-      SparseMatrix(SparseMatrix<Number, NodeType> &&other) noexcept;
+      SparseMatrix(SparseMatrix<Number, MemorySpace> &&other) noexcept;
 
       /**
        * Copy constructor is deleted.
        */
-      SparseMatrix(const SparseMatrix<Number, NodeType> &) = delete;
+      SparseMatrix(const SparseMatrix<Number, MemorySpace> &) = delete;
 
       /**
        * operator= is deleted.
        */
-      SparseMatrix<Number, NodeType> &
-      operator=(const SparseMatrix<Number, NodeType> &) = delete;
+      SparseMatrix<Number, MemorySpace> &
+      operator=(const SparseMatrix<Number, MemorySpace> &) = delete;
 
       /**
        * Move assignment operator.
        */
-      SparseMatrix<Number, NodeType> &
-      operator=(SparseMatrix<Number, NodeType> &&other) noexcept;
+      SparseMatrix<Number, MemorySpace> &
+      operator=(SparseMatrix<Number, MemorySpace> &&other) noexcept;
 
       /**
        * Destructor. Made virtual so that one can use pointers to objects of
@@ -195,7 +204,7 @@ namespace LinearAlgebra
        * processors in order to avoid a dead lock.
        */
       void
-      reinit(const SparsityPattern<NodeType> &sparsity_pattern);
+      reinit(const SparsityPattern<MemorySpace> &sparsity_pattern);
       /** @} */
 
       /**
@@ -401,9 +410,9 @@ namespace LinearAlgebra
 
       /**
        * Add @p value to the element (<i>i,j</i>).
-       * Just as the respective call in deal.II SparseMatrix<Number, NodeType>
-       * class. Moreover, if <tt>value</tt> is not a finite number an exception
-       * is thrown.
+       * Just as the respective call in deal.II SparseMatrix<Number,
+       * MemorySpace> class. Moreover, if <tt>value</tt> is not a finite number
+       * an exception is thrown.
        *
        * @note When add is called on a compressed matrix, the matrix is set
        * back to an uncompressed state.
@@ -414,12 +423,12 @@ namespace LinearAlgebra
       /**
        * Add an array of values given by <tt>values</tt> in the given global
        * matrix row at columns specified by col_indices in the sparse matrix.
-       * Just as the respective call in deal.II SparseMatrix<Number, NodeType>
-       * class. The optional parameter <tt>elide_zero_values</tt> can be used to
-       * specify whether zero values should be added anyway or these should be
-       * filtered away and only non-zero data is added.
-       * The default value is <tt>true</tt>, i.e., zero values won't be added
-       * into the matrix.
+       * Just as the respective call in deal.II SparseMatrix<Number,
+       * MemorySpace> class. The optional parameter <tt>elide_zero_values</tt>
+       * can be used to specify whether zero values should be added anyway or
+       * these should be filtered away and only non-zero data is added. The
+       * default value is <tt>true</tt>, i.e., zero values won't be added into
+       * the matrix.
        *
        * @note When add is called on a compressed matrix, the matrix is set
        * back to an uncompressed state.
@@ -653,29 +662,29 @@ namespace LinearAlgebra
 
     /* ------------------------- Inline functions ---------------------- */
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     inline void
-    SparseMatrix<Number, NodeType>::add(const size_type      i,
-                                        const size_type      j,
-                                        const TrilinosScalar value)
+    SparseMatrix<Number, MemorySpace>::add(const size_type      i,
+                                           const size_type      j,
+                                           const TrilinosScalar value)
     {
       add(i, 1, &j, &value, false);
     }
 
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     inline dealii::types::signed_global_dof_index
-    SparseMatrix<Number, NodeType>::m() const
+    SparseMatrix<Number, MemorySpace>::m() const
     {
       return matrix->getRowMap()->getGlobalNumElements();
     }
 
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     inline dealii::types::signed_global_dof_index
-    SparseMatrix<Number, NodeType>::n() const
+    SparseMatrix<Number, MemorySpace>::n() const
     {
       // If the matrix structure has not been fixed (i.e., we did not have a
       // sparsity pattern), it does not know about the number of columns, so we
@@ -686,48 +695,61 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     inline bool
-    SparseMatrix<Number, NodeType>::is_compressed() const
+    SparseMatrix<Number, MemorySpace>::is_compressed() const
     {
       return compressed;
     }
 
 
 
-    template <typename Number, typename NodeType>
-    inline const Tpetra::
-      CrsMatrix<Number, int, types::signed_global_dof_index> &
-      SparseMatrix<Number, NodeType>::trilinos_matrix() const
+    template <typename Number, typename MemorySpace>
+    inline const Tpetra::CrsMatrix<
+      Number,
+      int,
+      types::signed_global_dof_index,
+      typename SparseMatrix<Number, MemorySpace>::NodeType> &
+    SparseMatrix<Number, MemorySpace>::trilinos_matrix() const
     {
       return *matrix;
     }
 
 
 
-    template <typename Number, typename NodeType>
-    inline Tpetra::CrsMatrix<Number, int, types::signed_global_dof_index> &
-    SparseMatrix<Number, NodeType>::trilinos_matrix()
+    template <typename Number, typename MemorySpace>
+    inline Tpetra::CrsMatrix<
+      Number,
+      int,
+      types::signed_global_dof_index,
+      typename SparseMatrix<Number, MemorySpace>::NodeType> &
+    SparseMatrix<Number, MemorySpace>::trilinos_matrix()
     {
       return *matrix;
     }
 
 
 
-    template <typename Number, typename NodeType>
-    inline Teuchos::RCP<
-      const Tpetra::CrsMatrix<Number, int, types::signed_global_dof_index>>
-    SparseMatrix<Number, NodeType>::trilinos_rcp() const
+    template <typename Number, typename MemorySpace>
+    inline Teuchos::RCP<const Tpetra::CrsMatrix<
+      Number,
+      int,
+      types::signed_global_dof_index,
+      typename SparseMatrix<Number, MemorySpace>::NodeType>>
+    SparseMatrix<Number, MemorySpace>::trilinos_rcp() const
     {
       return matrix.getConst();
     }
 
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     inline Teuchos::RCP<
-      Tpetra::CrsMatrix<Number, int, types::signed_global_dof_index>>
-    SparseMatrix<Number, NodeType>::trilinos_rcp()
+      Tpetra::CrsMatrix<Number,
+                        int,
+                        types::signed_global_dof_index,
+                        typename SparseMatrix<Number, MemorySpace>::NodeType>>
+    SparseMatrix<Number, MemorySpace>::trilinos_rcp()
     {
       return matrix;
     }
index ddbde983fc3ce95c9cc24cc311da3c3176935072..e3f709d5b1bacd5a0973e1d41339aa685ad81796 100644 (file)
@@ -184,8 +184,8 @@ namespace LinearAlgebra
     // Actually, it does not even matter how many threads there are, but
     // only if we use an MPI compiler or a standard compiler. So, even one
     // thread on a configuration with MPI will still get a parallel interface.
-    template <typename Number, typename NodeType>
-    SparseMatrix<Number, NodeType>::SparseMatrix()
+    template <typename Number, typename MemorySpace>
+    SparseMatrix<Number, MemorySpace>::SparseMatrix()
       : column_space_map(Utilities::Trilinos::internal::make_rcp<MapType>(
           0,
           0,
@@ -206,9 +206,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
-    SparseMatrix<Number, NodeType>::SparseMatrix(
-      const SparsityPattern<NodeType> &sparsity_pattern)
+    template <typename Number, typename MemorySpace>
+    SparseMatrix<Number, MemorySpace>::SparseMatrix(
+      const SparsityPattern<MemorySpace> &sparsity_pattern)
       : matrix(Utilities::Trilinos::internal::make_rcp<MatrixType>(
           sparsity_pattern.trilinos_sparsity_pattern()))
     {
@@ -220,9 +220,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
-    SparseMatrix<Number, NodeType>::SparseMatrix(
-      SparseMatrix<Number, NodeType> &&other) noexcept
+    template <typename Number, typename MemorySpace>
+    SparseMatrix<Number, MemorySpace>::SparseMatrix(
+      SparseMatrix<Number, MemorySpace> &&other) noexcept
       : column_space_map(std::move(other.column_space_map))
       , matrix(std::move(other.matrix))
       , compressed(std::move(other.compressed))
@@ -232,10 +232,10 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
-    SparseMatrix<Number, NodeType> &
-    SparseMatrix<Number, NodeType>::operator=(
-      SparseMatrix<Number, NodeType> &&other) noexcept
+    template <typename Number, typename MemorySpace>
+    SparseMatrix<Number, MemorySpace> &
+    SparseMatrix<Number, MemorySpace>::operator=(
+      SparseMatrix<Number, MemorySpace> &&other) noexcept
     {
       column_space_map = std::move(other.column_space_map);
       matrix           = std::move(other.matrix);
@@ -246,10 +246,10 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     template <typename SparsityPatternType>
     void
-    SparseMatrix<Number, NodeType>::reinit(
+    SparseMatrix<Number, MemorySpace>::reinit(
       const SparsityPatternType &sparsity_pattern)
     {
       reinit_matrix<Number, NodeType, SparsityPatternType>(
@@ -267,10 +267,10 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     void
-    SparseMatrix<Number, NodeType>::reinit(
-      const SparsityPattern<NodeType> &sparsity_pattern)
+    SparseMatrix<Number, MemorySpace>::reinit(
+      const SparsityPattern<MemorySpace> &sparsity_pattern)
     {
       column_space_map.reset();
       matrix.reset();
@@ -289,8 +289,8 @@ namespace LinearAlgebra
 
     // Constructors and initialization using an IndexSet description:
 
-    template <typename Number, typename NodeType>
-    SparseMatrix<Number, NodeType>::SparseMatrix(
+    template <typename Number, typename MemorySpace>
+    SparseMatrix<Number, MemorySpace>::SparseMatrix(
       const IndexSet    &parallel_partitioning,
       const MPI_Comm     communicator,
       const unsigned int n_max_entries_per_row)
@@ -304,8 +304,8 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
-    SparseMatrix<Number, NodeType>::SparseMatrix(
+    template <typename Number, typename MemorySpace>
+    SparseMatrix<Number, MemorySpace>::SparseMatrix(
       const IndexSet                  &parallel_partitioning,
       const MPI_Comm                   communicator,
       const std::vector<unsigned int> &n_entries_per_row)
@@ -321,8 +321,8 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
-    SparseMatrix<Number, NodeType>::SparseMatrix(
+    template <typename Number, typename MemorySpace>
+    SparseMatrix<Number, MemorySpace>::SparseMatrix(
       const IndexSet &row_parallel_partitioning,
       const IndexSet &col_parallel_partitioning,
       const MPI_Comm  communicator,
@@ -337,8 +337,8 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
-    SparseMatrix<Number, NodeType>::SparseMatrix(
+    template <typename Number, typename MemorySpace>
+    SparseMatrix<Number, MemorySpace>::SparseMatrix(
       const IndexSet                  &row_parallel_partitioning,
       const IndexSet                  &col_parallel_partitioning,
       const MPI_Comm                   communicator,
@@ -356,10 +356,10 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     template <typename SparsityPatternType>
     inline void
-    SparseMatrix<Number, NodeType>::reinit(
+    SparseMatrix<Number, MemorySpace>::reinit(
       const IndexSet            &parallel_partitioning,
       const SparsityPatternType &sparsity_pattern,
       const MPI_Comm             communicator,
@@ -374,10 +374,10 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     template <typename SparsityPatternType>
     void
-    SparseMatrix<Number, NodeType>::reinit(
+    SparseMatrix<Number, MemorySpace>::reinit(
       const IndexSet &row_parallel_partitioning,
 
       const IndexSet            &col_parallel_partitioning,
@@ -402,19 +402,19 @@ namespace LinearAlgebra
 
     // Information on the matrix
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     inline unsigned int
-    SparseMatrix<Number, NodeType>::local_size() const
+    SparseMatrix<Number, MemorySpace>::local_size() const
     {
       return matrix->getLocalNumRows();
     }
 
 
 
-    template <typename Number, typename NodeType>
-    inline std::pair<typename SparseMatrix<Number, NodeType>::size_type,
-                     typename SparseMatrix<Number, NodeType>::size_type>
-    SparseMatrix<Number, NodeType>::local_range() const
+    template <typename Number, typename MemorySpace>
+    inline std::pair<typename SparseMatrix<Number, MemorySpace>::size_type,
+                     typename SparseMatrix<Number, MemorySpace>::size_type>
+    SparseMatrix<Number, MemorySpace>::local_range() const
     {
       size_type begin, end;
       begin = matrix->getRowMap()->getMinLocalIndex();
@@ -425,18 +425,18 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     inline size_t
-    SparseMatrix<Number, NodeType>::n_nonzero_elements() const
+    SparseMatrix<Number, MemorySpace>::n_nonzero_elements() const
     {
       return matrix->getGlobalNumEntries();
     }
 
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     MPI_Comm
-    SparseMatrix<Number, NodeType>::get_mpi_communicator() const
+    SparseMatrix<Number, MemorySpace>::get_mpi_communicator() const
     {
       return Utilities::Trilinos::teuchos_comm_to_mpi_comm(matrix->getComm());
     }
@@ -445,9 +445,9 @@ namespace LinearAlgebra
 
     // Modifying entries
 
-    template <typename Number, typename NodeType>
-    SparseMatrix<Number, NodeType> &
-    SparseMatrix<Number, NodeType>::operator=(const double d)
+    template <typename Number, typename MemorySpace>
+    SparseMatrix<Number, MemorySpace> &
+    SparseMatrix<Number, MemorySpace>::operator=(const double d)
     {
       (void)d;
       Assert(d == 0, ExcScalarAssignmentOnlyForZeroValue());
@@ -469,9 +469,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
-    SparseMatrix<Number, NodeType> &
-    SparseMatrix<Number, NodeType>::operator*=(const Number a)
+    template <typename Number, typename MemorySpace>
+    SparseMatrix<Number, MemorySpace> &
+    SparseMatrix<Number, MemorySpace>::operator*=(const Number a)
     {
       matrix->scale(a);
       return *this;
@@ -479,9 +479,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
-    SparseMatrix<Number, NodeType> &
-    SparseMatrix<Number, NodeType>::operator/=(const Number a)
+    template <typename Number, typename MemorySpace>
+    SparseMatrix<Number, MemorySpace> &
+    SparseMatrix<Number, MemorySpace>::operator/=(const Number a)
     {
       Assert(a != 0, ExcDivideByZero());
 
@@ -492,14 +492,15 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     void
-    SparseMatrix<Number, NodeType>::add(const size_type       row,
-                                        const size_type       n_cols,
-                                        const size_type      *col_indices,
-                                        const TrilinosScalar *values,
-                                        const bool            elide_zero_values,
-                                        const bool /*col_indices_are_sorted*/)
+    SparseMatrix<Number, MemorySpace>::add(
+      const size_type       row,
+      const size_type       n_cols,
+      const size_type      *col_indices,
+      const TrilinosScalar *values,
+      const bool            elide_zero_values,
+      const bool /*col_indices_are_sorted*/)
     {
       AssertIndexRange(row, this->m());
 
@@ -558,10 +559,10 @@ namespace LinearAlgebra
 
     // Multiplications
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     void
-    SparseMatrix<Number, NodeType>::vmult(Vector<Number>       &dst,
-                                          const Vector<Number> &src) const
+    SparseMatrix<Number, MemorySpace>::vmult(Vector<Number>       &dst,
+                                             const Vector<Number> &src) const
     {
       Assert(&src != &dst, ExcSourceEqualsDestination());
       Assert(matrix->isFillComplete(), ExcMatrixNotCompressed());
@@ -574,10 +575,10 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     void
-    SparseMatrix<Number, NodeType>::Tvmult(Vector<Number>       &dst,
-                                           const Vector<Number> &src) const
+    SparseMatrix<Number, MemorySpace>::Tvmult(Vector<Number>       &dst,
+                                              const Vector<Number> &src) const
     {
       Assert(&src != &dst, ExcSourceEqualsDestination());
       Assert(matrix->isFillComplete(), ExcMatrixNotCompressed());
@@ -590,10 +591,11 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     void
-    SparseMatrix<Number, NodeType>::vmult_add(Vector<Number>       &dst,
-                                              const Vector<Number> &src) const
+    SparseMatrix<Number, MemorySpace>::vmult_add(
+      Vector<Number>       &dst,
+      const Vector<Number> &src) const
     {
       Assert(&src != &dst, ExcSourceEqualsDestination());
       Assert(matrix->isFillComplete(), ExcMatrixNotCompressed());
@@ -610,10 +612,11 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     void
-    SparseMatrix<Number, NodeType>::Tvmult_add(Vector<Number>       &dst,
-                                               const Vector<Number> &src) const
+    SparseMatrix<Number, MemorySpace>::Tvmult_add(
+      Vector<Number>       &dst,
+      const Vector<Number> &src) const
     {
       Assert(&src != &dst, ExcSourceEqualsDestination());
       Assert(matrix->isFillComplete(), ExcMatrixNotCompressed());
@@ -629,9 +632,9 @@ namespace LinearAlgebra
     }
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     void
-    SparseMatrix<Number, NodeType>::print(
+    SparseMatrix<Number, MemorySpace>::print(
       std::ostream &out,
       const bool    print_detailed_trilinos_information) const
     {
@@ -661,9 +664,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     void
-    SparseMatrix<Number, NodeType>::compress(
+    SparseMatrix<Number, MemorySpace>::compress(
       [[maybe_unused]] VectorOperation::values operation)
     {
       if (!compressed)
@@ -673,9 +676,9 @@ namespace LinearAlgebra
         }
     }
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     void
-    SparseMatrix<Number, NodeType>::resume_fill()
+    SparseMatrix<Number, MemorySpace>::resume_fill()
     {
       if (compressed)
         {
index de710eb24f287844369030a6e6dcfe2bdb754aad..9271f41ae27c491ddbd22d88205b3e6589a41872 100644 (file)
@@ -45,15 +45,15 @@ namespace LinearAlgebra
 {
   namespace TpetraWrappers
   {
-    template <typename NodeType>
+    template <typename MemorySpace>
     class SparsityPattern;
 
-    template <typename Number, typename NodeType>
+    template <typename Number, typename MemorySpace>
     class SparseMatrix;
 
     namespace SparsityPatternIterators
     {
-      template <typename NodeType>
+      template <typename MemorySpace>
       class Iterator;
     }
   } // namespace TpetraWrappers
@@ -77,8 +77,7 @@ namespace LinearAlgebra
        *
        * @ingroup TrilinosWrappers
        */
-      template <typename NodeType =
-                  Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
+      template <typename MemorySpace = dealii::MemorySpace::Host>
       class Accessor
       {
       public:
@@ -87,12 +86,19 @@ namespace LinearAlgebra
          */
         using size_type = dealii::types::signed_global_dof_index;
 
+        /**
+         * Typedef for the NodeType
+         */
+        using NodeType = Tpetra::KokkosCompat::KokkosDeviceWrapperNode<
+          typename MemorySpace::kokkos_space::execution_space,
+          typename MemorySpace::kokkos_space>;
+
         /**
          * Constructor.
          */
-        Accessor(const SparsityPattern<NodeType> *sparsity_pattern,
-                 const size_type                  row,
-                 const size_type                  index);
+        Accessor(const SparsityPattern<MemorySpace> *sparsity_pattern,
+                 const size_type                     row,
+                 const size_type                     index);
 
         /**
          * Row number of the element represented by this object.
@@ -133,7 +139,7 @@ namespace LinearAlgebra
         /**
          * The matrix accessed.
          */
-        SparsityPattern<NodeType> *sparsity_pattern;
+        SparsityPattern<MemorySpace> *sparsity_pattern;
 
         /**
          * Current row number.
@@ -169,7 +175,7 @@ namespace LinearAlgebra
         visit_present_row();
 
         // Make enclosing class a friend.
-        friend class Iterator<NodeType>;
+        friend class Iterator<MemorySpace>;
       };
 
       /**
@@ -177,8 +183,7 @@ namespace LinearAlgebra
        * TrilinosWrappers::SparsityPattern. Access to individual elements of the
        * sparsity pattern is handled by the Accessor class in this namespace.
        */
-      template <typename NodeType =
-                  Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
+      template <typename MemorySpace = dealii::MemorySpace::Host>
       class Iterator
       {
       public:
@@ -187,23 +192,30 @@ namespace LinearAlgebra
          */
         using size_type = size_t;
 
+        /**
+         * Typedef for the NodeType
+         */
+        using NodeType = Tpetra::KokkosCompat::KokkosDeviceWrapperNode<
+          typename MemorySpace::kokkos_space::execution_space,
+          typename MemorySpace::kokkos_space>;
+
         /**
          * Constructor. Create an iterator into the matrix @p matrix for the
          * given row and the index within it.
          */
-        Iterator(const SparsityPattern<NodeType> *sparsity_pattern,
-                 const size_type                  row,
-                 const size_type                  index);
+        Iterator(const SparsityPattern<MemorySpace> *sparsity_pattern,
+                 const size_type                     row,
+                 const size_type                     index);
 
         /**
          * Copy constructor.
          */
-        Iterator(const Iterator<NodeType> &i);
+        Iterator(const Iterator<MemorySpace> &i);
 
         /**
          * Prefix increment.
          */
-        Iterator<NodeType> &
+        Iterator<MemorySpace> &
         operator++();
 
         /**
@@ -215,13 +227,13 @@ namespace LinearAlgebra
         /**
          * Dereferencing operator.
          */
-        const Accessor<NodeType> &
+        const Accessor<MemorySpace> &
         operator*() const;
 
         /**
          * Dereferencing operator.
          */
-        const Accessor<NodeType> *
+        const Accessor<MemorySpace> *
         operator->() const;
 
         /**
@@ -229,13 +241,13 @@ namespace LinearAlgebra
          * position.
          */
         bool
-        operator==(const Iterator<NodeType> &) const;
+        operator==(const Iterator<MemorySpace> &) const;
 
         /**
          * Inverse of <tt>==</tt>.
          */
         bool
-        operator!=(const Iterator<NodeType> &) const;
+        operator!=(const Iterator<MemorySpace> &) const;
 
         /**
          * Comparison operator. Result is true if either the first row number is
@@ -243,7 +255,7 @@ namespace LinearAlgebra
          * smaller.
          */
         bool
-        operator<(const Iterator<NodeType> &) const;
+        operator<(const Iterator<MemorySpace> &) const;
 
         /**
          * Exception
@@ -258,9 +270,9 @@ namespace LinearAlgebra
         /**
          * Store an object of the accessor class.
          */
-        Accessor<NodeType> accessor;
+        Accessor<MemorySpace> accessor;
 
-        friend class TpetraWrappers::SparsityPattern<NodeType>;
+        friend class TpetraWrappers::SparsityPattern<MemorySpace>;
       };
 
     } // namespace SparsityPatternIterators
@@ -277,14 +289,13 @@ namespace LinearAlgebra
      * This class has many similarities to the  DynamicSparsityPattern, since it
      * can dynamically add elements to the pattern without any memory being
      * previously reserved for it. However, it also has a method
-     * SparsityPattern<NodeType>::compress(), that finalizes the pattern and
+     * SparsityPattern<MemorySpace>::compress(), that finalizes the pattern and
      * enables its use with Trilinos sparse matrices.
      *
      * @ingroup TrilinosWrappers
      * @ingroup Sparsity
      */
-    template <typename NodeType =
-                Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
+    template <typename MemorySpace = dealii::MemorySpace::Host>
     class SparsityPattern : public SparsityPatternBase
     {
     public:
@@ -293,10 +304,17 @@ namespace LinearAlgebra
        */
       using size_type = dealii::types::signed_global_dof_index;
 
+      /**
+       * Typedef for the NodeType
+       */
+      using NodeType = Tpetra::KokkosCompat::KokkosDeviceWrapperNode<
+        typename MemorySpace::kokkos_space::execution_space,
+        typename MemorySpace::kokkos_space>;
+
       /**
        * Declare an alias for the iterator class.
        */
-      using const_iterator = SparsityPatternIterators::Iterator<NodeType>;
+      using const_iterator = SparsityPatternIterators::Iterator<MemorySpace>;
 
       /**
        * Typedef for Tpetra::Map
@@ -310,6 +328,7 @@ namespace LinearAlgebra
       using GraphType =
         Tpetra::CrsGraph<int, dealii::types::signed_global_dof_index, NodeType>;
 
+
       /**
        * @name Basic constructors and initialization
        */
@@ -353,13 +372,14 @@ namespace LinearAlgebra
        * Move constructor. Create a new sparse matrix by stealing the internal
        * data.
        */
-      SparsityPattern(SparsityPattern<NodeType> &&other) noexcept;
+      SparsityPattern(SparsityPattern<MemorySpace> &&other) noexcept;
 
       /**
        * Copy constructor. Sets the calling sparsity pattern to be the same as
        * the input sparsity pattern.
        */
-      SparsityPattern(const SparsityPattern<NodeType> &input_sparsity_pattern);
+      SparsityPattern(
+        const SparsityPattern<MemorySpace> &input_sparsity_pattern);
 
       /**
        * Destructor. Made virtual so that one can use pointers to this class.
@@ -400,7 +420,7 @@ namespace LinearAlgebra
        * input sparsity pattern.
        */
       void
-      copy_from(const SparsityPattern<NodeType> &input_sparsity_pattern);
+      copy_from(const SparsityPattern<MemorySpace> &input_sparsity_pattern);
 
       /**
        * Copy function from one of the deal.II sparsity patterns. If used in
@@ -417,8 +437,8 @@ namespace LinearAlgebra
        * the compiler. Use copy_from() instead if you know that you really want
        * to copy a sparsity pattern with non-trivial content.
        */
-      SparsityPattern<NodeType> &
-      operator=(const SparsityPattern<NodeType> &input_sparsity_pattern);
+      SparsityPattern<MemorySpace> &
+      operator=(const SparsityPattern<MemorySpace> &input_sparsity_pattern);
 
       /**
        * Release all memory and return to a state just like after having called
@@ -468,7 +488,7 @@ namespace LinearAlgebra
        * each m row. Since we know the number of elements in the sparsity
        * pattern exactly in this case, we can already allocate the right amount
        * of memory, which makes the creation process by the respective
-       * SparsityPattern<NodeType>::reinit call considerably faster. However,
+       * SparsityPattern<MemorySpace>::reinit call considerably faster. However,
        * this is a rather unusual situation, since knowing the number of entries
        * in each row is usually connected to knowing the indices of nonzero
        * entries, which the sparsity pattern is designed to describe.
@@ -1017,9 +1037,9 @@ namespace LinearAlgebra
       Teuchos::RCP<GraphType> nonlocal_graph;
 
       // TODO: currently only for double
-      friend class SparseMatrix<double, NodeType>;
-      friend class SparsityPatternIterators::Accessor<NodeType>;
-      friend class SparsityPatternIterators::Iterator<NodeType>;
+      friend class SparseMatrix<double, MemorySpace>;
+      friend class SparsityPatternIterators::Accessor<MemorySpace>;
+      friend class SparsityPatternIterators::Iterator<MemorySpace>;
     };
 
 
@@ -1031,11 +1051,12 @@ namespace LinearAlgebra
 
     namespace SparsityPatternIterators
     {
-      template <typename NodeType>
-      inline Accessor<NodeType>::Accessor(const SparsityPattern<NodeType> *sp,
-                                          const size_type                  row,
-                                          const size_type index)
-        : sparsity_pattern(const_cast<SparsityPattern<NodeType> *>(sp))
+      template <typename MemorySpace>
+      inline Accessor<MemorySpace>::Accessor(
+        const SparsityPattern<MemorySpace> *sp,
+        const size_type                     row,
+        const size_type                     index)
+        : sparsity_pattern(const_cast<SparsityPattern<MemorySpace> *>(sp))
         , a_row(row)
         , a_index(index)
       {
@@ -1044,9 +1065,9 @@ namespace LinearAlgebra
 
 
 
-      template <typename NodeType>
-      inline typename Accessor<NodeType>::size_type
-      Accessor<NodeType>::row() const
+      template <typename MemorySpace>
+      inline typename Accessor<MemorySpace>::size_type
+      Accessor<MemorySpace>::row() const
       {
         Assert(a_row < sparsity_pattern->n_rows(),
                ExcBeyondEndOfSparsityPattern());
@@ -1055,9 +1076,9 @@ namespace LinearAlgebra
 
 
 
-      template <typename NodeType>
-      inline typename Accessor<NodeType>::size_type
-      Accessor<NodeType>::column() const
+      template <typename MemorySpace>
+      inline typename Accessor<MemorySpace>::size_type
+      Accessor<MemorySpace>::column() const
       {
         Assert(a_row < sparsity_pattern->n_rows(),
                ExcBeyondEndOfSparsityPattern());
@@ -1066,9 +1087,9 @@ namespace LinearAlgebra
 
 
 
-      template <typename NodeType>
-      inline typename Accessor<NodeType>::size_type
-      Accessor<NodeType>::index() const
+      template <typename MemorySpace>
+      inline typename Accessor<MemorySpace>::size_type
+      Accessor<MemorySpace>::index() const
       {
         Assert(a_row < sparsity_pattern->n_rows(),
                ExcBeyondEndOfSparsityPattern());
@@ -1077,23 +1098,25 @@ namespace LinearAlgebra
 
 
 
-      template <typename NodeType>
-      inline Iterator<NodeType>::Iterator(const SparsityPattern<NodeType> *sp,
-                                          const size_type                  row,
-                                          const size_type index)
+      template <typename MemorySpace>
+      inline Iterator<MemorySpace>::Iterator(
+        const SparsityPattern<MemorySpace> *sp,
+        const size_type                     row,
+        const size_type                     index)
         : accessor(sp, row, index)
       {}
 
 
 
-      template <typename NodeType>
-      inline Iterator<NodeType>::Iterator(const Iterator<NodeType> &) = default;
+      template <typename MemorySpace>
+      inline Iterator<MemorySpace>::Iterator(const Iterator<MemorySpace> &) =
+        default;
 
 
 
-      template <typename NodeType>
-      inline Iterator<NodeType> &
-      Iterator<NodeType>::operator++()
+      template <typename MemorySpace>
+      inline Iterator<MemorySpace> &
+      Iterator<MemorySpace>::operator++()
       {
         Assert(accessor.a_row < accessor.sparsity_pattern->n_rows(),
                ExcIteratorPastEnd());
@@ -1130,38 +1153,39 @@ namespace LinearAlgebra
 
 
 
-      template <typename NodeType>
-      inline Iterator<NodeType>
-      Iterator<NodeType>::operator++(int)
+      template <typename MemorySpace>
+      inline Iterator<MemorySpace>
+      Iterator<MemorySpace>::operator++(int)
       {
-        const Iterator<NodeType> old_state = *this;
+        const Iterator<MemorySpace> old_state = *this;
         ++(*this);
         return old_state;
       }
 
 
 
-      template <typename NodeType>
-      inline const Accessor<NodeType> &
-      Iterator<NodeType>::operator*() const
+      template <typename MemorySpace>
+      inline const Accessor<MemorySpace> &
+      Iterator<MemorySpace>::operator*() const
       {
         return accessor;
       }
 
 
 
-      template <typename NodeType>
-      inline const Accessor<NodeType> *
-      Iterator<NodeType>::operator->() const
+      template <typename MemorySpace>
+      inline const Accessor<MemorySpace> *
+      Iterator<MemorySpace>::operator->() const
       {
         return &accessor;
       }
 
 
 
-      template <typename NodeType>
+      template <typename MemorySpace>
       inline bool
-      Iterator<NodeType>::operator==(const Iterator<NodeType> &other) const
+      Iterator<MemorySpace>::operator==(
+        const Iterator<MemorySpace> &other) const
       {
         return (accessor.a_row == other.accessor.a_row &&
                 accessor.a_index == other.accessor.a_index);
@@ -1169,18 +1193,19 @@ namespace LinearAlgebra
 
 
 
-      template <typename NodeType>
+      template <typename MemorySpace>
       inline bool
-      Iterator<NodeType>::operator!=(const Iterator<NodeType> &other) const
+      Iterator<MemorySpace>::operator!=(
+        const Iterator<MemorySpace> &other) const
       {
         return !(*this == other);
       }
 
 
 
-      template <typename NodeType>
+      template <typename MemorySpace>
       inline bool
-      Iterator<NodeType>::operator<(const Iterator<NodeType> &other) const
+      Iterator<MemorySpace>::operator<(const Iterator<MemorySpace> &other) const
       {
         return (accessor.row() < other.accessor.row() ||
                 (accessor.row() == other.accessor.row() &&
@@ -1191,9 +1216,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
-    inline typename SparsityPattern<NodeType>::const_iterator
-    SparsityPattern<NodeType>::begin() const
+    template <typename MemorySpace>
+    inline typename SparsityPattern<MemorySpace>::const_iterator
+    SparsityPattern<MemorySpace>::begin() const
     {
       const size_type first_valid_row = this->local_range().first;
       return const_iterator(this, first_valid_row, 0);
@@ -1201,18 +1226,18 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
-    inline typename SparsityPattern<NodeType>::const_iterator
-    SparsityPattern<NodeType>::end() const
+    template <typename MemorySpace>
+    inline typename SparsityPattern<MemorySpace>::const_iterator
+    SparsityPattern<MemorySpace>::end() const
     {
       return const_iterator(this, n_rows(), 0);
     }
 
 
 
-    template <typename NodeType>
-    inline typename SparsityPattern<NodeType>::const_iterator
-    SparsityPattern<NodeType>::begin(const size_type r) const
+    template <typename MemorySpace>
+    inline typename SparsityPattern<MemorySpace>::const_iterator
+    SparsityPattern<MemorySpace>::begin(const size_type r) const
     {
       AssertIndexRange(r, n_rows());
       if (row_length(r) > 0)
@@ -1223,9 +1248,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
-    inline typename SparsityPattern<NodeType>::const_iterator
-    SparsityPattern<NodeType>::end(const size_type r) const
+    template <typename MemorySpace>
+    inline typename SparsityPattern<MemorySpace>::const_iterator
+    SparsityPattern<MemorySpace>::end(const size_type r) const
     {
       AssertIndexRange(r, n_rows());
 
@@ -1245,9 +1270,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     inline bool
-    SparsityPattern<NodeType>::in_local_range(const size_type index) const
+    SparsityPattern<MemorySpace>::in_local_range(const size_type index) const
     {
       const TrilinosWrappers::types::int_type begin =
         graph->getRowMap()->getMinGlobalIndex();
@@ -1260,40 +1285,40 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     inline bool
-    SparsityPattern<NodeType>::is_compressed() const
+    SparsityPattern<MemorySpace>::is_compressed() const
     {
       return graph->isFillComplete();
     }
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     inline bool
-    SparsityPattern<NodeType>::empty() const
+    SparsityPattern<MemorySpace>::empty() const
     {
       return ((n_rows() == 0) && (n_cols() == 0));
     }
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     inline void
-    SparsityPattern<NodeType>::add(const size_type i, const size_type j)
+    SparsityPattern<MemorySpace>::add(const size_type i, const size_type j)
     {
       add_entries(i, &j, &j + 1);
     }
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     template <typename ForwardIterator>
     inline void
-    SparsityPattern<NodeType>::add_entries(const size_type row,
-                                           ForwardIterator begin,
-                                           ForwardIterator end,
-                                           const bool /*indices_are_sorted*/)
+    SparsityPattern<MemorySpace>::add_entries(const size_type row,
+                                              ForwardIterator begin,
+                                              ForwardIterator end,
+                                              const bool /*indices_are_sorted*/)
     {
       if (begin == end)
         return;
@@ -1322,6 +1347,9 @@ namespace LinearAlgebra
       AssertDimension(*col_index_ptr_end, *end);
       TrilinosWrappers::types::int_type trilinos_row_index = row;
 
+      // TODO: The following line creates an array by copying the entries.
+      //       Perhaps there is a way to only create a 'view' of these arrays
+      //       and pass that to Tpetra?
       Teuchos::Array<long long> array(col_index_ptr_begin, col_index_ptr_end);
 
       if (row_is_stored_locally(row))
@@ -1345,28 +1373,30 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     inline Teuchos::RCP<
-      Tpetra::CrsGraph<int, dealii::types::signed_global_dof_index, NodeType>>
-    SparsityPattern<NodeType>::trilinos_sparsity_pattern() const
+      Tpetra::CrsGraph<int,
+                       dealii::types::signed_global_dof_index,
+                       typename SparsityPattern<MemorySpace>::NodeType>>
+    SparsityPattern<MemorySpace>::trilinos_sparsity_pattern() const
     {
       return graph;
     }
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     inline IndexSet
-    SparsityPattern<NodeType>::locally_owned_domain_indices() const
+    SparsityPattern<MemorySpace>::locally_owned_domain_indices() const
     {
       return IndexSet(graph->getDomainMap().getConst());
     }
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     inline IndexSet
-    SparsityPattern<NodeType>::locally_owned_range_indices() const
+    SparsityPattern<MemorySpace>::locally_owned_range_indices() const
     {
       return IndexSet(graph->getRangeMap().getConst());
     }
index 31b01f8430e98d5f7743ee0ed90175c028d417c1..b831cff3b6611963feec5a8cc47e2d1fe4d351f0 100644 (file)
@@ -36,9 +36,9 @@ namespace LinearAlgebra
   {
     namespace SparsityPatternIterators
     {
-      template <typename NodeType>
+      template <typename MemorySpace>
       void
-      Accessor<NodeType>::visit_present_row()
+      Accessor<MemorySpace>::visit_present_row()
       {
         // if we are asked to visit the past-the-end line, then simply
         // release all our caches and go on with life
@@ -79,8 +79,8 @@ namespace LinearAlgebra
     // even matter how many threads there are, but only if we use an MPI
     // compiler or a standard compiler. So, even one thread on a configuration
     // with MPI will still get a parallel interface.
-    template <typename NodeType>
-    SparsityPattern<NodeType>::SparsityPattern()
+    template <typename MemorySpace>
+    SparsityPattern<MemorySpace>::SparsityPattern()
     {
       column_space_map = Utilities::Trilinos::internal::make_rcp<MapType>(
         TrilinosWrappers::types::int_type(0),
@@ -95,8 +95,8 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
-    SparsityPattern<NodeType>::SparsityPattern(
+    template <typename MemorySpace>
+    SparsityPattern<MemorySpace>::SparsityPattern(
       const size_type m,
       const size_type n,
       const size_type n_entries_per_row)
@@ -106,8 +106,8 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
-    SparsityPattern<NodeType>::SparsityPattern(
+    template <typename MemorySpace>
+    SparsityPattern<MemorySpace>::SparsityPattern(
       const size_type               m,
       const size_type               n,
       const std::vector<size_type> &n_entries_per_row)
@@ -117,9 +117,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
-    SparsityPattern<NodeType>::SparsityPattern(
-      SparsityPattern<NodeType> &&other) noexcept
+    template <typename MemorySpace>
+    SparsityPattern<MemorySpace>::SparsityPattern(
+      SparsityPattern<MemorySpace> &&other) noexcept
       : SparsityPatternBase(std::move(other))
       , column_space_map(std::move(other.column_space_map))
       , graph(std::move(other.graph))
@@ -129,9 +129,9 @@ namespace LinearAlgebra
 
 
     // Copy function only works if the sparsity pattern is empty.
-    template <typename NodeType>
-    SparsityPattern<NodeType>::SparsityPattern(
-      const SparsityPattern<NodeType> &input_sparsity)
+    template <typename MemorySpace>
+    SparsityPattern<MemorySpace>::SparsityPattern(
+      const SparsityPattern<MemorySpace> &input_sparsity)
       : SparsityPatternBase(input_sparsity)
       , column_space_map(Utilities::Trilinos::internal::make_rcp<MapType>(
           0,
@@ -150,8 +150,8 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
-    SparsityPattern<NodeType>::SparsityPattern(
+    template <typename MemorySpace>
+    SparsityPattern<MemorySpace>::SparsityPattern(
       const IndexSet &parallel_partitioning,
       const MPI_Comm  communicator,
       const size_type n_entries_per_row)
@@ -164,8 +164,8 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
-    SparsityPattern<NodeType>::SparsityPattern(
+    template <typename MemorySpace>
+    SparsityPattern<MemorySpace>::SparsityPattern(
       const IndexSet               &parallel_partitioning,
       const MPI_Comm                communicator,
       const std::vector<size_type> &n_entries_per_row)
@@ -178,8 +178,8 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
-    SparsityPattern<NodeType>::SparsityPattern(
+    template <typename MemorySpace>
+    SparsityPattern<MemorySpace>::SparsityPattern(
       const IndexSet &row_parallel_partitioning,
       const IndexSet &col_parallel_partitioning,
       const MPI_Comm  communicator,
@@ -193,8 +193,8 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
-    SparsityPattern<NodeType>::SparsityPattern(
+    template <typename MemorySpace>
+    SparsityPattern<MemorySpace>::SparsityPattern(
       const IndexSet               &row_parallel_partitioning,
       const IndexSet               &col_parallel_partitioning,
       const MPI_Comm                communicator,
@@ -208,8 +208,8 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
-    SparsityPattern<NodeType>::SparsityPattern(
+    template <typename MemorySpace>
+    SparsityPattern<MemorySpace>::SparsityPattern(
       const IndexSet &row_parallel_partitioning,
       const IndexSet &col_parallel_partitioning,
       const IndexSet &writable_rows,
@@ -225,11 +225,11 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     void
-    SparsityPattern<NodeType>::reinit(const size_type m,
-                                      const size_type n,
-                                      const size_type n_entries_per_row)
+    SparsityPattern<MemorySpace>::reinit(const size_type m,
+                                         const size_type n,
+                                         const size_type n_entries_per_row)
     {
       reinit(complete_index_set(m),
              complete_index_set(n),
@@ -239,9 +239,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     void
-    SparsityPattern<NodeType>::reinit(
+    SparsityPattern<MemorySpace>::reinit(
       const size_type               m,
       const size_type               n,
       const std::vector<size_type> &n_entries_per_row)
@@ -256,25 +256,29 @@ namespace LinearAlgebra
 
     namespace
     {
-      template <typename NodeType>
-      using size_type = typename SparsityPattern<NodeType>::size_type;
+      template <typename MemorySpace>
+      using size_type = typename SparsityPattern<MemorySpace>::size_type;
 
-      template <typename NodeType>
+      template <typename MemorySpace>
       using MapType =
-        Tpetra::Map<int, dealii::types::signed_global_dof_index, NodeType>;
+        Tpetra::Map<int,
+                    dealii::types::signed_global_dof_index,
+                    typename SparsityPattern<MemorySpace>::NodeType>;
 
-      template <typename NodeType>
+      template <typename MemorySpace>
       using GraphType =
-        Tpetra::CrsGraph<int, dealii::types::signed_global_dof_index, NodeType>;
+        Tpetra::CrsGraph<int,
+                         dealii::types::signed_global_dof_index,
+                         typename SparsityPattern<MemorySpace>::NodeType>;
 
-      template <typename NodeType>
+      template <typename MemorySpace>
       void
-      reinit_sp(const Teuchos::RCP<MapType<NodeType>> &row_map,
-                const Teuchos::RCP<MapType<NodeType>> &col_map,
-                const size_type<NodeType>              n_entries_per_row,
-                Teuchos::RCP<MapType<NodeType>>       &column_space_map,
-                Teuchos::RCP<GraphType<NodeType>>     &graph,
-                Teuchos::RCP<GraphType<NodeType>>     &nonlocal_graph)
+      reinit_sp(const Teuchos::RCP<MapType<MemorySpace>> &row_map,
+                const Teuchos::RCP<MapType<MemorySpace>> &col_map,
+                const size_type<MemorySpace>              n_entries_per_row,
+                Teuchos::RCP<MapType<MemorySpace>>       &column_space_map,
+                Teuchos::RCP<GraphType<MemorySpace>>     &graph,
+                Teuchos::RCP<GraphType<MemorySpace>>     &nonlocal_graph)
       {
         Assert(row_map->isOneToOne(),
                ExcMessage("Row map must be 1-to-1, i.e., no overlap between "
@@ -295,20 +299,20 @@ namespace LinearAlgebra
         // columns as well. If we use a recent Trilinos version, we can also
         // require building a non-local graph which gives us thread-safe
         // initialization.
-        graph = Utilities::Trilinos::internal::make_rcp<GraphType<NodeType>>(
+        graph = Utilities::Trilinos::internal::make_rcp<GraphType<MemorySpace>>(
           row_map, row_map, n_entries_per_row);
       }
 
 
 
-      template <typename NodeType>
+      template <typename MemorySpace>
       void
-      reinit_sp(const Teuchos::RCP<MapType<NodeType>>  &row_map,
-                const Teuchos::RCP<MapType<NodeType>>  &col_map,
-                const std::vector<size_type<NodeType>> &n_entries_per_row,
-                Teuchos::RCP<MapType<NodeType>>        &column_space_map,
-                Teuchos::RCP<GraphType<NodeType>>      &graph,
-                Teuchos::RCP<GraphType<NodeType>>      &nonlocal_graph)
+      reinit_sp(const Teuchos::RCP<MapType<MemorySpace>>  &row_map,
+                const Teuchos::RCP<MapType<MemorySpace>>  &col_map,
+                const std::vector<size_type<MemorySpace>> &n_entries_per_row,
+                Teuchos::RCP<MapType<MemorySpace>>        &column_space_map,
+                Teuchos::RCP<GraphType<MemorySpace>>      &graph,
+                Teuchos::RCP<GraphType<MemorySpace>>      &nonlocal_graph)
       {
         Assert(row_map->isOneToOne(),
                ExcMessage("Row map must be 1-to-1, i.e., no overlap between "
@@ -351,21 +355,21 @@ namespace LinearAlgebra
           ExcMessage(
             "You are requesting to store more elements than global ordinal type allows."));
 
-        graph = Utilities::Trilinos::internal::make_rcp<GraphType<NodeType>>(
+        graph = Utilities::Trilinos::internal::make_rcp<GraphType<MemorySpace>>(
           row_map, col_map, local_entries_per_row);
       }
 
 
 
-      template <typename SparsityPatternType, typename NodeType>
+      template <typename SparsityPatternType, typename MemorySpace>
       void
-      reinit_sp(const Teuchos::RCP<MapType<NodeType>> &row_map,
-                const Teuchos::RCP<MapType<NodeType>> &col_map,
-                const SparsityPatternType             &sp,
-                [[maybe_unused]] const bool            exchange_data,
-                Teuchos::RCP<MapType<NodeType>>       &column_space_map,
-                Teuchos::RCP<GraphType<NodeType>>     &graph,
-                Teuchos::RCP<GraphType<NodeType>>     &nonlocal_graph)
+      reinit_sp(const Teuchos::RCP<MapType<MemorySpace>> &row_map,
+                const Teuchos::RCP<MapType<MemorySpace>> &col_map,
+                const SparsityPatternType                &sp,
+                [[maybe_unused]] const bool               exchange_data,
+                Teuchos::RCP<MapType<MemorySpace>>       &column_space_map,
+                Teuchos::RCP<GraphType<MemorySpace>>     &graph,
+                Teuchos::RCP<GraphType<MemorySpace>>     &nonlocal_graph)
       {
         nonlocal_graph.reset();
         graph.reset();
@@ -374,17 +378,19 @@ namespace LinearAlgebra
         AssertDimension(sp.n_cols(), col_map->getGlobalNumElements());
 
         column_space_map =
-          Utilities::Trilinos::internal::make_rcp<MapType<NodeType>>(*col_map);
+          Utilities::Trilinos::internal::make_rcp<MapType<MemorySpace>>(
+            *col_map);
 
         Assert(row_map->isContiguous() == true,
                ExcMessage(
                  "This function only works if the row map is contiguous."));
 
-        const size_type<NodeType> first_row = row_map->getMinGlobalIndex(),
-                                  last_row  = row_map->getMaxGlobalIndex() + 1;
+        const size_type<MemorySpace> first_row = row_map->getMinGlobalIndex(),
+                                     last_row =
+                                       row_map->getMaxGlobalIndex() + 1;
         Teuchos::Array<size_t> n_entries_per_row(last_row - first_row);
 
-        for (size_type<NodeType> row = first_row; row < last_row; ++row)
+        for (size_type<MemorySpace> row = first_row; row < last_row; ++row)
           n_entries_per_row[row - first_row] = sp.row_length(row);
 
         AssertThrow(
@@ -402,18 +408,20 @@ namespace LinearAlgebra
             "with 'local ordinate = long long' "));
 
         if (row_map->getComm()->getSize() > 1)
-          graph = Utilities::Trilinos::internal::make_rcp<GraphType<NodeType>>(
-            row_map, n_entries_per_row());
+          graph =
+            Utilities::Trilinos::internal::make_rcp<GraphType<MemorySpace>>(
+              row_map, n_entries_per_row());
         else
-          graph = Utilities::Trilinos::internal::make_rcp<GraphType<NodeType>>(
-            row_map, col_map, n_entries_per_row());
+          graph =
+            Utilities::Trilinos::internal::make_rcp<GraphType<MemorySpace>>(
+              row_map, col_map, n_entries_per_row());
 
         AssertDimension(sp.n_rows(), graph->getGlobalNumRows());
         AssertDimension(sp.n_cols(), graph->getGlobalNumEntries());
 
         std::vector<TrilinosWrappers::types::int_type> row_indices;
 
-        for (size_type<NodeType> row = first_row; row < last_row; ++row)
+        for (size_type<MemorySpace> row = first_row; row < last_row; ++row)
           {
             const TrilinosWrappers::types::int_type row_length =
               sp.row_length(row);
@@ -440,25 +448,25 @@ namespace LinearAlgebra
     } // namespace
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     void
-    SparsityPattern<NodeType>::reinit(const IndexSet &parallel_partitioning,
-                                      const MPI_Comm  communicator,
-                                      const size_type n_entries_per_row)
+    SparsityPattern<MemorySpace>::reinit(const IndexSet &parallel_partitioning,
+                                         const MPI_Comm  communicator,
+                                         const size_type n_entries_per_row)
     {
       SparsityPatternBase::resize(parallel_partitioning.size(),
                                   parallel_partitioning.size());
       Teuchos::RCP<MapType> map =
         parallel_partitioning.make_tpetra_map_rcp(communicator, false);
-      reinit_sp(
+      reinit_sp<MemorySpace>(
         map, map, n_entries_per_row, column_space_map, graph, nonlocal_graph);
     }
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     void
-    SparsityPattern<NodeType>::reinit(
+    SparsityPattern<MemorySpace>::reinit(
       const IndexSet               &parallel_partitioning,
       const MPI_Comm                communicator,
       const std::vector<size_type> &n_entries_per_row)
@@ -467,18 +475,19 @@ namespace LinearAlgebra
                                   parallel_partitioning.size());
       Teuchos::RCP<MapType> map =
         parallel_partitioning.make_tpetra_map_rcp(communicator, false);
-      reinit_sp(
+      reinit_sp<MemorySpace>(
         map, map, n_entries_per_row, column_space_map, graph, nonlocal_graph);
     }
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     void
-    SparsityPattern<NodeType>::reinit(const IndexSet &row_parallel_partitioning,
-                                      const IndexSet &col_parallel_partitioning,
-                                      const MPI_Comm  communicator,
-                                      const size_type n_entries_per_row)
+    SparsityPattern<MemorySpace>::reinit(
+      const IndexSet &row_parallel_partitioning,
+      const IndexSet &col_parallel_partitioning,
+      const MPI_Comm  communicator,
+      const size_type n_entries_per_row)
     {
       SparsityPatternBase::resize(row_parallel_partitioning.size(),
                                   col_parallel_partitioning.size());
@@ -486,19 +495,19 @@ namespace LinearAlgebra
         row_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
       Teuchos::RCP<MapType> col_map =
         col_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
-      reinit_sp(row_map,
-                col_map,
-                n_entries_per_row,
-                column_space_map,
-                graph,
-                nonlocal_graph);
+      reinit_sp<MemorySpace>(row_map,
+                             col_map,
+                             n_entries_per_row,
+                             column_space_map,
+                             graph,
+                             nonlocal_graph);
     }
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     void
-    SparsityPattern<NodeType>::reinit(
+    SparsityPattern<MemorySpace>::reinit(
       const IndexSet               &row_parallel_partitioning,
       const IndexSet               &col_parallel_partitioning,
       const MPI_Comm                communicator,
@@ -510,23 +519,24 @@ namespace LinearAlgebra
         row_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
       Teuchos::RCP<MapType> col_map =
         col_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
-      reinit_sp(row_map,
-                col_map,
-                n_entries_per_row,
-                column_space_map,
-                graph,
-                nonlocal_graph);
+      reinit_sp<MemorySpace>(row_map,
+                             col_map,
+                             n_entries_per_row,
+                             column_space_map,
+                             graph,
+                             nonlocal_graph);
     }
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     void
-    SparsityPattern<NodeType>::reinit(const IndexSet &row_parallel_partitioning,
-                                      const IndexSet &col_parallel_partitioning,
-                                      const IndexSet &writable_rows,
-                                      const MPI_Comm  communicator,
-                                      const size_type n_entries_per_row)
+    SparsityPattern<MemorySpace>::reinit(
+      const IndexSet &row_parallel_partitioning,
+      const IndexSet &col_parallel_partitioning,
+      const IndexSet &writable_rows,
+      const MPI_Comm  communicator,
+      const size_type n_entries_per_row)
     {
       SparsityPatternBase::resize(row_parallel_partitioning.size(),
                                   col_parallel_partitioning.size());
@@ -534,12 +544,12 @@ namespace LinearAlgebra
         row_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
       Teuchos::RCP<MapType> col_map =
         col_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
-      reinit_sp(row_map,
-                col_map,
-                n_entries_per_row,
-                column_space_map,
-                graph,
-                nonlocal_graph);
+      reinit_sp<MemorySpace>(row_map,
+                             col_map,
+                             n_entries_per_row,
+                             column_space_map,
+                             graph,
+                             nonlocal_graph);
 
       IndexSet nonlocal_partitioner = writable_rows;
       AssertDimension(nonlocal_partitioner.size(),
@@ -569,10 +579,10 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     template <typename SparsityPatternType>
     void
-    SparsityPattern<NodeType>::reinit(
+    SparsityPattern<MemorySpace>::reinit(
       const IndexSet            &row_parallel_partitioning,
       const IndexSet            &col_parallel_partitioning,
       const SparsityPatternType &nontrilinos_sparsity_pattern,
@@ -585,21 +595,21 @@ namespace LinearAlgebra
         row_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
       Teuchos::RCP<MapType> col_map =
         col_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
-      reinit_sp(row_map,
-                col_map,
-                nontrilinos_sparsity_pattern,
-                exchange_data,
-                column_space_map,
-                graph,
-                nonlocal_graph);
+      reinit_sp<SparsityPatternType, MemorySpace>(row_map,
+                                                  col_map,
+                                                  nontrilinos_sparsity_pattern,
+                                                  exchange_data,
+                                                  column_space_map,
+                                                  graph,
+                                                  nonlocal_graph);
     }
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     template <typename SparsityPatternType>
     void
-    SparsityPattern<NodeType>::reinit(
+    SparsityPattern<MemorySpace>::reinit(
       const IndexSet            &parallel_partitioning,
       const SparsityPatternType &nontrilinos_sparsity_pattern,
       const MPI_Comm             communicator,
@@ -613,20 +623,21 @@ namespace LinearAlgebra
                                   parallel_partitioning.size());
       Teuchos::RCP<MapType> map =
         parallel_partitioning.make_tpetra_map_rcp(communicator, false);
-      reinit_sp(map,
-                map,
-                nontrilinos_sparsity_pattern,
-                exchange_data,
-                column_space_map,
-                graph,
-                nonlocal_graph);
+      reinit_sp<SparsityPatternType, MemorySpace>(map,
+                                                  map,
+                                                  nontrilinos_sparsity_pattern,
+                                                  exchange_data,
+                                                  column_space_map,
+                                                  graph,
+                                                  nonlocal_graph);
     }
 
 
 
-    template <typename NodeType>
-    SparsityPattern<NodeType> &
-    SparsityPattern<NodeType>::operator=(const SparsityPattern<NodeType> &)
+    template <typename MemorySpace>
+    SparsityPattern<MemorySpace> &
+    SparsityPattern<MemorySpace>::operator=(
+      const SparsityPattern<MemorySpace> &)
     {
       Assert(false, ExcNotImplemented());
       return *this;
@@ -634,9 +645,10 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     void
-    SparsityPattern<NodeType>::copy_from(const SparsityPattern<NodeType> &sp)
+    SparsityPattern<MemorySpace>::copy_from(
+      const SparsityPattern<MemorySpace> &sp)
     {
       SparsityPatternBase::resize(sp.n_rows(), sp.n_cols());
       column_space_map =
@@ -652,10 +664,10 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     template <typename SparsityPatternType>
     void
-    SparsityPattern<NodeType>::copy_from(const SparsityPatternType &sp)
+    SparsityPattern<MemorySpace>::copy_from(const SparsityPatternType &sp)
     {
       SparsityPatternBase::resize(sp.n_rows(), sp.n_cols());
       Teuchos::RCP<MapType> rows =
@@ -669,15 +681,15 @@ namespace LinearAlgebra
           0,
           Utilities::Trilinos::tpetra_comm_self());
 
-      reinit_sp(
+      reinit_sp<SparsityPatternType, MemorySpace>(
         rows, columns, sp, false, column_space_map, graph, nonlocal_graph);
     }
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     void
-    SparsityPattern<NodeType>::clear()
+    SparsityPattern<MemorySpace>::clear()
     {
       SparsityPatternBase::resize(0, 0);
       // When we clear the matrix, reset
@@ -698,9 +710,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     void
-    SparsityPattern<NodeType>::compress()
+    SparsityPattern<MemorySpace>::compress()
     {
       Assert(column_space_map.get(), ExcInternalError());
       if (nonlocal_graph.get() != nullptr)
@@ -749,9 +761,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     bool
-    SparsityPattern<NodeType>::row_is_stored_locally(const size_type i) const
+    SparsityPattern<MemorySpace>::row_is_stored_locally(const size_type i) const
     {
       return graph->getRowMap()->getLocalElement(i) !=
              Teuchos::OrdinalTraits<int>::invalid();
@@ -759,10 +771,10 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     bool
-    SparsityPattern<NodeType>::exists(const size_type i,
-                                      const size_type j) const
+    SparsityPattern<MemorySpace>::exists(const size_type i,
+                                         const size_type j) const
     {
       if (!row_is_stored_locally(i))
         return false;
@@ -788,9 +800,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
-    typename SparsityPattern<NodeType>::size_type
-    SparsityPattern<NodeType>::bandwidth() const
+    template <typename MemorySpace>
+    typename SparsityPattern<MemorySpace>::size_type
+    SparsityPattern<MemorySpace>::bandwidth() const
     {
       size_type local_b = 0;
       for (int i = 0; i < static_cast<int>(local_size()); ++i)
@@ -815,19 +827,19 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     unsigned int
-    SparsityPattern<NodeType>::local_size() const
+    SparsityPattern<MemorySpace>::local_size() const
     {
       return graph->getLocalNumRows();
     }
 
 
 
-    template <typename NodeType>
-    std::pair<typename SparsityPattern<NodeType>::size_type,
-              typename SparsityPattern<NodeType>::size_type>
-    SparsityPattern<NodeType>::local_range() const
+    template <typename MemorySpace>
+    std::pair<typename SparsityPattern<MemorySpace>::size_type,
+              typename SparsityPattern<MemorySpace>::size_type>
+    SparsityPattern<MemorySpace>::local_range() const
     {
       const size_type begin = graph->getRowMap()->getMinGlobalIndex();
       const size_type end   = graph->getRowMap()->getMaxGlobalIndex() + 1;
@@ -837,27 +849,27 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     std::uint64_t
-    SparsityPattern<NodeType>::n_nonzero_elements() const
+    SparsityPattern<MemorySpace>::n_nonzero_elements() const
     {
       return graph->getGlobalNumEntries();
     }
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     unsigned int
-    SparsityPattern<NodeType>::max_entries_per_row() const
+    SparsityPattern<MemorySpace>::max_entries_per_row() const
     {
       return graph->getLocalMaxNumRowEntries();
     }
 
 
 
-    template <typename NodeType>
-    typename SparsityPattern<NodeType>::size_type
-    SparsityPattern<NodeType>::row_length(const size_type row) const
+    template <typename MemorySpace>
+    typename SparsityPattern<MemorySpace>::size_type
+    SparsityPattern<MemorySpace>::row_length(const size_type row) const
     {
       Assert(row < (size_type)n_rows(), ExcInternalError());
 
@@ -876,9 +888,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     void
-    SparsityPattern<NodeType>::add_row_entries(
+    SparsityPattern<MemorySpace>::add_row_entries(
       const dealii::types::global_dof_index                  &row,
       const ArrayView<const dealii::types::global_dof_index> &columns,
       const bool indices_are_sorted)
@@ -888,27 +900,27 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
-    Teuchos::RCP<const MapType<NodeType>>
-    SparsityPattern<NodeType>::domain_partitioner() const
+    template <typename MemorySpace>
+    Teuchos::RCP<const MapType<MemorySpace>>
+    SparsityPattern<MemorySpace>::domain_partitioner() const
     {
       return graph->getDomainMap();
     }
 
 
 
-    template <typename NodeType>
-    Teuchos::RCP<const MapType<NodeType>>
-    SparsityPattern<NodeType>::range_partitioner() const
+    template <typename MemorySpace>
+    Teuchos::RCP<const MapType<MemorySpace>>
+    SparsityPattern<MemorySpace>::range_partitioner() const
     {
       return graph->getRangeMap();
     }
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     MPI_Comm
-    SparsityPattern<NodeType>::get_mpi_communicator() const
+    SparsityPattern<MemorySpace>::get_mpi_communicator() const
     {
       return Utilities::Trilinos::teuchos_comm_to_mpi_comm(
         graph->getRangeMap()->getComm());
@@ -916,9 +928,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     Teuchos::RCP<const Teuchos::Comm<int>>
-    SparsityPattern<NodeType>::get_teuchos_mpi_communicator() const
+    SparsityPattern<MemorySpace>::get_teuchos_mpi_communicator() const
     {
       return graph->getRangeMap()->getComm();
     }
@@ -928,9 +940,9 @@ namespace LinearAlgebra
     // As of now, no particularly neat
     // output is generated in case of
     // multiple processors.
-    template <typename NodeType>
+    template <typename MemorySpace>
     void
-    SparsityPattern<NodeType>::print(
+    SparsityPattern<MemorySpace>::print(
       std::ostream &out,
       const bool    write_extended_trilinos_info) const
     {
@@ -955,9 +967,9 @@ namespace LinearAlgebra
 
 
 
-    template <typename NodeType>
+    template <typename MemorySpace>
     void
-    SparsityPattern<NodeType>::print_gnuplot(std::ostream &out) const
+    SparsityPattern<MemorySpace>::print_gnuplot(std::ostream &out) const
     {
       Assert(graph->isFillComplete() == true, ExcInternalError());
       for (dealii::types::signed_global_dof_index row = 0; row < local_size();
@@ -989,9 +1001,9 @@ namespace LinearAlgebra
     }
 
     // TODO: Implement!
-    template <typename NodeType>
+    template <typename MemorySpace>
     std::size_t
-    SparsityPattern<NodeType>::memory_consumption() const
+    SparsityPattern<MemorySpace>::memory_consumption() const
     {
       Assert(false, ExcNotImplemented());
       return 0;
@@ -1000,44 +1012,43 @@ namespace LinearAlgebra
 
 #  ifndef DOXYGEN
     // explicit instantiations
-    template class SparsityPattern<
-      Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>;
+    template class SparsityPattern<dealii::MemorySpace::Host>;
 
     template void
-    SparsityPattern<Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>::
-      copy_from(const dealii::SparsityPattern &);
+    SparsityPattern<dealii::MemorySpace::Host>::copy_from(
+      const dealii::SparsityPattern &);
     template void
-    SparsityPattern<Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>::
-      copy_from(const dealii::DynamicSparsityPattern &);
+    SparsityPattern<dealii::MemorySpace::Host>::copy_from(
+      const dealii::DynamicSparsityPattern &);
 
     template void
-    SparsityPattern<Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>::
-      reinit(const IndexSet &,
-             const dealii::SparsityPattern &,
-             const MPI_Comm,
-             bool);
+    SparsityPattern<dealii::MemorySpace::Host>::reinit(
+      const IndexSet &,
+      const dealii::SparsityPattern &,
+      const MPI_Comm,
+      bool);
     template void
-    SparsityPattern<Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>::
-      reinit(const IndexSet &,
-             const dealii::DynamicSparsityPattern &,
-             const MPI_Comm,
-             bool);
+    SparsityPattern<dealii::MemorySpace::Host>::reinit(
+      const IndexSet &,
+      const dealii::DynamicSparsityPattern &,
+      const MPI_Comm,
+      bool);
 
 
     template void
-    SparsityPattern<Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>::
-      reinit(const IndexSet &,
-             const IndexSet &,
-             const dealii::SparsityPattern &,
-             const MPI_Comm,
-             bool);
+    SparsityPattern<dealii::MemorySpace::Host>::reinit(
+      const IndexSet &,
+      const IndexSet &,
+      const dealii::SparsityPattern &,
+      const MPI_Comm,
+      bool);
     template void
-    SparsityPattern<Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>::
-      reinit(const IndexSet &,
-             const IndexSet &,
-             const dealii::DynamicSparsityPattern &,
-             const MPI_Comm,
-             bool);
+    SparsityPattern<dealii::MemorySpace::Host>::reinit(
+      const IndexSet &,
+      const IndexSet &,
+      const dealii::DynamicSparsityPattern &,
+      const MPI_Comm,
+      bool);
 #  endif
 
   } // namespace TpetraWrappers

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.