]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add PETSc min function
authoryoung <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 27 May 2010 15:06:13 +0000 (15:06 +0000)
committeryoung <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 27 May 2010 15:06:13 +0000 (15:06 +0000)
git-svn-id: https://svn.dealii.org/trunk@21139 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 1025b9d7c5cc746e22fbe26e19ec0e65d05ff5f7..30a2036778a87b4ec5a82a28bb57deaeb1164321 100644 (file)
@@ -475,12 +475,19 @@ namespace PETScWrappers
                                         */
       real_type normalize () const;
 
+                                       /**
+                                        * Return vector component with
+                                        * the minimal magnitude.
+                                        */
+      real_type min () const;
+
                                        /**
                                         * Return vector component with
                                         * the maximal magnitude.
                                         */
       real_type max () const;
 
+
                                        /**
                                         * Replace every element in a
                                         * vector with its absolute
index 9f6550833d56f57692a1b4f7682252b87ffa9e17..ff60b8fa12baae42a7d62974a3e814381c5074ed 100644 (file)
@@ -457,6 +457,18 @@ namespace PETScWrappers
   }
 
 
+  VectorBase::real_type
+  VectorBase::min ()  const
+  {
+    PetscInt  p;
+    real_type d;
+
+    const int ierr = VecMin (vector, &p, &d);
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+
+    return d;
+  }
+
 
   VectorBase::real_type
   VectorBase::max ()  const
@@ -471,7 +483,6 @@ namespace PETScWrappers
   }
 
 
-
   VectorBase &
   VectorBase::abs ()
   {

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.