From c90dd6e1b2c8678fdf5e4ff433942acb094c3c93 Mon Sep 17 00:00:00 2001 From: heister Date: Mon, 29 Aug 2011 22:24:30 +0000 Subject: [PATCH] fix bug in parallel::distributed::GridRefinement for a mesh with less cells than CPUs involved. git-svn-id: https://svn.dealii.org/trunk@24211 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/distributed/grid_refinement.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/deal.II/source/distributed/grid_refinement.cc b/deal.II/source/distributed/grid_refinement.cc index 5421ca8f17..1f9306cd31 100644 --- a/deal.II/source/distributed/grid_refinement.cc +++ b/deal.II/source/distributed/grid_refinement.cc @@ -32,6 +32,7 @@ #include #include +#include DEAL_II_NAMESPACE_OPEN @@ -44,7 +45,11 @@ namespace number max_element (const Vector &criteria) { - return *std::max_element(criteria.begin(), criteria.end()); + return (criteria.size()>0) + ? + (*std::max_element(criteria.begin(), criteria.end())) + : + std::numeric_limits::min(); } @@ -54,7 +59,11 @@ namespace number min_element (const Vector &criteria) { - return *std::min_element(criteria.begin(), criteria.end()); + return (criteria.size()>0) + ? + (*std::min_element(criteria.begin(), criteria.end())) + : + std::numeric_limits::max(); } -- 2.39.5