From: hartmann Date: Mon, 26 Nov 2001 16:20:56 +0000 (+0000) Subject: Make the GridRefinement::refine function work also when the threshold happens to... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7d0e9ac0ed18e8c0b733cd39ec26f0a2c066e78;p=dealii-svn.git Make the GridRefinement::refine function work also when the threshold happens to be zero. git-svn-id: https://svn.dealii.org/trunk@5271 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/grid/grid_refinement.cc b/deal.II/deal.II/source/grid/grid_refinement.cc index ab1518c9f3..0f7c109390 100644 --- a/deal.II/deal.II/source/grid/grid_refinement.cc +++ b/deal.II/deal.II/source/grid/grid_refinement.cc @@ -81,21 +81,24 @@ void GridRefinement::refine (Triangulation &tria, Assert (criteria.size() == tria.n_active_cells(), ExcInvalidVectorSize(criteria.size(), tria.n_active_cells())); Assert (*std::min_element(criteria.begin(), criteria.end()) >= 0, - ExcInvalidParameterValue()); - - // nothing to do; especially we - // do not want to flag with zero - // error since then we may get - // into conflict with coarsening - // in some cases - if (threshold==0) - return; + ExcInvalidParameterValue()); typename Triangulation::active_cell_iterator cell = tria.begin_active(); const unsigned int n_cells = criteria.size(); + + double new_threshold=threshold; + // when threshold==0 find the + // smallest value in criteria + // greater 0 + if (new_threshold==0) + for (unsigned int index=0; index0 + && (criteria(index)= threshold) + if (std::fabs(criteria(index)) >= new_threshold) cell->set_refine_flag(); };