From: Pasquale Africa Date: Thu, 18 Apr 2024 13:23:43 +0000 (+0200) Subject: Add VectorTraits to Trilinos and Tpetra wrappers X-Git-Tag: v9.6.0-rc1~367^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3587529f283f22eed304262e5ad50a2258516b73;p=dealii.git Add VectorTraits to Trilinos and Tpetra wrappers --- diff --git a/include/deal.II/lac/trilinos_epetra_vector.h b/include/deal.II/lac/trilinos_epetra_vector.h index 79f720d2ac..51136b3355 100644 --- a/include/deal.II/lac/trilinos_epetra_vector.h +++ b/include/deal.II/lac/trilinos_epetra_vector.h @@ -51,14 +51,14 @@ namespace LinearAlgebra namespace EpetraWrappers { /** - * This class defines type aliases that are used in other classes + * This class defines type aliases that are used in vector classes * within the EpetraWrappers namespace. */ class VectorTraits { public: using value_type = double; - using size_type = types::global_dof_index; + using size_type = dealii::types::global_dof_index; }; /** diff --git a/include/deal.II/lac/trilinos_sparse_matrix.h b/include/deal.II/lac/trilinos_sparse_matrix.h index 9f3aedb051..b0f374823d 100644 --- a/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/include/deal.II/lac/trilinos_sparse_matrix.h @@ -2044,6 +2044,7 @@ namespace TrilinosWrappers (void)dst; } + namespace LinearOperatorImplementation { /** @@ -2083,6 +2084,11 @@ namespace TrilinosWrappers */ using Domain = VectorType; + /** + * Index of the referenced element of the vector. + */ + using size_type = dealii::types::global_dof_index; + /** * @name Constructors / destructor */ diff --git a/include/deal.II/lac/trilinos_tpetra_vector.h b/include/deal.II/lac/trilinos_tpetra_vector.h index f6a1091b1d..6ea8c60346 100644 --- a/include/deal.II/lac/trilinos_tpetra_vector.h +++ b/include/deal.II/lac/trilinos_tpetra_vector.h @@ -100,6 +100,16 @@ namespace LinearAlgebra */ namespace TpetraWrappers { + /** + * This class defines type aliases that are used in vector classes + * within the TpetraWrappers namespace. + */ + class VectorTraits + { + public: + using size_type = dealii::types::global_dof_index; + }; + /** * @cond internal */ @@ -115,7 +125,7 @@ namespace LinearAlgebra /** * Declare type for container size. */ - using size_type = dealii::types::global_dof_index; + using size_type = VectorTraits::size_type; /** * This class implements a wrapper for accessing the Trilinos Tpetra @@ -287,7 +297,7 @@ namespace LinearAlgebra # endif using value_type = Number; using real_type = typename numbers::NumberTraits::real_type; - using size_type = types::global_dof_index; + using size_type = VectorTraits::size_type; using reference = internal::VectorReference; using const_reference = const internal::VectorReference; diff --git a/include/deal.II/lac/trilinos_vector.h b/include/deal.II/lac/trilinos_vector.h index 62ffb35102..48a5f9a339 100644 --- a/include/deal.II/lac/trilinos_vector.h +++ b/include/deal.II/lac/trilinos_vector.h @@ -66,6 +66,16 @@ namespace TrilinosWrappers { class SparseMatrix; + /** + * This class defines type aliases that are used in vector classes + * within the TrilinosWrappers namespace. + */ + class VectorTraits + { + public: + using size_type = dealii::types::global_dof_index; + }; + /** * @cond internal */ @@ -78,11 +88,6 @@ namespace TrilinosWrappers */ namespace internal { - /** - * Declare type for container size. - */ - using size_type = dealii::types::global_dof_index; - /** * This class implements a wrapper for accessing the Trilinos vector in * the same way as we access deal.II objects: it is initialized with a @@ -95,6 +100,8 @@ namespace TrilinosWrappers class VectorReference { private: + using size_type = VectorTraits::size_type; + /** * Constructor. It is made private so as to only allow the actual vector * class to create it. @@ -404,7 +411,7 @@ namespace TrilinosWrappers */ using value_type = TrilinosScalar; using real_type = TrilinosScalar; - using size_type = dealii::types::global_dof_index; + using size_type = VectorTraits::size_type; using iterator = value_type *; using const_iterator = const value_type *; using reference = internal::VectorReference; diff --git a/source/lac/trilinos_sparse_matrix.cc b/source/lac/trilinos_sparse_matrix.cc index 1902bcf489..99bd58cb91 100644 --- a/source/lac/trilinos_sparse_matrix.cc +++ b/source/lac/trilinos_sparse_matrix.cc @@ -2134,8 +2134,6 @@ namespace TrilinosWrappers namespace internals { - using size_type = dealii::types::global_dof_index; - void perform_mmult(const SparseMatrix &inputleft, const SparseMatrix &inputright, @@ -2322,6 +2320,8 @@ namespace TrilinosWrappers { namespace LinearOperatorImplementation { + using size_type = VectorTraits::size_type; + TrilinosPayload::TrilinosPayload() : use_transpose(false) , communicator(MPI_COMM_SELF)