From e1d84627cbc7612d5c93288bd2cceb9c16aec61b Mon Sep 17 00:00:00 2001 From: young Date: Thu, 3 Oct 2013 17:47:32 +0000 Subject: [PATCH] do a todo - use PetscReal where real_type is needed. git-svn-id: https://svn.dealii.org/trunk@31095 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/lac/petsc_vector_base.cc | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/deal.II/source/lac/petsc_vector_base.cc b/deal.II/source/lac/petsc_vector_base.cc index ae6e39c52b..4166708d98 100644 --- a/deal.II/source/lac/petsc_vector_base.cc +++ b/deal.II/source/lac/petsc_vector_base.cc @@ -411,12 +411,11 @@ namespace PETScWrappers return d*d; } - // @todo does not build with PETSc complex scalar types. - // :425:25: error: no match for ‘operator/’ in ‘sum / dealii::PETScWrappers::VectorBase::size()’ + + PetscScalar VectorBase::mean_value () const { -#ifndef PETSC_USE_COMPLEX int ierr; // We can only use our more efficient @@ -426,7 +425,7 @@ namespace PETScWrappers PetscScalar sum; ierr = VecSum(vector, &sum); AssertThrow (ierr == 0, ExcPETScError(ierr)); - return sum/size(); + return sum/static_cast(size()); } // get a representation of the vector and @@ -458,7 +457,7 @@ namespace PETScWrappers while (ptr != start_ptr+size()) sum0 += *ptr++; - mean = (sum0+sum1+sum2+sum3)/static_cast(size()); + mean = (sum0+sum1+sum2+sum3)/static_cast(size()); } // restore the representation of the @@ -467,16 +466,6 @@ 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 } -- 2.39.5