From 52f47418382000a0c8e27affd22057ccb5b18037 Mon Sep 17 00:00:00 2001 From: young Date: Mon, 3 Jun 2013 10:01:02 +0000 Subject: [PATCH] Deal with PETSC_USE_COMPLEX in PETScWrappers. git-svn-id: https://svn.dealii.org/trunk@29736 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/lac/petsc_matrix_base.h | 2 +- deal.II/include/deal.II/lac/petsc_vector_base.h | 5 +++-- deal.II/source/lac/petsc_matrix_base.cc | 4 ++-- deal.II/source/lac/petsc_vector_base.cc | 10 ++++++---- 4 files changed, 12 insertions(+), 9 deletions(-) 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 -- 2.39.5