]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Allow negative values for the refinement/coarsening criteria; do the actual refinemen...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 9 Nov 1998 11:45:10 +0000 (11:45 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 9 Nov 1998 11:45:10 +0000 (11:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@664 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 1cb011c71fb23da072e9584e653ef9b869c2acae..e2a9315de497e3ffe7f8c7df0147944ef4378297 100644 (file)
@@ -1353,13 +1353,19 @@ class Triangulation : public TriaDimensionInfo<dim>, 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<dim>, 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,
index 35f548a642f24e231954a8fa0af2c6d0262a3d0c..c63802c16e8c0a0b50503f02f5ba1f9e8f05d5b3 100644 (file)
@@ -2275,7 +2275,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 (fabs(criteria(index)) >= threshold)
       cell->set_refine_flag();
 };
 
@@ -2291,7 +2291,7 @@ void Triangulation<dim>::coarsen (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 (fabs(criteria(index)) <= threshold)
       cell->set_coarsen_flag();
 };
 

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.