From: ESeNonFossiIo Date: Tue, 12 Apr 2016 20:11:16 +0000 (+0200) Subject: PETSc Vector reinit helper X-Git-Tag: v8.5.0-rc1~1104^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e8824236b9f60a2e74e009cc7f90201298ab9f4;p=dealii.git PETSc Vector reinit helper --- diff --git a/include/deal.II/lac/petsc_parallel_vector.h b/include/deal.II/lac/petsc_parallel_vector.h index dd9a324a61..522a45f937 100644 --- a/include/deal.II/lac/petsc_parallel_vector.h +++ b/include/deal.II/lac/petsc_parallel_vector.h @@ -582,6 +582,42 @@ namespace PETScWrappers } } +namespace internal +{ + namespace LinearOperator + { + template class ReinitHelper; + + /** + * A helper class internally used in linear_operator.h. Specialization for + * TrilinosWrappers::MPI::Vector. + */ + template<> + class ReinitHelper + { + public: + template + 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 + 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 diff --git a/include/deal.II/lac/petsc_vector.h b/include/deal.II/lac/petsc_vector.h index f1fb5f5de8..ba4e3c4d5d 100644 --- a/include/deal.II/lac/petsc_vector.h +++ b/include/deal.II/lac/petsc_vector.h @@ -391,6 +391,44 @@ namespace PETScWrappers } +namespace internal +{ + namespace LinearOperator + { + template class ReinitHelper; + + /** + * A helper class internally used in linear_operator.h. Specialization for + * PETScWrappers::Vector. + */ + template<> + class ReinitHelper + { + public: + template + static + void reinit_range_vector (const Matrix &matrix, + PETScWrappers::Vector &v, + bool omit_zeroing_entries) + { + v.reinit( matrix.m(), + omit_zeroing_entries); + } + + template + 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