]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
fix bug in parallel::distributed::GridRefinement for a mesh with less cells than...
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 29 Aug 2011 22:24:30 +0000 (22:24 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 29 Aug 2011 22:24:30 +0000 (22:24 +0000)
git-svn-id: https://svn.dealii.org/trunk@24211 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/distributed/grid_refinement.cc

index 5421ca8f1759cf251dd530f9c7543a1111544a7c..1f9306cd31988b26dc53a32d293f8b8e8d3b59b6 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <numeric>
 #include <algorithm>
+#include <limits>
 
 
 DEAL_II_NAMESPACE_OPEN
@@ -44,7 +45,11 @@ namespace
   number
   max_element (const Vector<number> &criteria)
   {
-    return *std::max_element(criteria.begin(), criteria.end());
+    return (criteria.size()>0)
+       ?
+       (*std::max_element(criteria.begin(), criteria.end()))
+       :
+       std::numeric_limits<number>::min();
   }
 
 
@@ -54,7 +59,11 @@ namespace
   number
   min_element (const Vector<number> &criteria)
   {
-    return *std::min_element(criteria.begin(), criteria.end());
+    return (criteria.size()>0)
+       ?
+       (*std::min_element(criteria.begin(), criteria.end()))
+       :
+       std::numeric_limits<number>::max();
   }
 
 

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.