From: Wolfgang Bangerth Date: Sun, 16 Aug 1998 12:24:39 +0000 (+0000) Subject: Change the mode of operation of mesh smoothing once more slightly. X-Git-Tag: v8.0.0~22759 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d769611a70802793ac172b9c71c009f5f4dc80f7;p=dealii.git Change the mode of operation of mesh smoothing once more slightly. git-svn-id: https://svn.dealii.org/trunk@495 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 66fc1c1bfc..fd660175b2 100644 --- a/deal.II/deal.II/include/grid/tria.h +++ b/deal.II/deal.II/include/grid/tria.h @@ -45,11 +45,13 @@ enum MeshSmoothing { limit_level_difference_at_vertices = 0x1, eliminate_unrefined_islands = 0x2, - eliminate_refined_islands = 0x4, + eliminate_refined_inner_islands = 0x100, + eliminate_refined_boundary_islands = 0x200, smoothing_on_refinement = (limit_level_difference_at_vertices | eliminate_unrefined_islands), - smoothing_on_coarsening = (eliminate_refined_islands), + smoothing_on_coarsening = (eliminate_refined_inner_islands | + eliminate_refined_boundary_islands), maximum_smoothing = 0xffff }; @@ -688,7 +690,7 @@ class TriaDimensionInfo<2> { * name of the flag may indicate. However, no better name came to mind to * the author by now. * - * \item #eliminate_refined_islands#: + * \item #eliminate_refined_*_islands#: * 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 @@ -710,6 +712,16 @@ class TriaDimensionInfo<2> { * refined but are flagged for refinement. If necessary, it takes away the * refinement flag. * + * Actually there are two versions of this flag, + * #eliminate_refined_inner_islands# and #eliminate_refined_boundary_islands#. + * There first eliminates islands defined by the definition above which are + * in the interior of the domain, while the second eliminates only those + * islands if the cell is at the boundary. The reason for this split of + * flags is that one often wants to eliminate such islands in the interior + * while those at the boundary may well be wanted, for example if one + * refines the mesh according to a criterion associated with a boundary + * integral or if one has rough boundary data. + * * \item #smoothing_on_refinement#: * This flag sums up all smoothing algorithms which may be performed upon * refinement by flagging some more cells for refinement. @@ -966,7 +978,7 @@ class TriaDimensionInfo<2> { * will need refinement, we will need additional loops of regularisation * and smoothing over all cells until nothing changes any more. * - * \item #eliminate_refined_islands#: + * \item #eliminate_refined_*_islands#: * This one does much the same as the above one, but for coarsening. If * 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 @@ -975,6 +987,10 @@ class TriaDimensionInfo<2> { * are flagged for coarsening or (if this cell was flagged for refinement) * the refine flag is cleared. * + * For a description of the distinction between the two versions of the + * flag see above in the section about mesh smoothing in the general part + * of this class's description. + * * The same applies as above: several loops may be necessary. * \end{itemize} * \end{itemize} diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index 5b1675582a..22fb6df959 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -3251,7 +3251,8 @@ bool Triangulation::prepare_coarsening () { // do some smoothing on the mesh if required if (dim>1) - if (smooth_grid & eliminate_refined_islands) + if (smooth_grid & (eliminate_refined_inner_islands | + eliminate_refined_boundary_islands)) for (cell=begin(); cell!=endc; ++cell) if (!cell->active() || (cell->active() && cell->refine_flag_set())) { @@ -3303,7 +3304,16 @@ bool Triangulation::prepare_coarsening () { // mark this // cell for coarsening or don't // refine if marked for that - if (unrefined_neighbors == total_neighbors) + // + // also do the distinction + // between the two versions of + // the eliminate_refined_*_islands + // flag + if ((unrefined_neighbors == total_neighbors) && + (((unrefined_neighbors==GeometryInfo::faces_per_cell) && + (smooth_grid & eliminate_refined_inner_islands)) || + ((unrefined_neighbors::faces_per_cell) && + (smooth_grid & eliminate_refined_boundary_islands)) )) if (!cell->active()) cell->set_user_flag(); else