From 6f7ff7d17f52ea422bdc0592966a92a0d5656a2a Mon Sep 17 00:00:00 2001 From: young Date: Thu, 27 May 2010 15:06:13 +0000 Subject: [PATCH] Add PETSc min function git-svn-id: https://svn.dealii.org/trunk@21139 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/petsc_vector_base.h | 7 +++++++ deal.II/lac/source/petsc_vector_base.cc | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/deal.II/lac/include/lac/petsc_vector_base.h b/deal.II/lac/include/lac/petsc_vector_base.h index 1025b9d7c5..30a2036778 100644 --- a/deal.II/lac/include/lac/petsc_vector_base.h +++ b/deal.II/lac/include/lac/petsc_vector_base.h @@ -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 diff --git a/deal.II/lac/source/petsc_vector_base.cc b/deal.II/lac/source/petsc_vector_base.cc index 9f6550833d..ff60b8fa12 100644 --- a/deal.II/lac/source/petsc_vector_base.cc +++ b/deal.II/lac/source/petsc_vector_base.cc @@ -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 () { -- 2.39.5