]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Deal kindly with PETSC_USE_COMPLEX in PETScWrappers.
authoryoung <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 3 Jun 2013 10:33:11 +0000 (10:33 +0000)
committeryoung <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 3 Jun 2013 10:33:11 +0000 (10:33 +0000)
git-svn-id: https://svn.dealii.org/trunk@29737 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/petsc_vector_base.h
deal.II/source/lac/petsc_vector_base.cc

index 8d6b6c127c83d3c03505797775ff0576b43a3dc2..72ec27bfb00dd38d821864a4102bf0d582ff2c8c 100644 (file)
@@ -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.
index 268ca13316be78caf33431f638aae0cbaeb0a819..a763f0532cb481b588fc8168009e608aeabd2e15 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.