From: Toby D. Young Date: Mon, 3 Jun 2013 10:01:02 +0000 (+0000) Subject: Deal with PETSC_USE_COMPLEX in PETScWrappers. X-Git-Tag: v8.0.0~325 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9da22757876419017c210795263ed77b5a900476;p=dealii.git Deal with PETSC_USE_COMPLEX in PETScWrappers. git-svn-id: https://svn.dealii.org/trunk@29736 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/lac/petsc_matrix_base.h b/deal.II/include/deal.II/lac/petsc_matrix_base.h index c5eafdb4d7..9ba11127fe 100644 --- a/deal.II/include/deal.II/lac/petsc_matrix_base.h +++ b/deal.II/include/deal.II/lac/petsc_matrix_base.h @@ -916,7 +916,7 @@ namespace PETScWrappers * diagonal entries in the * matrix. */ - PetscReal trace () const; + PetscScalar trace () const; #endif /** 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 4222be10e1..8d6b6c127c 100644 --- a/deal.II/include/deal.II/lac/petsc_vector_base.h +++ b/deal.II/include/deal.II/lac/petsc_vector_base.h @@ -504,11 +504,12 @@ namespace PETScWrappers */ real_type norm_sqr () const; +#ifndef PETSC_USE_COMPLEX /** - * Mean value of the elements of - * this vector. + * 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_matrix_base.cc b/deal.II/source/lac/petsc_matrix_base.cc index 036addb339..d114eac5f2 100644 --- a/deal.II/source/lac/petsc_matrix_base.cc +++ b/deal.II/source/lac/petsc_matrix_base.cc @@ -428,10 +428,10 @@ namespace PETScWrappers #if DEAL_II_PETSC_VERSION_GTE(3,1,0) - PetscReal + PetscScalar MatrixBase::trace () const { - PetscReal result; + PetscScalar result; const int ierr = MatGetTrace (matrix, &result); diff --git a/deal.II/source/lac/petsc_vector_base.cc b/deal.II/source/lac/petsc_vector_base.cc index 0f8deef8af..268ca13316 100644 --- a/deal.II/source/lac/petsc_vector_base.cc +++ b/deal.II/source/lac/petsc_vector_base.cc @@ -409,18 +409,20 @@ 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()’ +#ifndef PETSC_USE_COMPLEX PetscScalar VectorBase::mean_value () const { int ierr; + // We can only use our more efficient // routine in the serial case. if (dynamic_cast(this) != 0) { PetscScalar sum; - ierr = VecSum( vector, &sum); + ierr = VecSum(vector, &sum); AssertThrow (ierr == 0, ExcPETScError(ierr)); return sum/size(); } @@ -464,7 +466,7 @@ namespace PETScWrappers return mean; } - +#endif VectorBase::real_type