From: wolf Date: Mon, 9 Nov 1998 11:45:10 +0000 (+0000) Subject: Allow negative values for the refinement/coarsening criteria; do the actual refinemen... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a8832f729e2e789ea477ff213e52a0c9b9e8b24;p=dealii-svn.git Allow negative values for the refinement/coarsening criteria; do the actual refinement/coarsening on the absolute values, however. git-svn-id: https://svn.dealii.org/trunk@664 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/grid/tria.h b/deal.II/deal.II/include/grid/tria.h index 1cb011c71f..e2a9315de4 100644 --- a/deal.II/deal.II/include/grid/tria.h +++ b/deal.II/deal.II/include/grid/tria.h @@ -1353,13 +1353,19 @@ class Triangulation : public TriaDimensionInfo, public Subscriptor { * Refine the triangulation according to * the given criteria. The criterion is a * #double# value for each cell which - * determines which cells are to be refine + * determines which cells are to be refined * by comparison with the threshold: if the * value for a cell is larger than the * threshold, the cell is flagged for * refinement. It is your duty to guarantee * that the threshold value is in a - * resonable range. + * resonable range. Please note that the + * #criteria# array may contain negative + * values (sometimes, error estimators + * are evaluated in a way which produces + * positive and negative values), but the + * comparison with #threshold# is done only + * on the absolute values of the criteria. * * The cells are only flagged for * refinement, they are not actually @@ -1377,7 +1383,8 @@ class Triangulation : public TriaDimensionInfo, public Subscriptor { /** * Analogue to the #refine# function: * flag all cells for coarsening for - * which the criterion is less than the + * which the absolute value of the + * criterion is less than the * given threshold. */ void coarsen (const dVector &criteria, diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index 35f548a642..c63802c16e 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -2275,7 +2275,7 @@ void Triangulation::refine (const dVector &criteria, const unsigned int n_cells = criteria.size(); for (unsigned int index=0; index= threshold) + if (fabs(criteria(index)) >= threshold) cell->set_refine_flag(); }; @@ -2291,7 +2291,7 @@ void Triangulation::coarsen (const dVector &criteria, const unsigned int n_cells = criteria.size(); for (unsigned int index=0; indexset_coarsen_flag(); };