]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add EpetraWrappers::VectorTraits class 16880/head
authorPasquale Africa <pafrica@sissa.it>
Tue, 16 Apr 2024 07:49:18 +0000 (09:49 +0200)
committerPasquale Africa <pafrica@sissa.it>
Tue, 16 Apr 2024 22:15:01 +0000 (00:15 +0200)
include/deal.II/lac/trilinos_epetra_vector.h

index ad2f901d9266ff45c3b54dc0a0ffe51e8556811c..988009a6c45575357080ac9552ff92d1b127ffc4 100644 (file)
@@ -50,6 +50,17 @@ namespace LinearAlgebra
    */
   namespace EpetraWrappers
   {
+    /**
+     * This class defines type aliases that are used in other classes
+     * within the EpetraWrappers namespace.
+     */
+    class VectorTraits
+    {
+    public:
+      using value_type = double;
+      using size_type  = types::global_dof_index;
+    };
+
     /**
      * @cond internal
      */
@@ -62,16 +73,6 @@ namespace LinearAlgebra
      */
     namespace internal
     {
-      /**
-       * Declare type for container size.
-       */
-      using size_type = dealii::types::global_dof_index;
-
-      /**
-       * Declare type for container value type.
-       */
-      using value_type = double;
-
       /**
        * This class implements a wrapper for accessing the Trilinos Epetra
        * vector in the same way as we access deal.II objects: it is initialized
@@ -84,6 +85,9 @@ namespace LinearAlgebra
       class VectorReference
       {
       private:
+        using value_type = VectorTraits::value_type;
+        using size_type  = VectorTraits::size_type;
+
         /**
          * Constructor. It is made private so as to only allow the actual vector
          * class to create it.
@@ -218,11 +222,13 @@ namespace LinearAlgebra
      * @ingroup TrilinosWrappers
      * @ingroup Vectors
      */
-    class Vector : public ReadVector<internal::value_type>, public Subscriptor
+    class Vector : public ReadVector<VectorTraits::value_type>,
+                   public Subscriptor
     {
     public:
-      using value_type      = internal::value_type;
-      using size_type       = types::global_dof_index;
+      using value_type      = VectorTraits::value_type;
+      using size_type       = VectorTraits::size_type;
+      using real_type       = value_type;
       using reference       = internal::VectorReference;
       using const_reference = const internal::VectorReference;
 

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.