From 202220ad4c4c582ba86c6694d4f773dd9cbc4242 Mon Sep 17 00:00:00 2001 From: Ralf Hartmann Date: Wed, 19 May 2004 09:25:34 +0000 Subject: [PATCH] New in_local_range function. git-svn-id: https://svn.dealii.org/trunk@9266 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/petsc_vector_base.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/deal.II/lac/include/lac/petsc_vector_base.h b/deal.II/lac/include/lac/petsc_vector_base.h index cef84df66e..af3a6cb8f0 100644 --- a/deal.II/lac/include/lac/petsc_vector_base.h +++ b/deal.II/lac/include/lac/petsc_vector_base.h @@ -327,6 +327,13 @@ namespace PETScWrappers */ std::pair local_range () const; + /** + * Return whether @p index is + * in the local range or not, + * see also local_range(). + */ + bool in_local_range (const unsigned int index) const; + /** * Provide access to a given element, * both read and write. @@ -849,6 +856,20 @@ namespace PETScWrappers + inline + bool + VectorBase::in_local_range (const unsigned int index) const + { + int begin, end; + const int ierr = VecGetOwnershipRange (static_cast(vector), + &begin, &end); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + return (index >= static_cast(begin)) && (index < static_cast(end)); + } + + + inline internal::VectorReference VectorBase::operator () (const unsigned int index) -- 2.39.5