From: Toby D. Young Date: Thu, 3 Oct 2013 17:47:32 +0000 (+0000) Subject: do a todo - use PetscReal where real_type is needed. X-Git-Tag: v8.1.0~649 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d47947124d93845e9905cf9d97764dd6210cac8;p=dealii.git do a todo - use PetscReal where real_type is needed. git-svn-id: https://svn.dealii.org/trunk@31095 0785d39b-7218-0410-832d-ea1e28bc413d --- 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 }