]> https://gitweb.dealii.org/ - dealii.git/commitdiff
PETSc Vector reinit helper
authorESeNonFossiIo <esenonfossiio@gmail.com>
Tue, 12 Apr 2016 20:11:16 +0000 (22:11 +0200)
committerESeNonFossiIo <esenonfossiio@gmail.com>
Thu, 14 Apr 2016 08:41:23 +0000 (10:41 +0200)
include/deal.II/lac/petsc_parallel_vector.h
include/deal.II/lac/petsc_vector.h

index dd9a324a61fd197cd645f2919fa26b4aa670bc88..522a45f937427b566d45ca6570d616baa44fa586 100644 (file)
@@ -582,6 +582,42 @@ namespace PETScWrappers
   }
 }
 
+namespace internal
+{
+  namespace LinearOperator
+  {
+    template <typename> class ReinitHelper;
+
+    /**
+     * A helper class internally used in linear_operator.h. Specialization for
+     * TrilinosWrappers::MPI::Vector.
+     */
+    template<>
+    class ReinitHelper<PETScWrappers::MPI::Vector>
+    {
+    public:
+      template <typename Matrix>
+      static
+      void reinit_range_vector (const Matrix &matrix,
+                                PETScWrappers::MPI::Vector &v,
+                                bool omit_zeroing_entries)
+      {
+        v.reinit(matrix.locally_owned_range_indices(), matrix.get_mpi_communicator());
+      }
+
+      template <typename Matrix>
+      static
+      void reinit_domain_vector(const Matrix &matrix,
+                                PETScWrappers::MPI::Vector &v,
+                                bool omit_zeroing_entries)
+      {
+        v.reinit(matrix.locally_owned_domain_indices(), matrix.get_mpi_communicator());
+      }
+    };
+
+  } /* namespace LinearOperator */
+} /* namespace internal */
+
 /**@}*/
 
 DEAL_II_NAMESPACE_CLOSE
index f1fb5f5de808dc8e4a86a9ca66e044f57f0795fa..ba4e3c4d5d13c688e18c31f3b675e5bfddb355c1 100644 (file)
@@ -391,6 +391,44 @@ namespace PETScWrappers
 
 }
 
+namespace internal
+{
+  namespace LinearOperator
+  {
+    template <typename> class ReinitHelper;
+
+    /**
+     * A helper class internally used in linear_operator.h. Specialization for
+     * PETScWrappers::Vector.
+     */
+    template<>
+    class ReinitHelper<PETScWrappers::Vector>
+    {
+    public:
+      template <typename Matrix>
+      static
+      void reinit_range_vector (const Matrix &matrix,
+                                PETScWrappers::Vector &v,
+                                bool omit_zeroing_entries)
+      {
+        v.reinit( matrix.m(),
+                  omit_zeroing_entries);
+      }
+
+      template <typename Matrix>
+      static
+      void reinit_domain_vector(const Matrix &matrix,
+                                PETScWrappers::Vector &v,
+                                bool omit_zeroing_entries)
+      {
+        v.reinit( matrix.n(),
+                  omit_zeroing_entries);
+      }
+    };
+
+  } /* namespace LinearOperator */
+} /* namespace internal */
+
 DEAL_II_NAMESPACE_CLOSE
 
 #endif // DEAL_II_WITH_PETSC

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.