]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New in_local_range function.
authorRalf Hartmann <Ralf.Hartmann@dlr.de>
Wed, 19 May 2004 09:25:34 +0000 (09:25 +0000)
committerRalf Hartmann <Ralf.Hartmann@dlr.de>
Wed, 19 May 2004 09:25:34 +0000 (09:25 +0000)
git-svn-id: https://svn.dealii.org/trunk@9266 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/petsc_vector_base.h

index cef84df66e7feb1b3c7ec9bbc7a89d4335609a28..af3a6cb8f02e3efae92f426b61c841cb9ddffabe 100644 (file)
@@ -327,6 +327,13 @@ namespace PETScWrappers
                                        */
       std::pair<unsigned int, unsigned int> 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<const Vec &>(vector),
+                                          &begin, &end);
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+    
+    return (index >= static_cast<unsigned int>(begin)) && (index < static_cast<unsigned int>(end));
+  }
+
+
+
   inline
   internal::VectorReference
   VectorBase::operator () (const unsigned int index)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.