From c2e87f5366d41a760614caad2077105265f9bf3e Mon Sep 17 00:00:00 2001 From: "Toby D. Young" Date: Mon, 3 Jun 2013 10:33:11 +0000 Subject: [PATCH] Deal kindly with PETSC_USE_COMPLEX in PETScWrappers. git-svn-id: https://svn.dealii.org/trunk@29737 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/lac/petsc_vector_base.h | 2 -- deal.II/source/lac/petsc_vector_base.cc | 13 +++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/deal.II/include/deal.II/lac/petsc_vector_base.h b/deal.II/include/deal.II/lac/petsc_vector_base.h index 8d6b6c127c..72ec27bfb0 100644 --- a/deal.II/include/deal.II/lac/petsc_vector_base.h +++ b/deal.II/include/deal.II/lac/petsc_vector_base.h @@ -504,12 +504,10 @@ namespace PETScWrappers */ real_type norm_sqr () const; -#ifndef PETSC_USE_COMPLEX /** * Return the mean value of the elements of this vector. */ PetscScalar mean_value () const; -#endif /** * $l_1$-norm of the vector. diff --git a/deal.II/source/lac/petsc_vector_base.cc b/deal.II/source/lac/petsc_vector_base.cc index 268ca13316..a763f0532c 100644 --- a/deal.II/source/lac/petsc_vector_base.cc +++ b/deal.II/source/lac/petsc_vector_base.cc @@ -411,10 +411,10 @@ namespace PETScWrappers // @todo does not build with PETSc complex scalar types. // :425:25: error: no match for ‘operator/’ in ‘sum / dealii::PETScWrappers::VectorBase::size()’ -#ifndef PETSC_USE_COMPLEX PetscScalar VectorBase::mean_value () const { +#ifndef PETSC_USE_COMPLEX int ierr; // We can only use our more efficient @@ -465,8 +465,17 @@ namespace PETScWrappers AssertThrow (ierr == 0, ExcPETScError(ierr)); return mean; - } + +#else // PETSC_USE_COMPLEX + Assert ((false), + ExcMessage ("Your PETSc/SLEPc installation was configured with scalar-type complex " + "but this function is not defined for complex types.")); + + // Prevent compiler warning about no return value + PetscScalar dummy; + return dummy; #endif + } VectorBase::real_type -- 2.39.5