From: Matthias Maier Date: Sun, 2 Jul 2017 16:28:19 +0000 (-0500) Subject: Bugfix: Add ReinitHelper for LinearAlgebra::distributed::Vector X-Git-Tag: v9.0.0-rc1~1447^2~8 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f4af5fe70f7a9dfefd3668a529d46e6e5fb29ba;p=dealii.git 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. --- 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