]> https://gitweb.dealii.org/ - dealii.git/commitdiff
do a todo - use PetscReal where real_type is needed.
authorToby D. Young <tyoung@ippt.pan.pl>
Thu, 3 Oct 2013 17:47:32 +0000 (17:47 +0000)
committerToby D. Young <tyoung@ippt.pan.pl>
Thu, 3 Oct 2013 17:47:32 +0000 (17:47 +0000)
git-svn-id: https://svn.dealii.org/trunk@31095 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/lac/petsc_vector_base.cc

index ae6e39c52b464a5c1ecef6322f34519eb54750d2..4166708d9801a3fe01058e5d059e3d18351de609 100644 (file)
@@ -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<PetscReal>(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<PetscScalar>(size());
+      mean = (sum0+sum1+sum2+sum3)/static_cast<PetscReal>(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
   }
 
 

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.