]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Bugfix: Add ReinitHelper for LinearAlgebra::distributed::Vector
authorMatthias Maier <tamiko@43-1.org>
Sun, 2 Jul 2017 16:28:19 +0000 (11:28 -0500)
committerMatthias Maier <tamiko@43-1.org>
Mon, 3 Jul 2017 10:15:14 +0000 (05:15 -0500)
Add a ReinitHelper that correctly initializes a
LinearAlgebra::distributed::Vector from available partition information
of a Matrix object.

include/deal.II/lac/la_parallel_vector.h

index ac70181fc2b3b5e99359308a927d7caeaaa60a12..7edb31bee41dfa1cedd3ef496cfb96db21e4e533 100644 (file)
@@ -1473,6 +1473,47 @@ struct is_serial_vector< LinearAlgebra::distributed::Vector< Number > > : std::f
 };
 
 
+namespace internal
+{
+  namespace LinearOperator
+  {
+    template <typename> class ReinitHelper;
+
+    /**
+     * A helper class used internally in linear_operator.h. Specialization for
+     * LinearAlgebra::distributed::Vector<Number>.
+     */
+    template <typename Number>
+    class ReinitHelper<LinearAlgebra::distributed::Vector<Number>>
+    {
+    public:
+      template <typename Matrix>
+      static
+      void reinit_range_vector (const Matrix &matrix,
+                                LinearAlgebra::distributed::Vector<Number> &v,
+                                bool omit_zeroing_entries)
+      {
+        matrix.initialize_dof_vector(v);
+        if (!omit_zeroing_entries)
+          v = Number();
+      }
+
+      template <typename Matrix>
+      static
+      void reinit_domain_vector(const Matrix &matrix,
+                                LinearAlgebra::distributed::Vector<Number> &v,
+                                bool omit_zeroing_entries)
+      {
+        matrix.initialize_dof_vector(v);
+        if (!omit_zeroing_entries)
+          v = Number();
+      }
+    };
+
+  } /* namespace LinearOperator */
+} /* namespace internal */
+
+
 DEAL_II_NAMESPACE_CLOSE
 
 #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.