]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use appropriate data types.
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 27 Oct 2017 21:51:34 +0000 (15:51 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 27 Oct 2017 21:51:34 +0000 (15:51 -0600)
include/deal.II/lac/block_vector_base.h

index 02a967252d82961c0fa7a38ae3c6a52b97c0c9bc..c2e0c59da754a49a2e868d648e50079ff38b77e9 100644 (file)
@@ -18,6 +18,7 @@
 
 
 #include <deal.II/base/config.h>
+#include <deal.II/base/numbers.h>
 #include <deal.II/base/exceptions.h>
 #include <deal.II/base/subscriptor.h>
 #include <deal.II/base/memory_consumption.h>
@@ -1693,9 +1694,9 @@ BlockVectorBase<VectorType>::mean_value () const
   value_type sum = 0.;
   // need to do static_cast as otherwise it won't work with value_type=complex<T>
   for (size_type i=0; i<n_blocks(); ++i)
-    sum += components[i].mean_value() * static_cast<double>(components[i].size());
+    sum += components[i].mean_value() * (typename numbers::NumberTraits<value_type>::real_type(components[i].size()));
 
-  return sum/static_cast<double>(size());
+  return sum/(typename numbers::NumberTraits<value_type>::real_type(size()));
 }
 
 

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.