From 0f4af5fe70f7a9dfefd3668a529d46e6e5fb29ba Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Sun, 2 Jul 2017 11:28:19 -0500 Subject: [PATCH] Bugfix: Add ReinitHelper for LinearAlgebra::distributed::Vector 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 | 41 ++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/include/deal.II/lac/la_parallel_vector.h b/include/deal.II/lac/la_parallel_vector.h index ac70181fc2..7edb31bee4 100644 --- a/include/deal.II/lac/la_parallel_vector.h +++ b/include/deal.II/lac/la_parallel_vector.h @@ -1473,6 +1473,47 @@ struct is_serial_vector< LinearAlgebra::distributed::Vector< Number > > : std::f }; +namespace internal +{ + namespace LinearOperator + { + template class ReinitHelper; + + /** + * A helper class used internally in linear_operator.h. Specialization for + * LinearAlgebra::distributed::Vector. + */ + template + class ReinitHelper> + { + public: + template + static + void reinit_range_vector (const Matrix &matrix, + LinearAlgebra::distributed::Vector &v, + bool omit_zeroing_entries) + { + matrix.initialize_dof_vector(v); + if (!omit_zeroing_entries) + v = Number(); + } + + template + static + void reinit_domain_vector(const Matrix &matrix, + LinearAlgebra::distributed::Vector &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 -- 2.39.5