* eliminate_refined_boundary_islands will be ignored as they will
* be fulfilled automatically.
*
+ * <li> @p coarsest_level_1:
+ * Each coarse grid cell is refined at least once, i.e. the
+ * triangulation might have active cells on level 1 but not on
+ * level 0. This flag ensures that a mesh which has
+ * coarsest_level_1 has still coarsest_level_1 after coarsening
+ * and refinement. It is, however, the user's responsibility to
+ * ensure that the mesh has coarsest_level_1 before calling
+ * execute_coarsening_and_refinement the first time. The easiest
+ * way to achieve this is by calling global_refine(1) straight
+ * after creation of the triangulation. It follows that active
+ * cells on level 1 may not be coarsenend.
+ *
* <li> @p smoothing_on_refinement:
* This flag sums up all smoothing algorithms which may be performed upon
* refinement by flagging some more cells for refinement.
limit_level_difference_at_vertices = 0x1,
eliminate_unrefined_islands = 0x2,
patch_level_1 = 0x4,
+ coarsest_level_1 = 0x8,
eliminate_refined_inner_islands = 0x100,
eliminate_refined_boundary_islands = 0x200,
// are done the first. the
// following order is chosen:
//
- // 0/ do not coarsen a cell if
+ // 0/ Only if coarsest_level_1 is set:
+ // clear all coarsen flags on level 1
+ // to avoid level 0 cells being
+ // created by coarsening.
+ // 1/ do not coarsen a cell if
// 'most of the neighbors' will be
// refined after the step. This is
// to prevent occurence of
// unrefined islands.
- // 1/ eliminate refined islands in the
+ // 2/ eliminate refined islands in the
// interior and at the boundary. since
// they don't do much harm besides
// increasing the number of degrees
// of freedom, doing this has a
// rather low priority.
- // 2/ limit the level difference of
+ // 3/ limit the level difference of
// neighboring cells at each vertex.
- // 3/ eliminate unrefined islands. this
+ // 4/ eliminate unrefined islands. this
// has higher priority since this
// diminishes the approximation
// properties not only of the unrefined
// island, but also of the surrounding
// patch.
- // 4/ ensure patch level 1. Then the
+ // 5/ ensure patch level 1. Then the
// triangulation consists of patches,
// i.e. of cells that are
// refined once. It follows that if
// eliminate_refined_boundary_islands will
// be fulfilled automatically and do not
// need to be enforced separately.
- // 5/ take care of the requirement that no
+ // 6/ take care of the requirement that no
// double refinement is done at each face
- // 6/ take care that no double refinement
+ // 7/ take care that no double refinement
// is done at each line in 3d or higher
// dimensions.
- // 7/ make sure that all children of each
+ // 8/ make sure that all children of each
// cell are either flagged for coarsening
// or none of the children is
//
do
{
- //////////////////////////////////////
+ //////////////////////////////////////
// STEP 0:
+ // Only if coarsest_level_1 is set:
+ // clear all coarsen flags on level 1
+ // to avoid level 0 cells being
+ // created by coarsening.
+ if (smooth_grid & coarsest_level_1 && n_levels()>=2)
+ {
+ typename Triangulation<dim>::cell_iterator
+ cell=begin(1),
+ endc=end(1);
+
+ for (; cell!=endc; ++cell)
+ cell->clear_coarsen_flag();
+ }
+
+
+ //////////////////////////////////////
+ // STEP 1:
// do not coarsen a cell if 'most of
// the neighbors' will be refined after
// the step. This is to prevent the
//////////////////////////////////////
- // STEP 1:
+ // STEP 2:
// eliminate refined islands in the
// interior and at the boundary. since
// they don't do much harm besides
}
//////////////////////////////////////
- // STEP 2:
+ // STEP 3:
// limit the level difference of
// neighboring cells at each vertex.
if (smooth_grid & limit_level_difference_at_vertices)
}
/////////////////////////////////////
- // STEP 3:
+ // STEP 4:
// eliminate unrefined
// islands. this has higher
// priority since this
/////////////////////////////////
- // STEP 4:
+ // STEP 5:
// ensure patch level 1.
//
// Introduce some terminology:
/////////////////////////////////
- // STEP 5:
+ // STEP 6:
// take care of the requirement that no
// double refinement is done at each face
for (active_cell_iterator cell = last_active(); cell != end(); --cell)
}
//////////////////////////////////////
- // STEP 6:
+ // STEP 7:
// take care that no double refinement
// is done at each line in 3d or higher
// dimensions.
prepare_refinement_dim_dependent ();
//////////////////////////////////////
- // STEP 7:
+ // STEP 8:
// make sure that all children of each
// cell are either flagged for coarsening
// or none of the children is