]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify the code that accumulates the weights for cells during partitioning. 2214/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 22 Feb 2016 01:39:10 +0000 (19:39 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 22 Feb 2016 01:39:10 +0000 (19:39 -0600)
include/deal.II/grid/tria.h

index f6b857743ef5194f5b19241d2ac6640459c92a68..cd67d8dc6f92294da3b8471dc5e6cfd331cca7d6 100644 (file)
@@ -39,6 +39,7 @@ DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
 #include <vector>
 #include <list>
 #include <map>
+#include <algorithm>
 
 
 DEAL_II_NAMESPACE_OPEN
@@ -1949,18 +1950,7 @@ public:
     template<typename InputIterator>
     T operator()(InputIterator first, InputIterator last) const
     {
-      // If there are no slots to call, just return the
-      // default-constructed value
-      if (first == last)
-        return T();
-
-      T sum = *first++;
-      while (first != last)
-        {
-          sum += *first++;
-        }
-
-      return sum;
+      return std::accumulate (first, last, T());
     }
   };
 

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.