]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Change some things in the implementation of the grid smoothing algorithms.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 14 Aug 1998 12:23:03 +0000 (12:23 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 14 Aug 1998 12:23:03 +0000 (12:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@484 0785d39b-7218-0410-832d-ea1e28bc413d

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

index b86d428be442d14c5598fa61d223b71c8872aaa1..66fc1c1bfc5a8e24bed1694885ada33448a268a2 100644 (file)
@@ -689,17 +689,22 @@ class TriaDimensionInfo<2> {
  *     the author by now.
  *
  *   \item #eliminate_refined_islands#:
- *     This algorithm seeks for isolated cells which are refined. An
- *     island is defined similar as above, i.e. a cell is flagged for coarsening
- *     if it is refined but more of its neighbors are not refined than are
- *     refined. For example, in 2D, a cell's refinement is reverted if at most
+ *     This algorithm seeks for isolated cells which are refined or flagged
+ *     for refinement. This definition is unlike that for
+ *     #eliminate_unrefined_islands#, which would mean that an island is
+ *     defined as a cell which
+ *     is refined but more of its neighbors are not refined than are refined.
+ *     For example, in 2D, a cell's refinement would be reverted if at most
  *     one of its neighbors is also refined (or refined but flagged for
- *     coarsening). This option is a bit dangerous, since if you consider a
+ *     coarsening).
+ *
+ *     The reason for the change in definition of an island is, that this
+ *     option would be a bit dangerous, since if you consider a
  *     chain of refined cells (e.g. along a kink in the solution), the cells
- *     at the two ends will be coarsened, after which the next outermost cells
+ *     at the two ends would be coarsened, after which the next outermost cells
  *     would need to be coarsened. Therefore, only one loop of flagging cells
- *     like this is done to avoid eating up the whole chain of refined cells
- *     (`chain reaction'...).
+ *     like this could be done to avoid eating up the whole chain of refined
+ *     cells (`chain reaction'...).
  *
  *     This algorithm also takes into account cells which are not actually
  *     refined but are flagged for refinement. If necessary, it takes away the
@@ -966,8 +971,7 @@ class TriaDimensionInfo<2> {
  *       a cell is flagged for refinement or if all of its children are active
  *       and if the number of neighbors which are either active and not flagged
  *       for refinement, or not active but all children flagged for coarsening
- *       exceeds the number of other neighbors, or the neighbor's refinement
- *       level is less than the present cell's level, then this cell's children
+ *       equals the total number of neighbors, then this cell's children
  *       are flagged for coarsening or (if this cell was flagged for refinement)
  *       the refine flag is cleared.
  *
index f90cb00deb086a67e4ece8d4a14d61fafa77f8e0..57fe54ac1e6912ebde292215fae29253616938de 100644 (file)
@@ -2999,6 +2999,7 @@ void Triangulation<dim>::execute_coarsening () {
 
 
 
+
 template <int dim>
 bool Triangulation<dim>::prepare_refinement () {
   bool cells_changed = false;
@@ -3149,6 +3150,7 @@ bool Triangulation<dim>::prepare_refinement () {
 
 
 
+
 template <int dim>
 bool Triangulation<dim>::prepare_coarsening () {
                                   // checking whether the coarsen flags
@@ -3259,12 +3261,16 @@ bool Triangulation<dim>::prepare_coarsening () {
                                                 // are counted as unrefined since
                                                 // they can only get to the same
                                                 // level as this cell by the
-                                                // next refinement cycle
-               unsigned int refined_neighbors = 0,
-                          unrefined_neighbors = 0;
+                                // next refinement cycle
+                unsigned int unrefined_neighbors = 0,
+                                total_neighbors = 0;
+
                for (unsigned int n=0; n<GeometryInfo<dim>::faces_per_cell; ++n) 
                  {
                    const cell_iterator neighbor = cell->neighbor(n);
+                    if (neighbor.state() == valid)
+                      ++total_neighbors;
+
                    if (neighbor.state() == valid)
                      if ((neighbor->active() &&
                           !neighbor->refine_flag_set()) ||
@@ -3272,20 +3278,17 @@ bool Triangulation<dim>::prepare_coarsening () {
                           neighbor->user_flag_set())    ||   // marked for coarsening
                          (neighbor->level() == cell->level()-1))
                        ++unrefined_neighbors;
-                     else
-                       ++refined_neighbors;
                  };
                
 
-                                                // if the number of unrefined
-                                                // neighbors exceed that of the
-                                                // refined neighbors: mark this
+                                                // if all neighbors unrefined:
+                                                // mark this
                                                 // cell for coarsening or don't
                                                 // refine if marked for that
-               if (refined_neighbors<unrefined_neighbors)
+               if (unrefined_neighbors == total_neighbors)
                  if (!cell->active())
                    cell->set_user_flag();
-                 else
+                 else 
                    cell->clear_refine_flag();
              };
          };
@@ -3358,7 +3361,11 @@ bool Triangulation<dim>::prepare_coarsening () {
       {
        cell->clear_user_flag();
        for (unsigned int c=0; c<GeometryInfo<dim>::children_per_cell; ++c)
-         cell->child(c)->set_coarsen_flag();
+         {
+           if (cell->child(c)->refine_flag_set())
+             cell->child(c)->clear_refine_flag();
+           cell->child(c)->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.