]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Rework and restructure type definitions of TpetraWrappers classes 17222/head
authorJan Philipp Thiele <thiele@wias-berlin.de>
Mon, 8 Jul 2024 08:58:02 +0000 (10:58 +0200)
committerJan Philipp Thiele <thiele@wias-berlin.de>
Wed, 10 Jul 2024 05:33:36 +0000 (07:33 +0200)
13 files changed:
include/deal.II/lac/trilinos_tpetra_block_sparse_matrix.templates.h
include/deal.II/lac/trilinos_tpetra_communication_pattern.h
include/deal.II/lac/trilinos_tpetra_solver_direct.h
include/deal.II/lac/trilinos_tpetra_solver_direct.templates.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
include/deal.II/lac/trilinos_tpetra_types.h [new file with mode: 0644]
include/deal.II/lac/trilinos_tpetra_vector.h
include/deal.II/lac/trilinos_tpetra_vector.templates.h
include/deal.II/lac/vector.templates.h
source/lac/trilinos_tpetra_communication_pattern.cc
source/lac/trilinos_tpetra_sparsity_pattern.cc

index e4b67e4c3d710c7efda8305e9cd8758fea67be68..e80102f439fbd6b53d5e5ddd54030a183bb6d420 100644 (file)
@@ -99,7 +99,7 @@ namespace LinearAlgebra
       const bool                      exchange_data)
     {
 #  ifdef DEBUG
-      std::vector<typename BlockType::MapType> tpetra_maps;
+      std::vector<typename TpetraTypes::MapType<MemorySpace>> tpetra_maps;
       for (size_type i = 0; i < block_sparsity_pattern.n_block_rows(); ++i)
         tpetra_maps.push_back(
           parallel_partitioning[i].make_tpetra_map(communicator, false));
index e12c9bbc3268ab7da137f9f53903ce302ef93262..ed276e12d917b71fea0dbc8b79fe26543590ceb9 100644 (file)
 
 #include <deal.II/base/config.h>
 
+#include "deal.II/base/memory_space.h"
+
+#include <deal.II/lac/trilinos_tpetra_types.h>
+
 #ifdef DEAL_II_TRILINOS_WITH_TPETRA
 
 #  include <deal.II/base/communication_pattern_base.h>
@@ -39,6 +43,7 @@ namespace LinearAlgebra
     class CommunicationPattern : public Utilities::MPI::CommunicationPatternBase
     {
     public:
+      using MemorySpace = dealii::MemorySpace::Host;
       /**
        * Initialize the communication pattern.
        *
@@ -83,25 +88,25 @@ namespace LinearAlgebra
       /**
        * Return the underlying Tpetra::Import object.
        */
-      const Tpetra::Import<int, types::signed_global_dof_index> &
+      const TpetraTypes::ImportType<MemorySpace> &
       get_tpetra_import() const;
 
       /**
        * Return a Teuchos::RCP to the underlying Tpetra::Import object.
        */
-      Teuchos::RCP<const Tpetra::Import<int, types::signed_global_dof_index>>
+      Teuchos::RCP<TpetraTypes::ImportType<MemorySpace>>
       get_tpetra_import_rcp() const;
 
       /**
        * Return the underlying Tpetra::Export object.
        */
-      const Tpetra::Export<int, types::signed_global_dof_index> &
+      const TpetraTypes::ExportType<MemorySpace> &
       get_tpetra_export() const;
 
       /**
        * Return a Teuchos::RCP to the underlying Tpetra::Export object.
        */
-      Teuchos::RCP<const Tpetra::Export<int, types::signed_global_dof_index>>
+      Teuchos::RCP<TpetraTypes::ExportType<MemorySpace>>
       get_tpetra_export_rcp() const;
 
     private:
@@ -113,14 +118,12 @@ namespace LinearAlgebra
       /**
        * Teuchos::RCP to the Tpetra::Import object used.
        */
-      Teuchos::RCP<Tpetra::Import<int, types::signed_global_dof_index>>
-        tpetra_import;
+      Teuchos::RCP<TpetraTypes::ImportType<MemorySpace>> tpetra_import;
 
       /**
        * Teuchos::RCP to the Tpetra::Export object used.
        */
-      Teuchos::RCP<Tpetra::Export<int, types::signed_global_dof_index>>
-        tpetra_export;
+      Teuchos::RCP<TpetraTypes::ExportType<MemorySpace>> tpetra_export;
     };
   } // end of namespace TpetraWrappers
 } // end of namespace LinearAlgebra
index 68a6523d9b2952b5674a2244605b819029b81aa2..0b96bb7f9b972973cd2e5e9d9317ce79ef96f126 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "deal.II/grid/grid_generator.h"
 
+#include "deal.II/lac/trilinos_tpetra_types.h"
+
 #include <string>
 
 #ifdef DEAL_II_TRILINOS_WITH_TPETRA
@@ -70,34 +72,6 @@ namespace LinearAlgebra
     class SolverDirectBase
     {
     public:
-      /**
-       * Declare the type for container size.
-       */
-      using size_type = dealii::types::signed_global_dof_index;
-
-      /**
-       * Typedef for the NodeType
-       */
-#    if DEAL_II_TRILINOS_VERSION_GTE(14, 2, 0)
-      using NodeType = Tpetra::KokkosCompat::KokkosDeviceWrapperNode<
-        typename MemorySpace::kokkos_space::execution_space,
-        typename MemorySpace::kokkos_space>;
-#    else
-      using NodeType = Kokkos::Compat::KokkosDeviceWrapperNode<
-        typename MemorySpace::kokkos_space::execution_space,
-        typename MemorySpace::kokkos_space>;
-#    endif
-
-      /**
-       * Typedef for the LinearOperator type
-       */
-      using LinearOperator = Tpetra::Operator<Number, int, size_type, NodeType>;
-
-      /**
-       * Typedef for the MultiVector type
-       */
-      using MultiVector = Tpetra::MultiVector<Number, int, size_type, NodeType>;
-
       /**
        * Destructor.
        */
@@ -172,8 +146,8 @@ namespace LinearAlgebra
        * A structure that contains the Trilinos solver object.
        */
       Teuchos::RCP<
-        Amesos2::Solver<typename SparseMatrix<Number, MemorySpace>::MatrixType,
-                        MultiVector>>
+        Amesos2::Solver<TpetraTypes::MatrixType<Number, MemorySpace>,
+                        TpetraTypes::MultiVectorType<Number, MemorySpace>>>
         solver;
 
       /*
index c73e78fdfd280207e65901aeb085ab3c0630274f..ddca9270ae680d00c83cbe9c64ccf2b5070785ff 100644 (file)
@@ -18,6 +18,7 @@
 #include <deal.II/base/config.h>
 
 #include "deal.II/lac/solver_control.h"
+#include "deal.II/lac/trilinos_tpetra_types.h"
 
 #include <string>
 
@@ -68,8 +69,9 @@ namespace LinearAlgebra
     {
       // Allocate the Amesos2 solver with the concrete solver, if possible.
       solver =
-        Amesos2::create<typename SparseMatrix<Number, MemorySpace>::MatrixType,
-                        MultiVector>(solver_type, A.trilinos_rcp());
+        Amesos2::create<TpetraTypes::MatrixType<Number, MemorySpace>,
+                        TpetraTypes::MultiVectorType<Number, MemorySpace>>(
+          solver_type, A.trilinos_rcp());
 
       solver->setParameters(Teuchos::rcpFromRef(parameter_list));
       // Now do the actual factorization, which is a two step procedure.
@@ -140,11 +142,9 @@ namespace LinearAlgebra
       const Vector<Number, MemorySpace>       &b)
     {
       solver =
-        Amesos2::create<typename SparseMatrix<Number, MemorySpace>::MatrixType,
-                        MultiVector>(solver_type,
-                                     A.trilinos_rcp(),
-                                     x.trilinos_rcp(),
-                                     b.trilinos_rcp());
+        Amesos2::create<TpetraTypes::MatrixType<Number, MemorySpace>,
+                        TpetraTypes::MultiVectorType<Number, MemorySpace>>(
+          solver_type, A.trilinos_rcp(), x.trilinos_rcp(), b.trilinos_rcp());
       do_solve();
     }
 
index 73a483cbbb52cebfc09c08d3333abe94c6b50b10..01e9567cf5dd848c4d93063afeff457ed561cc0b 100644 (file)
@@ -159,46 +159,6 @@ namespace LinearAlgebra
        */
       using value_type = Number;
 
-      /**
-       * Typedef for the NodeType
-       */
-#  if DEAL_II_TRILINOS_VERSION_GTE(14, 2, 0)
-      using NodeType = Tpetra::KokkosCompat::KokkosDeviceWrapperNode<
-        typename MemorySpace::kokkos_space::execution_space,
-        typename MemorySpace::kokkos_space>;
-#  else
-      using NodeType = Kokkos::Compat::KokkosDeviceWrapperNode<
-        typename MemorySpace::kokkos_space::execution_space,
-        typename MemorySpace::kokkos_space>;
-#  endif
-
-      /**
-       * Typedef for Tpetra::CrsMatrix
-       */
-      using MatrixType =
-        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, NodeType>;
-
-      /**
-       * Typedef for Tpetra::CrsGraph
-       */
-      using GraphType =
-        Tpetra::CrsGraph<int, dealii::types::signed_global_dof_index, NodeType>;
-
-      /**
-       * Typedef for Tpetra::Vector
-       */
-      using VectorType = Tpetra::
-        Vector<Number, int, dealii::types::signed_global_dof_index, NodeType>;
-
       /**
        * @name Constructors and initialization.
        */
@@ -1033,7 +993,7 @@ namespace LinearAlgebra
        * href="https://docs.trilinos.org/dev/packages/tpetra/doc/html/classTpetra_1_1CrsMatrix.html">Tpetra::CrsMatrix</a>
        * class.
        */
-      const MatrixType &
+      const TpetraTypes::MatrixType<Number, MemorySpace> &
       trilinos_matrix() const;
 
       /**
@@ -1042,7 +1002,7 @@ namespace LinearAlgebra
        * href="https://docs.trilinos.org/dev/packages/tpetra/doc/html/classTpetra_1_1CrsMatrix.html">Tpetra::CrsMatrix</a>
        * class.
        */
-      MatrixType &
+      TpetraTypes::MatrixType<Number, MemorySpace> &
       trilinos_matrix();
 
       /**
@@ -1054,7 +1014,7 @@ namespace LinearAlgebra
        * href="https://docs.trilinos.org/dev/packages/tpetra/doc/html/classTpetra_1_1CrsMatrix.html">Tpetra::CrsMatrix</a>
        * class.
        */
-      Teuchos::RCP<const MatrixType>
+      Teuchos::RCP<const TpetraTypes::MatrixType<Number, MemorySpace>>
       trilinos_rcp() const;
 
       /**
@@ -1066,7 +1026,7 @@ namespace LinearAlgebra
        * href="https://docs.trilinos.org/dev/packages/tpetra/doc/html/classTpetra_1_1CrsMatrix.html">Tpetra::CrsMatrix</a>
        * class.
        */
-      Teuchos::RCP<MatrixType>
+      Teuchos::RCP<TpetraTypes::MatrixType<Number, MemorySpace>>
       trilinos_rcp();
       /** @} */
 
@@ -1273,14 +1233,14 @@ namespace LinearAlgebra
        * information from the column space map is used to speed up the
        * assembly process.
        */
-      Teuchos::RCP<MapType> column_space_map;
+      Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> column_space_map;
 
       /**
        * A sparse matrix object in Trilinos to be used for finite element based
        * problems which allows for assembling into non-local elements.  The
        * actual type, a sparse matrix, is set in the constructor.
        */
-      Teuchos::RCP<MatrixType> matrix;
+      Teuchos::RCP<TpetraTypes::MatrixType<Number, MemorySpace>> matrix;
 
       /**
        * A boolean variable to hold information on whether the matrix is
@@ -1955,11 +1915,7 @@ namespace LinearAlgebra
 
 
     template <typename Number, typename MemorySpace>
-    inline const Tpetra::CrsMatrix<
-      Number,
-      int,
-      types::signed_global_dof_index,
-      typename SparseMatrix<Number, MemorySpace>::NodeType> &
+    inline const TpetraTypes::MatrixType<Number, MemorySpace> &
     SparseMatrix<Number, MemorySpace>::trilinos_matrix() const
     {
       return *matrix;
@@ -1968,11 +1924,7 @@ namespace LinearAlgebra
 
 
     template <typename Number, typename MemorySpace>
-    inline Tpetra::CrsMatrix<
-      Number,
-      int,
-      types::signed_global_dof_index,
-      typename SparseMatrix<Number, MemorySpace>::NodeType> &
+    inline TpetraTypes::MatrixType<Number, MemorySpace> &
     SparseMatrix<Number, MemorySpace>::trilinos_matrix()
     {
       return *matrix;
@@ -1981,11 +1933,7 @@ namespace LinearAlgebra
 
 
     template <typename Number, typename MemorySpace>
-    inline Teuchos::RCP<const Tpetra::CrsMatrix<
-      Number,
-      int,
-      types::signed_global_dof_index,
-      typename SparseMatrix<Number, MemorySpace>::NodeType>>
+    inline Teuchos::RCP<const TpetraTypes::MatrixType<Number, MemorySpace>>
     SparseMatrix<Number, MemorySpace>::trilinos_rcp() const
     {
       return matrix.getConst();
@@ -1994,11 +1942,7 @@ namespace LinearAlgebra
 
 
     template <typename Number, typename MemorySpace>
-    inline Teuchos::RCP<
-      Tpetra::CrsMatrix<Number,
-                        int,
-                        types::signed_global_dof_index,
-                        typename SparseMatrix<Number, MemorySpace>::NodeType>>
+    inline Teuchos::RCP<TpetraTypes::MatrixType<Number, MemorySpace>>
     SparseMatrix<Number, MemorySpace>::trilinos_rcp()
     {
       return matrix;
@@ -2102,10 +2046,10 @@ namespace LinearAlgebra
           }
 
 #  if DEAL_II_TRILINOS_VERSION_GTE(13, 2, 0)
-        typename SparseMatrix<Number, MemorySpace>::MatrixType::
+        typename TpetraTypes::MatrixType<Number, MemorySpace>::
           nonconst_global_inds_host_view_type col_indices(colnum_cache->data(),
                                                           colnums);
-        typename SparseMatrix<Number, MemorySpace>::MatrixType::
+        typename TpetraTypes::MatrixType<Number, MemorySpace>::
           nonconst_values_host_view_type values(value_cache->data(), colnums);
 #  else
         Teuchos::ArrayView<dealii::types::signed_global_dof_index> col_indices(
index efdb94cf396163d881a22e4e91a654dbe55a044b..be980905b26c48f1c1d741e508b3719f45d126ce 100644 (file)
 
 #include <deal.II/base/config.h>
 
+#include "deal.II/base/types.h"
+
+#include "deal.II/lac/trilinos_tpetra_types.h"
+
 #ifdef DEAL_II_TRILINOS_WITH_TPETRA
 
 #  include <deal.II/lac/dynamic_sparsity_pattern.h>
@@ -97,11 +101,11 @@ namespace LinearAlgebra
         // get a Kokkos::DualView
         auto mirror_view_dst = Kokkos::create_mirror_view_and_copy(
           typename MemorySpace::kokkos_space{}, kokkos_view_dst);
-        typename SparseMatrix<Number, MemorySpace>::VectorType::dual_view_type
+        typename TpetraTypes::VectorType<Number, MemorySpace>::dual_view_type
           kokkos_dual_view_dst(mirror_view_dst, kokkos_view_dst);
 
         // create the Tpetra::Vector
-        typename SparseMatrix<Number, MemorySpace>::VectorType tpetra_dst(
+        typename TpetraTypes::VectorType<Number, MemorySpace> tpetra_dst(
           M.trilinos_matrix().getRangeMap(), kokkos_dual_view_dst);
 
         // For the src vector:
@@ -112,11 +116,11 @@ namespace LinearAlgebra
         // get a Kokkos::DualView
         auto mirror_view_src = Kokkos::create_mirror_view_and_copy(
           typename MemorySpace::kokkos_space{}, kokkos_view_src);
-        typename SparseMatrix<Number, MemorySpace>::VectorType::dual_view_type
+        typename TpetraTypes::VectorType<Number, MemorySpace>::dual_view_type
           kokkos_dual_view_src(mirror_view_src, kokkos_view_src);
 
         // create the Tpetra::Vector
-        typename SparseMatrix<Number, MemorySpace>::VectorType tpetra_src(
+        typename TpetraTypes::VectorType<Number, MemorySpace> tpetra_src(
           M.trilinos_matrix().getDomainMap(), kokkos_dual_view_src);
 
         M.trilinos_matrix().apply(tpetra_src, tpetra_dst, mode, alpha, beta);
@@ -144,38 +148,24 @@ namespace LinearAlgebra
     {
       using size_type = dealii::types::signed_global_dof_index;
 
-      template <typename NodeType>
-      using MapType =
-        Tpetra::Map<int, dealii::types::signed_global_dof_index, NodeType>;
-
-      template <typename Number, typename NodeType>
-      using MatrixType =
-        Tpetra::CrsMatrix<Number,
-                          int,
-                          dealii::types::signed_global_dof_index,
-                          NodeType>;
-
-      template <typename NodeType>
-      using GraphType =
-        Tpetra::CrsGraph<int, dealii::types::signed_global_dof_index, NodeType>;
-
       template <typename Number,
-                typename NodeType,
+                typename MemorySpace,
                 typename SparsityPatternType>
       void
-      reinit_matrix(const IndexSet            &row_parallel_partitioning,
-                    const IndexSet            &column_parallel_partitioning,
-                    const SparsityPatternType &sparsity_pattern,
-                    const bool                 exchange_data,
-                    const MPI_Comm             communicator,
-                    Teuchos::RCP<MapType<NodeType>> &column_space_map,
-                    Teuchos::RCP<MatrixType<Number, NodeType>> &matrix)
+      reinit_matrix(
+        const IndexSet            &row_parallel_partitioning,
+        const IndexSet            &column_parallel_partitioning,
+        const SparsityPatternType &sparsity_pattern,
+        const bool                 exchange_data,
+        const MPI_Comm             communicator,
+        Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> &column_space_map,
+        Teuchos::RCP<TpetraTypes::MatrixType<Number, MemorySpace>> &matrix)
       {
         // release memory before reallocation
         matrix.reset();
 
         // Get the Tpetra::Maps
-        Teuchos::RCP<MapType<NodeType>> row_space_map =
+        Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> row_space_map =
           row_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
 
         column_space_map =
@@ -202,7 +192,7 @@ namespace LinearAlgebra
                                      communicator,
                                      exchange_data);
             matrix = Utilities::Trilinos::internal::make_rcp<
-              MatrixType<Number, NodeType>>(
+              TpetraTypes::MatrixType<Number, MemorySpace>>(
               trilinos_sparsity.trilinos_sparsity_pattern());
 
             return;
@@ -224,12 +214,14 @@ namespace LinearAlgebra
           // internal reordering is done on ints only, and we can leave the
           // doubles aside.
 #  if DEAL_II_TRILINOS_VERSION_GTE(12, 16, 0)
-        Teuchos::RCP<GraphType<NodeType>> graph =
-          Utilities::Trilinos::internal::make_rcp<GraphType<NodeType>>(
-            row_space_map, n_entries_per_row);
+        Teuchos::RCP<TpetraTypes::GraphType<MemorySpace>> graph =
+          Utilities::Trilinos::internal::make_rcp<
+            TpetraTypes::GraphType<MemorySpace>>(row_space_map,
+                                                 n_entries_per_row);
 #  else
-        Teuchos::RCP<GraphType<NodeType>> graph =
-          Utilities::Trilinos::internal::make_rcp<GraphType<NodeType>>(
+        Teuchos::RCP<TpetraTypes::GraphType<MemorySpace>> graph =
+          Utilities::Trilinos::internal::make_rcp<
+            TpetraTypes::GraphType<MemorySpace>>(
             row_space_map, Teuchos::arcpFromArray(n_entries_per_row));
 #  endif
 
@@ -266,28 +258,28 @@ namespace LinearAlgebra
         AssertDimension(sparsity_pattern.n_cols(), graph->getGlobalNumCols());
 
         // And now finally generate the matrix.
-        matrix =
-          Utilities::Trilinos::internal::make_rcp<MatrixType<Number, NodeType>>(
-            graph);
+        matrix = Utilities::Trilinos::internal::make_rcp<
+          TpetraTypes::MatrixType<Number, MemorySpace>>(graph);
       }
 
 
 
-      template <typename Number, typename NodeType>
+      template <typename Number, typename MemorySpace>
       void
-      reinit_matrix(const IndexSet               &row_parallel_partitioning,
-                    const IndexSet               &column_parallel_partitioning,
-                    const DynamicSparsityPattern &sparsity_pattern,
-                    const bool                    exchange_data,
-                    const MPI_Comm                communicator,
-                    Teuchos::RCP<MapType<NodeType>> &column_space_map,
-                    Teuchos::RCP<MatrixType<Number, NodeType>> &matrix)
+      reinit_matrix(
+        const IndexSet               &row_parallel_partitioning,
+        const IndexSet               &column_parallel_partitioning,
+        const DynamicSparsityPattern &sparsity_pattern,
+        const bool                    exchange_data,
+        const MPI_Comm                communicator,
+        Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> &column_space_map,
+        Teuchos::RCP<TpetraTypes::MatrixType<Number, MemorySpace>> &matrix)
       {
         // release memory before reallocation
         matrix.reset();
 
         // Get the Tpetra::Maps
-        Teuchos::RCP<MapType<NodeType>> row_space_map =
+        Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> row_space_map =
           row_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
 
         column_space_map =
@@ -314,7 +306,7 @@ namespace LinearAlgebra
                                      communicator,
                                      exchange_data);
             matrix = Utilities::Trilinos::internal::make_rcp<
-              MatrixType<Number, NodeType>>(
+              TpetraTypes::MatrixType<Number, MemorySpace>>(
               trilinos_sparsity.trilinos_sparsity_pattern());
 
             return;
@@ -355,12 +347,14 @@ namespace LinearAlgebra
         // internal reordering is done on ints only, and we can leave the
         // doubles aside.
 #  if DEAL_II_TRILINOS_VERSION_GTE(12, 16, 0)
-        Teuchos::RCP<GraphType<NodeType>> graph =
-          Utilities::Trilinos::internal::make_rcp<GraphType<NodeType>>(
-            row_space_map, n_entries_per_row);
+        Teuchos::RCP<TpetraTypes::GraphType<MemorySpace>> graph =
+          Utilities::Trilinos::internal::make_rcp<
+            TpetraTypes::GraphType<MemorySpace>>(row_space_map,
+                                                 n_entries_per_row);
 #  else
-        Teuchos::RCP<GraphType<NodeType>> graph =
-          Utilities::Trilinos::internal::make_rcp<GraphType<NodeType>>(
+        Teuchos::RCP<TpetraTypes::GraphType<MemorySpace>> graph =
+          Utilities::Trilinos::internal::make_rcp<
+            TpetraTypes::GraphType<MemorySpace>>(
             row_space_map, Teuchos::arcpFromArray(n_entries_per_row));
 #  endif
 
@@ -396,9 +390,8 @@ namespace LinearAlgebra
         AssertDimension(sparsity_pattern.n_cols(), graph->getGlobalNumCols());
 
         // And now finally generate the matrix.
-        matrix =
-          Utilities::Trilinos::internal::make_rcp<MatrixType<Number, NodeType>>(
-            graph);
+        matrix = Utilities::Trilinos::internal::make_rcp<
+          TpetraTypes::MatrixType<Number, MemorySpace>>(graph);
       }
     } // namespace SparseMatrixImpl
 
@@ -413,20 +406,23 @@ namespace LinearAlgebra
     // thread on a configuration with MPI will still get a parallel interface.
     template <typename Number, typename MemorySpace>
     SparseMatrix<Number, MemorySpace>::SparseMatrix()
-      : column_space_map(Utilities::Trilinos::internal::make_rcp<MapType>(
+      : column_space_map(Utilities::Trilinos::internal::make_rcp<
+                         TpetraTypes::MapType<MemorySpace>>(
           0,
           0,
           Utilities::Trilinos::tpetra_comm_self()))
     {
       // Prepare the graph
-      Teuchos::RCP<GraphType> graph =
-        Utilities::Trilinos::internal::make_rcp<GraphType>(column_space_map,
-                                                           column_space_map,
-                                                           0);
+      Teuchos::RCP<TpetraTypes::GraphType<MemorySpace>> graph =
+        Utilities::Trilinos::internal::make_rcp<
+          TpetraTypes::GraphType<MemorySpace>>(column_space_map,
+                                               column_space_map,
+                                               0);
       graph->fillComplete();
 
       // Create the matrix from the graph
-      matrix = Utilities::Trilinos::internal::make_rcp<MatrixType>(graph);
+      matrix = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::MatrixType<Number, MemorySpace>>(graph);
 
       compressed = false;
     }
@@ -436,11 +432,13 @@ namespace LinearAlgebra
     template <typename Number, typename MemorySpace>
     SparseMatrix<Number, MemorySpace>::SparseMatrix(
       const SparsityPattern<MemorySpace> &sparsity_pattern)
-      : matrix(Utilities::Trilinos::internal::make_rcp<MatrixType>(
+      : matrix(Utilities::Trilinos::internal::make_rcp<
+               TpetraTypes::MatrixType<Number, MemorySpace>>(
           sparsity_pattern.trilinos_sparsity_pattern()))
     {
       column_space_map =
-        Teuchos::rcp_const_cast<MapType>(sparsity_pattern.domain_partitioner());
+        Teuchos::rcp_const_cast<TpetraTypes::MapType<MemorySpace>>(
+          sparsity_pattern.domain_partitioner());
       compressed = false;
       compress(VectorOperation::add);
     }
@@ -452,13 +450,16 @@ namespace LinearAlgebra
       const size_type    m,
       const size_type    n,
       const unsigned int n_max_entries_per_row)
-      : column_space_map(Utilities::Trilinos::internal::make_rcp<MapType>(
-          n,
+      : column_space_map(Utilities::Trilinos::internal::make_rcp<
+                         TpetraTypes::MapType<MemorySpace>>(
+          static_cast<dealii::types::signed_global_dof_index>(n),
           0,
           Utilities::Trilinos::tpetra_comm_self()))
-      , matrix(Utilities::Trilinos::internal::make_rcp<MatrixType>(
-          Utilities::Trilinos::internal::make_rcp<MapType>(
-            m,
+      , matrix(Utilities::Trilinos::internal::make_rcp<
+               TpetraTypes::MatrixType<Number, MemorySpace>>(
+          Utilities::Trilinos::internal::make_rcp<
+            TpetraTypes::MapType<MemorySpace>>(
+            static_cast<dealii::types::signed_global_dof_index>(m),
             0,
             Utilities::Trilinos::tpetra_comm_self()),
           column_space_map,
@@ -473,7 +474,8 @@ namespace LinearAlgebra
       const size_type                  m,
       const size_type                  n,
       const std::vector<unsigned int> &n_entries_per_row)
-      : column_space_map(Utilities::Trilinos::internal::make_rcp<MapType>(
+      : column_space_map(Utilities::Trilinos::internal::make_rcp<
+                         TpetraTypes::MapType<MemorySpace>>(
           n,
           0,
           Utilities::Trilinos::tpetra_comm_self()))
@@ -481,8 +483,10 @@ namespace LinearAlgebra
     {
       std::vector<size_t> entries_per_row_size_type(n_entries_per_row.begin(),
                                                     n_entries_per_row.end());
-      matrix = Utilities::Trilinos::internal::make_rcp<MatrixType>(
-        Utilities::Trilinos::internal::make_rcp<MapType>(
+      matrix = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::MatrixType<Number, MemorySpace>>(
+        Utilities::Trilinos::internal::make_rcp<
+          TpetraTypes::MapType<MemorySpace>>(
           m, 0, Utilities::Trilinos::tpetra_comm_self()),
         column_space_map,
 #  if DEAL_II_TRILINOS_VERSION_GTE(13, 2, 0)
@@ -530,7 +534,7 @@ namespace LinearAlgebra
     SparseMatrix<Number, MemorySpace>::reinit(
       const SparsityPatternType &sparsity_pattern)
     {
-      SparseMatrixImpl::reinit_matrix<Number, NodeType, SparsityPatternType>(
+      SparseMatrixImpl::reinit_matrix<Number, MemorySpace, SparsityPatternType>(
         complete_index_set(sparsity_pattern.n_rows()),
         complete_index_set(sparsity_pattern.n_cols()),
         sparsity_pattern,
@@ -555,8 +559,10 @@ namespace LinearAlgebra
 
       // reinit with a (distributed) Trilinos sparsity pattern.
       column_space_map =
-        Teuchos::rcp_const_cast<MapType>(sparsity_pattern.domain_partitioner());
-      matrix = Utilities::Trilinos::internal::make_rcp<MatrixType>(
+        Teuchos::rcp_const_cast<TpetraTypes::MapType<MemorySpace>>(
+          sparsity_pattern.domain_partitioner());
+      matrix = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::MatrixType<Number, MemorySpace>>(
         sparsity_pattern.trilinos_sparsity_pattern());
 
       compressed = false;
@@ -574,7 +580,8 @@ namespace LinearAlgebra
       const unsigned int n_max_entries_per_row)
       : column_space_map(
           parallel_partitioning.make_tpetra_map_rcp(communicator, false))
-      , matrix(Utilities::Trilinos::internal::make_rcp<MatrixType>(
+      , matrix(Utilities::Trilinos::internal::make_rcp<
+               TpetraTypes::MatrixType<Number, MemorySpace>>(
           column_space_map,
           n_max_entries_per_row))
       , compressed(false)
@@ -594,10 +601,12 @@ namespace LinearAlgebra
       Teuchos::Array<size_t> n_entries_per_row_array(n_entries_per_row.begin(),
                                                      n_entries_per_row.end());
 #  if DEAL_II_TRILINOS_VERSION_GTE(12, 16, 0)
-      matrix = Utilities::Trilinos::internal::make_rcp<MatrixType>(
-        column_space_map, n_entries_per_row_array);
+      matrix = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::MatrixType<Number, MemorySpace>>(column_space_map,
+                                                      n_entries_per_row_array);
 #  else
-      matrix = Utilities::Trilinos::internal::make_rcp<MatrixType>(
+      matrix = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::MatrixType<Number, MemorySpace>>(
         column_space_map, Teuchos::arcpFromArray(n_entries_per_row_array));
 #  endif
     }
@@ -612,7 +621,8 @@ namespace LinearAlgebra
       const size_type n_max_entries_per_row)
       : column_space_map(
           col_parallel_partitioning.make_tpetra_map_rcp(communicator, false))
-      , matrix(Utilities::Trilinos::internal::make_rcp<MatrixType>(
+      , matrix(Utilities::Trilinos::internal::make_rcp<
+               TpetraTypes::MatrixType<Number, MemorySpace>>(
           row_parallel_partitioning.make_tpetra_map_rcp(communicator, false),
           n_max_entries_per_row))
       , compressed(false)
@@ -633,11 +643,13 @@ namespace LinearAlgebra
       Teuchos::Array<size_t> n_entries_per_row_array(n_entries_per_row.begin(),
                                                      n_entries_per_row.end());
 #  if DEAL_II_TRILINOS_VERSION_GTE(12, 16, 0)
-      matrix = Utilities::Trilinos::internal::make_rcp<MatrixType>(
+      matrix = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::MatrixType<Number, MemorySpace>>(
         row_parallel_partitioning.make_tpetra_map_rcp(communicator, false),
         n_entries_per_row_array);
 #  else
-      matrix = Utilities::Trilinos::internal::make_rcp<MatrixType>(
+      matrix = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::MatrixType<Number, MemorySpace>>(
         row_parallel_partitioning.make_tpetra_map_rcp(communicator, false),
         Teuchos::arcpFromArray(n_entries_per_row_array));
 #  endif
@@ -675,7 +687,7 @@ namespace LinearAlgebra
       const MPI_Comm             communicator,
       const bool                 exchange_data)
     {
-      SparseMatrixImpl::reinit_matrix<Number, NodeType, SparsityPatternType>(
+      SparseMatrixImpl::reinit_matrix<Number, MemorySpace, SparsityPatternType>(
         row_parallel_partitioning,
         col_parallel_partitioning,
         sparsity_pattern,
@@ -1200,8 +1212,12 @@ namespace LinearAlgebra
                                 matrix->getDomainMap(),
                                 matrix->getRangeMap(),
                                 Teuchos::null);
+      // needs a local typedef or Assert thinks it gets more arguments than it
+      // does...
+      using MatrixType = TpetraTypes::MatrixType<Number, MemorySpace>;
       Assert(dynamic_cast<MatrixType *>(result.get()), ExcInternalError());
-      matrix.reset(dynamic_cast<MatrixType *>(result.release().get()));
+      matrix.reset(dynamic_cast<TpetraTypes::MatrixType<Number, MemorySpace> *>(
+        result.release().get()));
     }
 
 
@@ -1243,10 +1259,12 @@ namespace LinearAlgebra
               col_indices_vector.resize(nnz);
               values_vector.resize(nnz);
 #  if DEAL_II_TRILINOS_VERSION_GTE(13, 2, 0)
-              typename MatrixType::nonconst_local_inds_host_view_type
-                col_indices(col_indices_vector.data(), nnz);
-              typename MatrixType::nonconst_values_host_view_type values(
-                values_vector.data(), nnz);
+              typename TpetraTypes::MatrixType<Number, MemorySpace>::
+                nonconst_local_inds_host_view_type col_indices(
+                  col_indices_vector.data(), nnz);
+              typename TpetraTypes::MatrixType<Number, MemorySpace>::
+                nonconst_values_host_view_type values(values_vector.data(),
+                                                      nnz);
 #  else
               Teuchos::ArrayView<int>    col_indices(col_indices_vector);
               Teuchos::ArrayView<Number> values(values_vector);
@@ -1293,15 +1311,17 @@ namespace LinearAlgebra
 
       // Perform a deep copy
 #  if DEAL_II_TRILINOS_VERSION_GTE(12, 18, 1)
-      matrix =
-        Utilities::Trilinos::internal::make_rcp<MatrixType>(*source.matrix,
-                                                            Teuchos::Copy);
+      matrix = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::MatrixType<Number, MemorySpace>>(*source.matrix,
+                                                      Teuchos::Copy);
 #  else
       matrix = source.matrix->clone(
         Utilities::Trilinos::internal::make_rcp<NodeType>());
 #  endif
-      column_space_map = Teuchos::rcp_const_cast<MapType>(matrix->getColMap());
-      compressed       = source.compressed;
+      column_space_map =
+        Teuchos::rcp_const_cast<TpetraTypes::MapType<MemorySpace>>(
+          matrix->getColMap());
+      compressed = source.compressed;
     }
 
 
@@ -1313,18 +1333,21 @@ namespace LinearAlgebra
       // When we clear the matrix, reset
       // the pointer and generate an
       // empty matrix.
-      column_space_map = Utilities::Trilinos::internal::make_rcp<MapType>(
+      column_space_map = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::MapType<MemorySpace>>(
         0, 0, Utilities::Trilinos::tpetra_comm_self());
 
       // Prepare the graph
-      Teuchos::RCP<GraphType> graph =
-        Utilities::Trilinos::internal::make_rcp<GraphType>(column_space_map,
-                                                           column_space_map,
-                                                           0);
+      Teuchos::RCP<TpetraTypes::GraphType<MemorySpace>> graph =
+        Utilities::Trilinos::internal::make_rcp<
+          TpetraTypes::GraphType<MemorySpace>>(column_space_map,
+                                               column_space_map,
+                                               0);
       graph->fillComplete();
 
       // Create the matrix from the graph
-      matrix = Utilities::Trilinos::internal::make_rcp<MatrixType>(graph);
+      matrix = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::MatrixType<Number, MemorySpace>>(graph);
 
       compressed = true;
     }
@@ -1402,8 +1425,11 @@ namespace LinearAlgebra
       else
         {
 #  if DEAL_II_TRILINOS_VERSION_GTE(13, 2, 0)
-          typename MatrixType::values_host_view_type     values;
-          typename MatrixType::local_inds_host_view_type indices;
+          typename TpetraTypes::MatrixType<Number,
+                                           MemorySpace>::values_host_view_type
+            values;
+          typename TpetraTypes::MatrixType<Number, MemorySpace>::
+            local_inds_host_view_type indices;
 #  else
           Teuchos::ArrayView<const Number> values;
           Teuchos::ArrayView<const int>    indices;
@@ -1482,10 +1508,11 @@ namespace LinearAlgebra
           // Prepare pointers for extraction of a view of the row.
           size_t nnz_present = matrix->getNumEntriesInLocalRow(trilinos_i);
 #  if DEAL_II_TRILINOS_VERSION_GTE(13, 2, 0)
-          typename MatrixType::nonconst_local_inds_host_view_type col_indices(
-            "indices", nnz_present);
-          typename MatrixType::nonconst_values_host_view_type values(
-            "values", nnz_present);
+          typename TpetraTypes::MatrixType<Number, MemorySpace>::
+            nonconst_local_inds_host_view_type col_indices("indices",
+                                                           nnz_present);
+          typename TpetraTypes::MatrixType<Number, MemorySpace>::
+            nonconst_values_host_view_type values("values", nnz_present);
 #  else
           std::vector<int>           col_indices_vector(nnz_present);
           Teuchos::ArrayView<int>    col_indices(col_indices_vector);
index 3bd929ca6a9ae21d84af070200d0ec44e6153cd9..ed209670a487fcbd558299ec7f2e288ecc5ca103 100644 (file)
 
 #include <deal.II/base/config.h>
 
+#include "deal.II/base/types.h"
+
+#include "deal.II/lac/trilinos_tpetra_types.h"
+
 #ifdef DEAL_II_TRILINOS_WITH_TPETRA
 
 #  include <deal.II/base/index_set.h>
@@ -83,20 +87,7 @@ namespace LinearAlgebra
         /**
          * Declare type for container size.
          */
-        using size_type = dealii::types::signed_global_dof_index;
-
-        /**
-         * Typedef for the NodeType
-         */
-#  if DEAL_II_TRILINOS_VERSION_GTE(14, 2, 0)
-        using NodeType = Tpetra::KokkosCompat::KokkosDeviceWrapperNode<
-          typename MemorySpace::kokkos_space::execution_space,
-          typename MemorySpace::kokkos_space>;
-#  else
-        using NodeType = Kokkos::Compat::KokkosDeviceWrapperNode<
-          typename MemorySpace::kokkos_space::execution_space,
-          typename MemorySpace::kokkos_space>;
-#  endif
+        using size_type = dealii::types::global_dof_index;
 
         /**
          * Constructor.
@@ -195,20 +186,7 @@ namespace LinearAlgebra
         /**
          * Declare type for container size.
          */
-        using size_type = size_t;
-
-        /**
-         * Typedef for the NodeType
-         */
-#  if DEAL_II_TRILINOS_VERSION_GTE(14, 2, 0)
-        using NodeType = Tpetra::KokkosCompat::KokkosDeviceWrapperNode<
-          typename MemorySpace::kokkos_space::execution_space,
-          typename MemorySpace::kokkos_space>;
-#  else
-        using NodeType = Kokkos::Compat::KokkosDeviceWrapperNode<
-          typename MemorySpace::kokkos_space::execution_space,
-          typename MemorySpace::kokkos_space>;
-#  endif
+        using size_type = types::global_dof_index;
 
         /**
          * Constructor. Create an iterator into the matrix @p matrix for the
@@ -313,39 +291,12 @@ namespace LinearAlgebra
       /**
        * Declare type for container size.
        */
-      using size_type = dealii::types::signed_global_dof_index;
-
-      /**
-       * Typedef for the NodeType
-       */
-#  if DEAL_II_TRILINOS_VERSION_GTE(14, 2, 0)
-      using NodeType = Tpetra::KokkosCompat::KokkosDeviceWrapperNode<
-        typename MemorySpace::kokkos_space::execution_space,
-        typename MemorySpace::kokkos_space>;
-#  else
-      using NodeType = Kokkos::Compat::KokkosDeviceWrapperNode<
-        typename MemorySpace::kokkos_space::execution_space,
-        typename MemorySpace::kokkos_space>;
-#  endif
-
+      using size_type = dealii::types::global_dof_index;
       /**
        * Declare an alias for the iterator class.
        */
       using const_iterator = SparsityPatternIterators::Iterator<MemorySpace>;
 
-      /**
-       * Typedef for Tpetra::Map
-       */
-      using MapType =
-        Tpetra::Map<int, dealii::types::signed_global_dof_index, NodeType>;
-
-      /**
-       * Typedef for Tpetra::Graph
-       */
-      using GraphType =
-        Tpetra::CrsGraph<int, dealii::types::signed_global_dof_index, NodeType>;
-
-
       /**
        * @name Basic constructors and initialization
        */
@@ -854,7 +805,7 @@ namespace LinearAlgebra
        * Return a Teuchos::RCP to the underlying Trilinos Tpetra::CrsGraph
        * data that stores the sparsity pattern.
        */
-      Teuchos::RCP<GraphType>
+      Teuchos::RCP<TpetraTypes::GraphType<MemorySpace>>
       trilinos_sparsity_pattern() const;
 
       /**
@@ -863,7 +814,7 @@ namespace LinearAlgebra
        * pattern, i.e., the partitioning of the vectors matrices based on this
        * sparsity pattern are multiplied with.
        */
-      Teuchos::RCP<const MapType>
+      Teuchos::RCP<const TpetraTypes::MapType<MemorySpace>>
       domain_partitioner() const;
 
       /**
@@ -872,7 +823,7 @@ namespace LinearAlgebra
        * i.e., the partitioning of the vectors that are result from matrix-
        * vector products.
        */
-      Teuchos::RCP<const MapType>
+      Teuchos::RCP<const TpetraTypes::MapType<MemorySpace>>
       range_partitioner() const;
 
       /**
@@ -1036,14 +987,14 @@ namespace LinearAlgebra
        * Teuchos::RCP to the user-supplied Tpetra Trilinos mapping of the matrix
        * columns that assigns parts of the matrix to the individual processes.
        */
-      Teuchos::RCP<MapType> column_space_map;
+      Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> column_space_map;
 
       /**
        * A sparsity pattern object in Trilinos to be used for finite element
        * based problems which allows for adding non-local elements to the
        * pattern.
        */
-      Teuchos::RCP<GraphType> graph;
+      Teuchos::RCP<TpetraTypes::GraphType<MemorySpace>> graph;
 
       /**
        * A sparsity pattern object for the non-local part of the sparsity
@@ -1051,7 +1002,7 @@ namespace LinearAlgebra
        * when the particular constructor or reinit method with writable_rows
        * argument is set
        */
-      Teuchos::RCP<GraphType> nonlocal_graph;
+      Teuchos::RCP<TpetraTypes::GraphType<MemorySpace>> nonlocal_graph;
 
       // TODO: currently only for double
       friend class SparseMatrix<double, MemorySpace>;
@@ -1274,9 +1225,7 @@ namespace LinearAlgebra
       // place the iterator on the first entry
       // past this line, or at the end of the
       // matrix
-      for (size_type i = r + 1;
-           i < static_cast<dealii::types::signed_global_dof_index>(n_rows());
-           ++i)
+      for (size_type i = r + 1; i < n_rows(); ++i)
         if (row_length(i) > 0)
           return const_iterator(this, i, 0);
 
@@ -1392,10 +1341,9 @@ namespace LinearAlgebra
 
 
     template <typename MemorySpace>
-    inline Teuchos::RCP<
-      Tpetra::CrsGraph<int,
-                       dealii::types::signed_global_dof_index,
-                       typename SparsityPattern<MemorySpace>::NodeType>>
+    inline Teuchos::RCP<Tpetra::CrsGraph<int,
+                                         dealii::types::signed_global_dof_index,
+                                         TpetraTypes::NodeType<MemorySpace>>>
     SparsityPattern<MemorySpace>::trilinos_sparsity_pattern() const
     {
       return graph;
diff --git a/include/deal.II/lac/trilinos_tpetra_types.h b/include/deal.II/lac/trilinos_tpetra_types.h
new file mode 100644 (file)
index 0000000..5dda027
--- /dev/null
@@ -0,0 +1,137 @@
+// ------------------------------------------------------------------------
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+// Copyright (C) 2018 - 2024 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// Part of the source code is dual licensed under Apache-2.0 WITH
+// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
+// governing the source code and code contributions can be found in
+// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
+//
+// ------------------------------------------------------------------------
+
+#ifndef dealii_trilinos_tpetra_types_h
+#define dealii_trilinos_tpetra_types_h
+
+#include <deal.II/base/config.h>
+
+#include "deal.II/base/types.h"
+
+#ifdef DEAL_II_TRILINOS_WITH_TPETRA
+
+#  include <Tpetra_Details_DefaultTypes.hpp>
+
+// Forward declarations
+#  ifndef DOXYGEN
+#    include <Tpetra_CrsGraph_fwd.hpp>
+#    include <Tpetra_CrsMatrix_fwd.hpp>
+#    include <Tpetra_Export_fwd.hpp>
+#    include <Tpetra_Import_fwd.hpp>
+#    include <Tpetra_Map_fwd.hpp>
+#    include <Tpetra_MultiVector_fwd.hpp>
+#    include <Tpetra_Operator_fwd.hpp>
+#    include <Tpetra_Vector_fwd.hpp>
+
+#  endif
+
+DEAL_II_NAMESPACE_OPEN
+
+namespace LinearAlgebra
+{
+  namespace TpetraWrappers
+  {
+
+    namespace TpetraTypes
+    {
+      /**
+       * local ordinate (processor local indices).
+       */
+      using LO = int;
+      /**
+       * global ordinate (global indices).
+       */
+      using GO = types::signed_global_dof_index;
+
+
+#  if DEAL_II_TRILINOS_VERSION_GTE(14, 2, 0)
+      /**
+       * Where and how calculations should be executed,
+       * i.e. Host (Serial,OpenMP) or Device (GPU)
+       */
+      //
+      template <typename MemorySpace>
+      using NodeType = Tpetra::KokkosCompat::KokkosDeviceWrapperNode<
+        typename MemorySpace::kokkos_space::execution_space,
+        typename MemorySpace::kokkos_space>;
+#  else
+      template <typename MemorySpace>
+      using NodeType = Kokkos::Compat::KokkosDeviceWrapperNode<
+        typename MemorySpace::kokkos_space::execution_space,
+        typename MemorySpace::kokkos_space>;
+#  endif
+
+
+      /**
+       * Communication between processors.
+       */
+      template <typename MemorySpace>
+      using ExportType = Tpetra::Export<LO, GO, NodeType<MemorySpace>>;
+
+      /**
+       * Communication between processors.
+       */
+      template <typename MemorySpace>
+      using ImportType = Tpetra::Import<LO, GO, NodeType<MemorySpace>>;
+
+      /**
+       * Tpetra equivalent of IndexSet.
+       */
+      template <typename MemorySpace>
+      using MapType = Tpetra::Map<LO, GO, NodeType<MemorySpace>>;
+
+      /**
+       * Tpetra sparsity pattern type.
+       */
+      template <typename MemorySpace>
+      using GraphType = Tpetra::CrsGraph<LO, GO, NodeType<MemorySpace>>;
+
+      /**
+       * Tpetra Vector type.
+       */
+      template <typename Number, typename MemorySpace>
+      using VectorType = Tpetra::Vector<Number, LO, GO, NodeType<MemorySpace>>;
+
+      /**
+       * Tpetra type for a row column vectors.
+       */
+      template <typename Number, typename MemorySpace>
+      using MultiVectorType =
+        Tpetra::MultiVector<Number, LO, GO, NodeType<MemorySpace>>;
+
+
+      /**
+       * General Tpetra class for a linear operator,
+       * e.g. a Matrix or Preconditioner.
+       *
+       */
+      template <typename Number, typename MemorySpace>
+      using LinearOperator =
+        Tpetra::Operator<Number, LO, GO, NodeType<MemorySpace>>;
+
+
+      /**
+       * Tpetra type for a parallel distributed sparse matrix in Crs or CSR
+       * format.
+       */
+      template <typename Number, typename MemorySpace>
+      using MatrixType =
+        Tpetra::CrsMatrix<Number, LO, GO, NodeType<MemorySpace>>;
+    } // namespace TpetraTypes
+  }   // namespace TpetraWrappers
+} // namespace LinearAlgebra
+DEAL_II_NAMESPACE_CLOSE
+#endif
+
+#endif
index 8e44eb0b49d97ee09cd43805783b89acb3e2a211..8af54bcc45298143a46082c5c70a90b02dcbc198 100644 (file)
 
 #include <deal.II/base/config.h>
 
+#include "deal.II/base/types.h"
+
+#include <deal.II/lac/trilinos_tpetra_types.h>
+
 #ifdef DEAL_II_TRILINOS_WITH_TPETRA
 
 #  include <deal.II/base/index_set.h>
@@ -100,6 +104,7 @@ namespace LinearAlgebra
    */
   namespace TpetraWrappers
   {
+
     /**
      * This class defines type aliases that are used in vector classes
      * within the TpetraWrappers namespace.
@@ -107,7 +112,7 @@ namespace LinearAlgebra
     class VectorTraits
     {
     public:
-      using size_type = dealii::types::global_dof_index;
+      using size_type = types::global_dof_index;
     };
 
     /**
@@ -125,7 +130,7 @@ namespace LinearAlgebra
       /**
        * Declare type for container size.
        */
-      using size_type = VectorTraits::size_type;
+      using size_type = types::global_dof_index;
 
       /**
        * This class implements a wrapper for accessing the Trilinos Tpetra
@@ -286,29 +291,12 @@ namespace LinearAlgebra
       /**
        * Declare some of the standard types used in all containers.
        */
-#  if DEAL_II_TRILINOS_VERSION_GTE(14, 2, 0)
-      using NodeType = Tpetra::KokkosCompat::KokkosDeviceWrapperNode<
-        typename MemorySpace::kokkos_space::execution_space,
-        typename MemorySpace::kokkos_space>;
-#  else
-      using NodeType = Kokkos::Compat::KokkosDeviceWrapperNode<
-        typename MemorySpace::kokkos_space::execution_space,
-        typename MemorySpace::kokkos_space>;
-#  endif
       using value_type = Number;
       using real_type  = typename numbers::NumberTraits<Number>::real_type;
-      using size_type  = VectorTraits::size_type;
+      using size_type  = types::global_dof_index;
       using reference  = internal::VectorReference<Number, MemorySpace>;
       using const_reference =
         const internal::VectorReference<Number, MemorySpace>;
-      using MapType =
-        Tpetra::Map<int, dealii::types::signed_global_dof_index, NodeType>;
-      using VectorType = Tpetra::
-        Vector<Number, int, dealii::types::signed_global_dof_index, NodeType>;
-      using ExportType =
-        Tpetra::Export<int, dealii::types::signed_global_dof_index, NodeType>;
-      using ImportType =
-        Tpetra::Import<int, dealii::types::signed_global_dof_index, NodeType>;
 
       /**
        * @name 1: Basic Object-handling
@@ -330,7 +318,8 @@ namespace LinearAlgebra
       /**
        *  Copy constructor from Teuchos::RCP<Tpetra::Vector>.
        */
-      Vector(const Teuchos::RCP<VectorType> V);
+      Vector(
+        const Teuchos::RCP<TpetraTypes::VectorType<Number, MemorySpace>> V);
 
       /**
        * TODO: This is not used
@@ -912,29 +901,28 @@ namespace LinearAlgebra
        * Return a const reference to the underlying Trilinos
        * Tpetra::Vector class.
        */
-      const Tpetra::Vector<Number, int, types::signed_global_dof_index> &
+      const TpetraTypes::VectorType<Number, MemorySpace> &
       trilinos_vector() const;
 
       /**
        * Return a (modifiable) reference to the underlying Trilinos
        * Tpetra::Vector class.
        */
-      Tpetra::Vector<Number, int, types::signed_global_dof_index> &
+      TpetraTypes::VectorType<Number, MemorySpace> &
       trilinos_vector();
 
       /**
        * Return a const Teuchos::RCP to the underlying Trilinos
        * Tpetra::Vector class.
        */
-      Teuchos::RCP<
-        const Tpetra::Vector<Number, int, types::signed_global_dof_index>>
+      Teuchos::RCP<const TpetraTypes::VectorType<Number, MemorySpace>>
       trilinos_rcp() const;
 
       /**
        * Return a (modifiable) Teuchos::RCP to the underlying Trilinos
        * Tpetra::Vector class.
        */
-      Teuchos::RCP<Tpetra::Vector<Number, int, types::signed_global_dof_index>>
+      Teuchos::RCP<TpetraTypes::VectorType<Number, MemorySpace>>
       trilinos_rcp();
 
       /**
@@ -1056,14 +1044,15 @@ namespace LinearAlgebra
       /**
        * Teuchos::RCP to the actual Tpetra vector object.
        */
-      Teuchos::RCP<VectorType> vector;
+      Teuchos::RCP<TpetraTypes::VectorType<Number, MemorySpace>> vector;
 
       /**
        * A vector object in Trilinos to be used for collecting the non-local
        * elements if the vector was constructed with an additional IndexSet
        * describing ghost elements.
        */
-      Teuchos::RCP<VectorType> nonlocal_vector;
+      Teuchos::RCP<TpetraTypes::VectorType<Number, MemorySpace>>
+        nonlocal_vector;
 
       /**
        * IndexSet of the elements of the last imported vector.
index c28a18481c4ecefdbc42062508723da4e7a2964e..0a3cd3ffed80fe4b4db92776c7151336e2b84b9d 100644 (file)
@@ -81,11 +81,10 @@ namespace LinearAlgebra
       : Subscriptor()
       , compressed(true)
       , has_ghost(false)
-      , vector(Utilities::Trilinos::internal::make_rcp<VectorType>(
-          Utilities::Trilinos::internal::make_rcp<MapType>(
-            0,
-            0,
-            Utilities::Trilinos::tpetra_comm_self())))
+      , vector(Utilities::Trilinos::internal::make_rcp<
+               TpetraTypes::VectorType<Number, MemorySpace>>(
+          Utilities::Trilinos::internal::make_rcp<TpetraTypes::MapType<
+            MemorySpace>>(0, 0, Utilities::Trilinos::tpetra_comm_self())))
     {}
 
 
@@ -95,19 +94,21 @@ namespace LinearAlgebra
       : Subscriptor()
       , compressed(V.compressed)
       , has_ghost(V.has_ghost)
-      , vector(
-          Utilities::Trilinos::internal::make_rcp<VectorType>(*V.vector,
-                                                              Teuchos::Copy))
+      , vector(Utilities::Trilinos::internal::make_rcp<
+               TpetraTypes::VectorType<Number, MemorySpace>>(*V.vector,
+                                                             Teuchos::Copy))
     {
       if (!V.nonlocal_vector.is_null())
-        nonlocal_vector = Utilities::Trilinos::internal::make_rcp<VectorType>(
-          *V.nonlocal_vector, Teuchos::Copy);
+        nonlocal_vector = Utilities::Trilinos::internal::make_rcp<
+          TpetraTypes::VectorType<Number, MemorySpace>>(*V.nonlocal_vector,
+                                                        Teuchos::Copy);
     }
 
 
 
     template <typename Number, typename MemorySpace>
-    Vector<Number, MemorySpace>::Vector(const Teuchos::RCP<VectorType> V)
+    Vector<Number, MemorySpace>::Vector(
+      const Teuchos::RCP<TpetraTypes::VectorType<Number, MemorySpace>> V)
       : Subscriptor()
       , compressed(true)
       , has_ghost(V->getMap()->isOneToOne() == false)
@@ -122,7 +123,8 @@ namespace LinearAlgebra
       : Subscriptor()
       , compressed(true)
       , has_ghost(false)
-      , vector(Utilities::Trilinos::internal::make_rcp<VectorType>(
+      , vector(Utilities::Trilinos::internal::make_rcp<
+               TpetraTypes::VectorType<Number, MemorySpace>>(
           parallel_partitioner.make_tpetra_map_rcp(communicator, true)))
     {}
 
@@ -140,20 +142,23 @@ namespace LinearAlgebra
           IndexSet parallel_partitioner = locally_owned_entries;
           parallel_partitioner.add_indices(ghost_entries);
 
-          vector = Utilities::Trilinos::internal::make_rcp<VectorType>(
+          vector = Utilities::Trilinos::internal::make_rcp<
+            TpetraTypes::VectorType<Number, MemorySpace>>(
             parallel_partitioner.make_tpetra_map_rcp(communicator, true));
 
           compressed = true;
         }
       else
         {
-          Teuchos::RCP<MapType> map =
+          Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> map =
             locally_owned_entries.make_tpetra_map_rcp(communicator, false);
-          vector = Utilities::Trilinos::internal::make_rcp<VectorType>(map);
+          vector = Utilities::Trilinos::internal::make_rcp<
+            TpetraTypes::VectorType<Number, MemorySpace>>(map);
 
           IndexSet nonlocal_entries(ghost_entries);
           nonlocal_entries.subtract_set(locally_owned_entries);
-          nonlocal_vector = Utilities::Trilinos::internal::make_rcp<VectorType>(
+          nonlocal_vector = Utilities::Trilinos::internal::make_rcp<
+            TpetraTypes::VectorType<Number, MemorySpace>>(
             nonlocal_entries.make_tpetra_map_rcp(communicator, true));
 
           compressed = false;
@@ -176,8 +181,10 @@ namespace LinearAlgebra
     void
     Vector<Number, MemorySpace>::clear()
     {
-      vector = Utilities::Trilinos::internal::make_rcp<VectorType>(
-        Utilities::Trilinos::internal::make_rcp<MapType>(
+      vector = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::VectorType<Number, MemorySpace>>(
+        Utilities::Trilinos::internal::make_rcp<
+          TpetraTypes::MapType<MemorySpace>>(
           0, 0, Utilities::Trilinos::tpetra_comm_self()));
       has_ghost  = false;
       compressed = true;
@@ -197,7 +204,8 @@ namespace LinearAlgebra
 
       compressed = true;
       has_ghost  = false;
-      vector     = Utilities::Trilinos::internal::make_rcp<VectorType>(
+      vector     = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::VectorType<Number, MemorySpace>>(
         parallel_partitioner.make_tpetra_map_rcp(communicator, true));
     }
 
@@ -220,20 +228,22 @@ namespace LinearAlgebra
           IndexSet parallel_partitioner = locally_owned_entries;
           parallel_partitioner.add_indices(ghost_entries);
 
-          vector = Utilities::Trilinos::internal::make_rcp<VectorType>(
+          vector = Utilities::Trilinos::internal::make_rcp<
+            TpetraTypes::VectorType<Number, MemorySpace>>(
             parallel_partitioner.make_tpetra_map_rcp(communicator, true));
 
           compressed = true;
         }
       else
         {
-          Teuchos::RCP<MapType> map =
+          Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> map =
             locally_owned_entries.make_tpetra_map_rcp(communicator, false);
 
           if (!vector->getMap()->isSameAs(*map))
             {
               vector.reset();
-              vector = Utilities::Trilinos::internal::make_rcp<VectorType>(map);
+              vector = Utilities::Trilinos::internal::make_rcp<
+                TpetraTypes::VectorType<Number, MemorySpace>>(map);
             }
           else
             vector->putScalar(0);
@@ -241,7 +251,8 @@ namespace LinearAlgebra
           IndexSet nonlocal_entries(ghost_entries);
           nonlocal_entries.subtract_set(locally_owned_entries);
 
-          nonlocal_vector = Utilities::Trilinos::internal::make_rcp<VectorType>(
+          nonlocal_vector = Utilities::Trilinos::internal::make_rcp<
+            TpetraTypes::VectorType<Number, MemorySpace>>(
             nonlocal_entries.make_tpetra_map_rcp(communicator, true));
 
           compressed = false;
@@ -385,7 +396,7 @@ namespace LinearAlgebra
                    "Therefore, compress() must be called on this "
                    "vector first."));
 
-          Teuchos::RCP<const ImportType> importer =
+          Teuchos::RCP<const TpetraTypes::ImportType<MemorySpace>> importer =
             Tpetra::createImport(V.vector->getMap(), vector->getMap());
 
           // Since we are distributing the vector from a one-to-one map
@@ -396,9 +407,9 @@ namespace LinearAlgebra
       else
         {
           vector.reset();
-          vector =
-            Utilities::Trilinos::internal::make_rcp<VectorType>(*V.vector,
-                                                                Teuchos::Copy);
+          vector = Utilities::Trilinos::internal::make_rcp<
+            TpetraTypes::VectorType<Number, MemorySpace>>(*V.vector,
+                                                          Teuchos::Copy);
 
           compressed             = V.compressed;
           has_ghost              = V.has_ghost;
@@ -424,7 +435,8 @@ namespace LinearAlgebra
       nonlocal_vector.reset();
 
       Teuchos::Array<OtherNumber> vector_data(V.begin(), V.end());
-      vector = Utilities::Trilinos::internal::make_rcp<VectorType>(
+      vector = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::VectorType<Number, MemorySpace>>(
         V.locally_owned_elements().make_tpetra_map_rcp(), vector_data);
 
       has_ghost  = false;
@@ -494,10 +506,11 @@ namespace LinearAlgebra
               "LinearAlgebra::TpetraWrappers::CommunicationPattern."));
         }
 
-      Teuchos::RCP<const ExportType> tpetra_export =
+      Teuchos::RCP<const TpetraTypes::ExportType<MemorySpace>> tpetra_export =
         tpetra_comm_pattern->get_tpetra_export_rcp();
 
-      VectorType source_vector(tpetra_export->getSourceMap());
+      TpetraTypes::VectorType<Number, MemorySpace> source_vector(
+        tpetra_export->getSourceMap());
 
       {
 #  if DEAL_II_TRILINOS_VERSION_GTE(13, 2, 0)
@@ -605,8 +618,8 @@ namespace LinearAlgebra
           // elements, maybe there is a better workaround.
           Tpetra::Vector<Number, int, types::signed_global_dof_index> dummy(
             vector->getMap(), false);
-          ImportType data_exchange(V.trilinos_vector().getMap(),
-                                   dummy.getMap());
+          TpetraTypes::ImportType<MemorySpace> data_exchange(
+            V.trilinos_vector().getMap(), dummy.getMap());
           dummy.doImport(V.trilinos_vector(), data_exchange, Tpetra::INSERT);
 
           vector->update(1.0, dummy, 1.0);
@@ -1105,7 +1118,7 @@ namespace LinearAlgebra
           else
             DEAL_II_NOT_IMPLEMENTED();
 
-          Teuchos::RCP<const ExportType> exporter =
+          Teuchos::RCP<const TpetraTypes::ExportType<MemorySpace>> exporter =
             Tpetra::createExport(nonlocal_vector->getMap(), vector->getMap());
           vector->doExport(*nonlocal_vector, *exporter, tpetra_operation);
 
@@ -1116,7 +1129,7 @@ namespace LinearAlgebra
 
 
     template <typename Number, typename MemorySpace>
-    const Tpetra::Vector<Number, int, types::signed_global_dof_index> &
+    const TpetraTypes::VectorType<Number, MemorySpace> &
     Vector<Number, MemorySpace>::trilinos_vector() const
     {
       return *vector;
@@ -1125,7 +1138,7 @@ namespace LinearAlgebra
 
 
     template <typename Number, typename MemorySpace>
-    Tpetra::Vector<Number, int, types::signed_global_dof_index> &
+    TpetraTypes::VectorType<Number, MemorySpace> &
     Vector<Number, MemorySpace>::trilinos_vector()
     {
       return *vector;
@@ -1134,7 +1147,7 @@ namespace LinearAlgebra
 
 
     template <typename Number, typename MemorySpace>
-    Teuchos::RCP<Tpetra::Vector<Number, int, types::signed_global_dof_index>>
+    Teuchos::RCP<TpetraTypes::VectorType<Number, MemorySpace>>
     Vector<Number, MemorySpace>::trilinos_rcp()
     {
       return vector;
@@ -1143,8 +1156,7 @@ namespace LinearAlgebra
 
 
     template <typename Number, typename MemorySpace>
-    Teuchos::RCP<
-      const Tpetra::Vector<Number, int, types::signed_global_dof_index>>
+    Teuchos::RCP<const TpetraTypes::VectorType<Number, MemorySpace>>
     Vector<Number, MemorySpace>::trilinos_rcp() const
     {
       return vector.getConst();
index 139d7a6b691f6ffd611404e8319b6db0f3a92bc8..cc7b511dbb6859b315857cb25f6dd91723335262 100644 (file)
@@ -198,13 +198,13 @@ Vector<Number>::Vector(
       // Copy the distributed vector to
       // a local one at all processors
       // that know about the original vector.
-      typename LinearAlgebra::TpetraWrappers::Vector<OtherNumber,
-                                                     MemorySpace>::VectorType
+      LinearAlgebra::TpetraWrappers::TpetraTypes::VectorType<OtherNumber,
+                                                             MemorySpace>
         localized_vector(complete_index_set(size()).make_tpetra_map_rcp(),
                          v.get_mpi_communicator());
 
-      Teuchos::RCP<const typename LinearAlgebra::TpetraWrappers::
-                     Vector<OtherNumber, MemorySpace>::ImportType>
+      Teuchos::RCP<const LinearAlgebra::TpetraWrappers::TpetraTypes::ImportType<
+        MemorySpace>>
         importer = Tpetra::createImport(v.trilinos_vector().getMap(),
                                         localized_vector.getMap());
 
@@ -888,13 +888,13 @@ Vector<Number>::operator=(
       // Copy the distributed vector to
       // a local one at all processors
       // that know about the original vector.
-      typename LinearAlgebra::TpetraWrappers::Vector<OtherNumber,
-                                                     MemorySpace>::VectorType
+      LinearAlgebra::TpetraWrappers::TpetraTypes::VectorType<OtherNumber,
+                                                             MemorySpace>
         localized_vector(complete_index_set(size()).make_tpetra_map_rcp(),
                          v.get_mpi_communicator());
 
-      Teuchos::RCP<const typename LinearAlgebra::TpetraWrappers::
-                     Vector<OtherNumber, MemorySpace>::ImportType>
+      Teuchos::RCP<const LinearAlgebra::TpetraWrappers::TpetraTypes::ImportType<
+        MemorySpace>>
         importer = Tpetra::createImport(v.trilinos_vector().getMap(),
                                         localized_vector.getMap());
 
index 184f38ae197e4bad94e56007c401d9776254a667..a4dd925139e6bf1622a47c05fdf6bca82476acb6 100644 (file)
@@ -12,6 +12,9 @@
 //
 // ------------------------------------------------------------------------
 
+#include "deal.II/base/memory_space.h"
+
+#include "deal.II/lac/trilinos_tpetra_types.h"
 #include <deal.II/lac/trilinos_tpetra_communication_pattern.h>
 
 #ifdef DEAL_II_TRILINOS_WITH_TPETRA
@@ -84,7 +87,7 @@ namespace LinearAlgebra
 
 
 
-    Teuchos::RCP<const Tpetra::Import<int, types::signed_global_dof_index>>
+    Teuchos::RCP<TpetraTypes::ImportType<dealii::MemorySpace::Host>>
     CommunicationPattern::get_tpetra_import_rcp() const
     {
       return tpetra_import;
@@ -100,7 +103,7 @@ namespace LinearAlgebra
 
 
 
-    Teuchos::RCP<const Tpetra::Export<int, types::signed_global_dof_index>>
+    Teuchos::RCP<TpetraTypes::ExportType<dealii::MemorySpace::Host>>
     CommunicationPattern::get_tpetra_export_rcp() const
     {
       return tpetra_export;
index c7be32eb78d5a6821c922fdeebab996fb03013a4..91ccd3234a67af619b97a3141f64e37a7d1022bd 100644 (file)
@@ -60,10 +60,8 @@ namespace LinearAlgebra
             // get a representation of the present row
             std::size_t ncols;
 #  if DEAL_II_TRILINOS_VERSION_GTE(13, 2, 0)
-            typename Tpetra::CrsGraph<
-              int,
-              dealii::types::signed_global_dof_index,
-              NodeType>::nonconst_global_inds_host_view_type
+            typename TpetraTypes::GraphType<
+              MemorySpace>::nonconst_global_inds_host_view_type
               column_indices_view(colnum_cache->data(), colnum_cache->size());
 #  else
             Teuchos::ArrayView<dealii::types::signed_global_dof_index>
@@ -86,14 +84,15 @@ namespace LinearAlgebra
     template <typename MemorySpace>
     SparsityPattern<MemorySpace>::SparsityPattern()
     {
-      column_space_map = Utilities::Trilinos::internal::make_rcp<MapType>(
+      column_space_map = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::MapType<MemorySpace>>(
         TrilinosWrappers::types::int_type(0),
         TrilinosWrappers::types::int_type(0),
         Utilities::Trilinos::tpetra_comm_self());
-      graph =
-        Utilities::Trilinos::internal::make_rcp<GraphType>(column_space_map,
-                                                           column_space_map,
-                                                           0);
+      graph = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::GraphType<MemorySpace>>(column_space_map,
+                                             column_space_map,
+                                             0);
       graph->fillComplete();
     }
 
@@ -137,14 +136,15 @@ namespace LinearAlgebra
     SparsityPattern<MemorySpace>::SparsityPattern(
       const SparsityPattern<MemorySpace> &input_sparsity)
       : SparsityPatternBase(input_sparsity)
-      , column_space_map(Utilities::Trilinos::internal::make_rcp<MapType>(
+      , column_space_map(Utilities::Trilinos::internal::make_rcp<
+                         TpetraTypes::MapType<MemorySpace>>(
           0,
           0,
           Utilities::Trilinos::tpetra_comm_self()))
-      , graph(
-          Utilities::Trilinos::internal::make_rcp<GraphType>(column_space_map,
-                                                             column_space_map,
-                                                             0))
+      , graph(Utilities::Trilinos::internal::make_rcp<
+              TpetraTypes::GraphType<MemorySpace>>(column_space_map,
+                                                   column_space_map,
+                                                   0))
     {
       (void)input_sparsity;
       Assert(input_sparsity.n_rows() == 0,
@@ -263,26 +263,15 @@ namespace LinearAlgebra
       template <typename MemorySpace>
       using size_type = typename SparsityPattern<MemorySpace>::size_type;
 
-      template <typename MemorySpace>
-      using MapType =
-        Tpetra::Map<int,
-                    dealii::types::signed_global_dof_index,
-                    typename SparsityPattern<MemorySpace>::NodeType>;
-
-      template <typename MemorySpace>
-      using GraphType =
-        Tpetra::CrsGraph<int,
-                         dealii::types::signed_global_dof_index,
-                         typename SparsityPattern<MemorySpace>::NodeType>;
-
       template <typename MemorySpace>
       void
-      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)
+      reinit_sp(
+        const Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> &row_map,
+        const Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> &col_map,
+        const size_type<MemorySpace>                       n_entries_per_row,
+        Teuchos::RCP<TpetraTypes::MapType<MemorySpace>>   &column_space_map,
+        Teuchos::RCP<TpetraTypes::GraphType<MemorySpace>> &graph,
+        Teuchos::RCP<TpetraTypes::GraphType<MemorySpace>> &nonlocal_graph)
       {
         Assert(row_map->isOneToOne(),
                ExcMessage("Row map must be 1-to-1, i.e., no overlap between "
@@ -303,20 +292,23 @@ 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<MemorySpace>>(
-          row_map, row_map, n_entries_per_row);
+        graph = Utilities::Trilinos::internal::make_rcp<
+          TpetraTypes::GraphType<MemorySpace>>(row_map,
+                                               row_map,
+                                               n_entries_per_row);
       }
 
 
 
       template <typename MemorySpace>
       void
-      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)
+      reinit_sp(
+        const Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> &row_map,
+        const Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> &col_map,
+        const std::vector<size_type<MemorySpace>>         &n_entries_per_row,
+        Teuchos::RCP<TpetraTypes::MapType<MemorySpace>>   &column_space_map,
+        Teuchos::RCP<TpetraTypes::GraphType<MemorySpace>> &graph,
+        Teuchos::RCP<TpetraTypes::GraphType<MemorySpace>> &nonlocal_graph)
       {
         Assert(row_map->isOneToOne(),
                ExcMessage("Row map must be 1-to-1, i.e., no overlap between "
@@ -363,21 +355,24 @@ namespace LinearAlgebra
           ExcMessage(
             "You are requesting to store more elements than global ordinal type allows."));
 
-        graph = Utilities::Trilinos::internal::make_rcp<GraphType<MemorySpace>>(
-          row_map, col_map, local_entries_per_row);
+        graph = Utilities::Trilinos::internal::make_rcp<
+          TpetraTypes::GraphType<MemorySpace>>(row_map,
+                                               col_map,
+                                               local_entries_per_row);
       }
 
 
 
       template <typename SparsityPatternType, typename MemorySpace>
       void
-      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)
+      reinit_sp(
+        const Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> &row_map,
+        const Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> &col_map,
+        const SparsityPatternType                             &sp,
+        [[maybe_unused]] const bool                            exchange_data,
+        Teuchos::RCP<TpetraTypes::MapType<MemorySpace>>       &column_space_map,
+        Teuchos::RCP<TpetraTypes::GraphType<MemorySpace>>     &graph,
+        Teuchos::RCP<TpetraTypes::GraphType<MemorySpace>>     &nonlocal_graph)
       {
         nonlocal_graph.reset();
         graph.reset();
@@ -385,9 +380,8 @@ namespace LinearAlgebra
         AssertDimension(sp.n_rows(), row_map->getGlobalNumElements());
         AssertDimension(sp.n_cols(), col_map->getGlobalNumElements());
 
-        column_space_map =
-          Utilities::Trilinos::internal::make_rcp<MapType<MemorySpace>>(
-            *col_map);
+        column_space_map = Utilities::Trilinos::internal::make_rcp<
+          TpetraTypes::MapType<MemorySpace>>(*col_map);
 
         Assert(row_map->isContiguous() == true,
                ExcMessage(
@@ -417,13 +411,13 @@ namespace LinearAlgebra
 
 #  if DEAL_II_TRILINOS_VERSION_GTE(12, 16, 0)
         if (row_map->getComm()->getSize() > 1)
-          graph =
-            Utilities::Trilinos::internal::make_rcp<GraphType<MemorySpace>>(
-              row_map, n_entries_per_row);
+          graph = Utilities::Trilinos::internal::make_rcp<
+            TpetraTypes::GraphType<MemorySpace>>(row_map, n_entries_per_row);
         else
-          graph =
-            Utilities::Trilinos::internal::make_rcp<GraphType<MemorySpace>>(
-              row_map, col_map, n_entries_per_row);
+          graph = Utilities::Trilinos::internal::make_rcp<
+            TpetraTypes::GraphType<MemorySpace>>(row_map,
+                                                 col_map,
+                                                 n_entries_per_row);
 #  else
         if (row_map->getComm()->getSize() > 1)
           graph =
@@ -476,7 +470,7 @@ namespace LinearAlgebra
     {
       SparsityPatternBase::resize(parallel_partitioning.size(),
                                   parallel_partitioning.size());
-      Teuchos::RCP<MapType> map =
+      Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> map =
         parallel_partitioning.make_tpetra_map_rcp(communicator, false);
       SparsityPatternImpl::reinit_sp<MemorySpace>(
         map, map, n_entries_per_row, column_space_map, graph, nonlocal_graph);
@@ -493,7 +487,7 @@ namespace LinearAlgebra
     {
       SparsityPatternBase::resize(parallel_partitioning.size(),
                                   parallel_partitioning.size());
-      Teuchos::RCP<MapType> map =
+      Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> map =
         parallel_partitioning.make_tpetra_map_rcp(communicator, false);
       SparsityPatternImpl::reinit_sp<MemorySpace>(
         map, map, n_entries_per_row, column_space_map, graph, nonlocal_graph);
@@ -511,9 +505,9 @@ namespace LinearAlgebra
     {
       SparsityPatternBase::resize(row_parallel_partitioning.size(),
                                   col_parallel_partitioning.size());
-      Teuchos::RCP<MapType> row_map =
+      Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> row_map =
         row_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
-      Teuchos::RCP<MapType> col_map =
+      Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> col_map =
         col_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
       SparsityPatternImpl::reinit_sp<MemorySpace>(row_map,
                                                   col_map,
@@ -535,9 +529,9 @@ namespace LinearAlgebra
     {
       SparsityPatternBase::resize(row_parallel_partitioning.size(),
                                   col_parallel_partitioning.size());
-      Teuchos::RCP<MapType> row_map =
+      Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> row_map =
         row_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
-      Teuchos::RCP<MapType> col_map =
+      Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> col_map =
         col_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
       SparsityPatternImpl::reinit_sp<MemorySpace>(row_map,
                                                   col_map,
@@ -560,9 +554,9 @@ namespace LinearAlgebra
     {
       SparsityPatternBase::resize(row_parallel_partitioning.size(),
                                   col_parallel_partitioning.size());
-      Teuchos::RCP<MapType> row_map =
+      Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> row_map =
         row_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
-      Teuchos::RCP<MapType> col_map =
+      Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> col_map =
         col_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
       SparsityPatternImpl::reinit_sp<MemorySpace>(row_map,
                                                   col_map,
@@ -586,12 +580,10 @@ namespace LinearAlgebra
       nonlocal_partitioner.subtract_set(row_parallel_partitioning);
       if (Utilities::MPI::n_mpi_processes(communicator) > 1)
         {
-          Teuchos::RCP<MapType> nonlocal_map =
+          Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> nonlocal_map =
             nonlocal_partitioner.make_tpetra_map_rcp(communicator, true);
-          nonlocal_graph =
-            Utilities::Trilinos::internal::make_rcp<GraphType>(nonlocal_map,
-                                                               col_map,
-                                                               0);
+          nonlocal_graph = Utilities::Trilinos::internal::make_rcp<
+            TpetraTypes::GraphType<MemorySpace>>(nonlocal_map, col_map, 0);
         }
       else
         Assert(nonlocal_partitioner.n_elements() == 0, ExcInternalError());
@@ -611,9 +603,9 @@ namespace LinearAlgebra
     {
       SparsityPatternBase::resize(row_parallel_partitioning.size(),
                                   col_parallel_partitioning.size());
-      Teuchos::RCP<MapType> row_map =
+      Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> row_map =
         row_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
-      Teuchos::RCP<MapType> col_map =
+      Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> col_map =
         col_parallel_partitioning.make_tpetra_map_rcp(communicator, false);
       SparsityPatternImpl::reinit_sp<SparsityPatternType, MemorySpace>(
         row_map,
@@ -642,7 +634,7 @@ namespace LinearAlgebra
                       parallel_partitioning.size());
       SparsityPatternBase::resize(parallel_partitioning.size(),
                                   parallel_partitioning.size());
-      Teuchos::RCP<MapType> map =
+      Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> map =
         parallel_partitioning.make_tpetra_map_rcp(communicator, false);
       SparsityPatternImpl::reinit_sp<SparsityPatternType, MemorySpace>(
         map,
@@ -673,13 +665,14 @@ namespace LinearAlgebra
       const SparsityPattern<MemorySpace> &sp)
     {
       SparsityPatternBase::resize(sp.n_rows(), sp.n_cols());
-      column_space_map =
-        Utilities::Trilinos::internal::make_rcp<MapType>(*sp.column_space_map);
-      graph = Utilities::Trilinos::internal::make_rcp<GraphType>(*sp.graph);
+      column_space_map = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::MapType<MemorySpace>>(*sp.column_space_map);
+      graph = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::GraphType<MemorySpace>>(*sp.graph);
 
       if (sp.nonlocal_graph.get() != nullptr)
-        nonlocal_graph = Utilities::Trilinos::internal::make_rcp<GraphType>(
-          *sp.nonlocal_graph);
+        nonlocal_graph = Utilities::Trilinos::internal::make_rcp<
+          TpetraTypes::GraphType<MemorySpace>>(*sp.nonlocal_graph);
       else
         nonlocal_graph.reset();
     }
@@ -692,13 +685,15 @@ namespace LinearAlgebra
     SparsityPattern<MemorySpace>::copy_from(const SparsityPatternType &sp)
     {
       SparsityPatternBase::resize(sp.n_rows(), sp.n_cols());
-      Teuchos::RCP<MapType> rows =
-        Utilities::Trilinos::internal::make_rcp<MapType>(
+      Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> rows =
+        Utilities::Trilinos::internal::make_rcp<
+          TpetraTypes::MapType<MemorySpace>>(
           TrilinosWrappers::types::int_type(sp.n_rows()),
           0,
           Utilities::Trilinos::tpetra_comm_self());
-      Teuchos::RCP<MapType> columns =
-        Utilities::Trilinos::internal::make_rcp<MapType>(
+      Teuchos::RCP<TpetraTypes::MapType<MemorySpace>> columns =
+        Utilities::Trilinos::internal::make_rcp<
+          TpetraTypes::MapType<MemorySpace>>(
           TrilinosWrappers::types::int_type(sp.n_cols()),
           0,
           Utilities::Trilinos::tpetra_comm_self());
@@ -717,14 +712,15 @@ namespace LinearAlgebra
       // When we clear the matrix, reset
       // the pointer and generate an
       // empty sparsity pattern.
-      column_space_map = Utilities::Trilinos::internal::make_rcp<MapType>(
+      column_space_map = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::MapType<MemorySpace>>(
         TrilinosWrappers::types::int_type(0),
         TrilinosWrappers::types::int_type(0),
         Utilities::Trilinos::tpetra_comm_self());
-      graph =
-        Utilities::Trilinos::internal::make_rcp<GraphType>(column_space_map,
-                                                           column_space_map,
-                                                           0);
+      graph = Utilities::Trilinos::internal::make_rcp<
+        TpetraTypes::GraphType<MemorySpace>>(column_space_map,
+                                             column_space_map,
+                                             0);
       graph->fillComplete();
 
       nonlocal_graph.reset();
@@ -816,7 +812,8 @@ namespace LinearAlgebra
       const auto trilinos_i = graph->getRowMap()->getLocalElement(i);
       const auto trilinos_j = graph->getColMap()->getLocalElement(j);
 
-      typename GraphType::local_inds_host_view_type col_indices;
+      typename TpetraTypes::GraphType<MemorySpace>::local_inds_host_view_type
+        col_indices;
 
       // Generate the view.
       graph->getLocalRowView(trilinos_i, col_indices);
@@ -847,7 +844,8 @@ namespace LinearAlgebra
       for (int i = 0; i < static_cast<int>(local_size()); ++i)
         {
 #  if DEAL_II_TRILINOS_VERSION_GTE(13, 2, 0)
-          typename GraphType::local_inds_host_view_type indices;
+          typename TpetraTypes::GraphType<
+            MemorySpace>::local_inds_host_view_type indices;
 #  else
           Teuchos::ArrayView<const int> indices;
 #  endif
@@ -953,7 +951,7 @@ namespace LinearAlgebra
 
 
     template <typename MemorySpace>
-    Teuchos::RCP<const typename SparsityPattern<MemorySpace>::MapType>
+    Teuchos::RCP<const typename TpetraTypes::MapType<MemorySpace>>
     SparsityPattern<MemorySpace>::domain_partitioner() const
     {
       return graph->getDomainMap();
@@ -962,7 +960,7 @@ namespace LinearAlgebra
 
 
     template <typename MemorySpace>
-    Teuchos::RCP<const typename SparsityPattern<MemorySpace>::MapType>
+    Teuchos::RCP<const typename TpetraTypes::MapType<MemorySpace>>
     SparsityPattern<MemorySpace>::range_partitioner() const
     {
       return graph->getRangeMap();
@@ -1009,7 +1007,8 @@ namespace LinearAlgebra
 #  endif
             {
 #  if DEAL_II_TRILINOS_VERSION_GTE(13, 2, 0)
-              typename GraphType::local_inds_host_view_type indices;
+              typename TpetraTypes::GraphType<
+                MemorySpace>::local_inds_host_view_type indices;
 #  else
               Teuchos::ArrayView<const int> indices;
 #  endif
@@ -1036,7 +1035,8 @@ namespace LinearAlgebra
       for (unsigned int row = 0; row < local_size(); ++row)
         {
 #  if DEAL_II_TRILINOS_VERSION_GTE(13, 2, 0)
-          typename GraphType::local_inds_host_view_type indices;
+          typename TpetraTypes::GraphType<
+            MemorySpace>::local_inds_host_view_type indices;
 #  else
           Teuchos::ArrayView<const int> indices;
 #  endif

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.