From: hartmann Date: Wed, 19 May 2004 09:25:34 +0000 (+0000) Subject: New in_local_range function. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=627cce1eb4365356349ca7c64e0fa86fe0a4cd40;p=dealii-svn.git New in_local_range function. git-svn-id: https://svn.dealii.org/trunk@9266 0785d39b-7218-0410-832d-ea1e28bc413d --- 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)