From: hartmann Date: Tue, 19 Dec 2006 10:25:03 +0000 (+0000) Subject: New MeshSmoothing::coarsest_level_1 flag. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8111cd1ec0318ab598e89d7c0bad409d0bf7aa23;p=dealii-svn.git New MeshSmoothing::coarsest_level_1 flag. git-svn-id: https://svn.dealii.org/trunk@14263 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 c8f721a1dd..4acacbf783 100644 --- a/deal.II/deal.II/include/grid/tria.h +++ b/deal.II/deal.II/include/grid/tria.h @@ -808,6 +808,18 @@ namespace internal * eliminate_refined_boundary_islands will be ignored as they will * be fulfilled automatically. * + *
  • @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. + * *
  • @p smoothing_on_refinement: * This flag sums up all smoothing algorithms which may be performed upon * refinement by flagging some more cells for refinement. @@ -1192,6 +1204,7 @@ class Triangulation : public Subscriptor 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, diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index d726f7037f..2e7343a5c7 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -7562,26 +7562,30 @@ bool Triangulation::prepare_coarsening_and_refinement () // 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 @@ -7596,12 +7600,12 @@ bool Triangulation::prepare_coarsening_and_refinement () // 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 // @@ -7637,8 +7641,25 @@ bool Triangulation::prepare_coarsening_and_refinement () 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::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 @@ -7731,7 +7752,7 @@ bool Triangulation::prepare_coarsening_and_refinement () ////////////////////////////////////// - // STEP 1: + // STEP 2: // eliminate refined islands in the // interior and at the boundary. since // they don't do much harm besides @@ -7877,7 +7898,7 @@ bool Triangulation::prepare_coarsening_and_refinement () } ////////////////////////////////////// - // STEP 2: + // STEP 3: // limit the level difference of // neighboring cells at each vertex. if (smooth_grid & limit_level_difference_at_vertices) @@ -7937,7 +7958,7 @@ bool Triangulation::prepare_coarsening_and_refinement () } ///////////////////////////////////// - // STEP 3: + // STEP 4: // eliminate unrefined // islands. this has higher // priority since this @@ -7994,7 +8015,7 @@ bool Triangulation::prepare_coarsening_and_refinement () ///////////////////////////////// - // STEP 4: + // STEP 5: // ensure patch level 1. // // Introduce some terminology: @@ -8166,7 +8187,7 @@ bool Triangulation::prepare_coarsening_and_refinement () ///////////////////////////////// - // 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) @@ -8208,14 +8229,14 @@ bool Triangulation::prepare_coarsening_and_refinement () } ////////////////////////////////////// - // 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