]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix trivial problem.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 11 May 1998 16:52:32 +0000 (16:52 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 11 May 1998 16:52:32 +0000 (16:52 +0000)
git-svn-id: https://svn.dealii.org/trunk@278 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/grid/tria.cc

index 87209e962e95700686ee702c4a6787685c8e3ab9..0530ca8cebd589b707ab5f1bcf6ba82011dcdf7b 100644 (file)
@@ -1741,7 +1741,7 @@ void Triangulation<dim>::refine (const dVector &criteria,
   const unsigned int n_cells = criteria.size();
   
   for (unsigned int index=0; index<n_cells; ++cell, ++index)
-    if (criteria(index) > threshold)
+    if (criteria(index) >= threshold)
       cell->set_refine_flag();
 };
 
@@ -1753,15 +1753,18 @@ void Triangulation<dim>::refine_fixed_number (const dVector &criteria,
                                   // correct number of cells is
                                   // checked in #refine#
   Assert ((fraction>0) && (fraction<=1), ExcInvalidParameterValue());
+
+                                  // refine at least one cell
+  const refine_cells = max(static_cast<int>(fraction*criteria.size()),
+                          1);
   
-  dVector tmp(criteria);
+  dVector tmp(criteria);  
   nth_element (tmp.begin(),
-              tmp.begin()+static_cast<int>(fraction*tmp.size()),
+              tmp.begin()+refine_cells,
               tmp.end(),
               greater<double>());
 
-  refine (criteria, *(tmp.begin() +
-                     static_cast<int>(fraction*tmp.size())));
+  refine (criteria, *(tmp.begin() + refine_cells));
 };
 
 

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.