* Therefore if your new boundary vertex is too near the center of
* the old quadrilateral or hexahedron, the distance to the midpoint
* vertex will become too small, thus generating distorted
- * cells. Remedy: take care of such situations when defining the
- * coarse grid.
+ * cells. This issue is discussed extensively in
+ * @ref GlossDistorted "distorted cells".
*
*
* <h3>Technical details</h3>
* execute_coarsening_and_refinement()
* functions, and they can be
* caught in user code if this
- * condition is to be ignored.
+ * condition is to be
+ * ignored. Note, however, that
+ * such exceptions are only
+ * produced if the necessity for
+ * this check was indicated when
+ * calling the constructor of the
+ * Triangulation class.
*
* A cell is called
* <i>deformed</i> if the
* Create an empty
* triangulation. Do not create
* any cells.
+ *
+ * @param smooth_grid Determines
+ * the level of smoothness of the
+ * mesh size function that should
+ * be enforced upon mesh
+ * refinement.
+ *
+ * @param
+ * check_for_distorted_cells
+ * Determines whether the
+ * triangulation should check
+ * whether any of the cells that
+ * are created by
+ * create_triangulation() or
+ * execute_coarsening_and_refinement()
+ * are distorted (see @ref
+ * GlossDistorted "distorted
+ * cells"). If set, these two
+ * functions may throw an
+ * exception if they encounter
+ * distorted cells.
*/
- Triangulation (const MeshSmoothing smooth_grid = none);
+ Triangulation (const MeshSmoothing smooth_grid = none,
+ const bool check_for_distorted_cells = false);
/**
* Copy constructor.
* and the GridIn and
* GridReordering class.
*
- * At the very end of its
- * operation, this function walks
+ * If the
+ * <code>check_for_distorted_cells</code>
+ * flag was specified upon
+ * creation of this object, at
+ * the very end of its operation,
+ * the current function walks
* over all cells and verifies
* that none of the cells is
- * deformed (see
- * the entry on @ref GlossDistorted in
- * the glossary), where we call a cell
- * deformed if the determinant of
- * the Jacobian of the mapping
- * from reference cell to real
- * cell is negative at least at
- * one of the vertices (this
- * computation is done using the
+ * deformed (see the entry on
+ * @ref GlossDistorted "distorted
+ * cells" in the glossary), where
+ * we call a cell deformed if the
+ * determinant of the Jacobian of
+ * the mapping from reference
+ * cell to real cell is negative
+ * at least at one of the
+ * vertices (this computation is
+ * done using the
* GeometryInfo::jacobian_determinants_at_vertices
* function). If there are
* deformed cells, this function
* does not create such an
* exception if no cells have
* created distorted children.
+ * Note that for the check for
+ * distorted cells to happen, the
+ * <code>check_for_distorted_cells</code>
+ * flag has to be specified upon
+ * creation of a triangulation
+ * object.
*
* See the general docs for more
* information.
* of cells that have produced
* children that satisfy the
* criteria of
- * @ref GlossDistorted "distorted cells".
+ * @ref GlossDistorted "distorted cells"
+ * if the
+ * <code>check_for_distorted_cells</code>
+ * flag was specified upon
+ * creation of this object, at
*/
DistortedCellList execute_refinement ();
*/
MeshSmoothing smooth_grid;
+ /**
+ * A flag that determines whether
+ * we are to check for distorted
+ * cells upon creation and
+ * refinement of a mesh.
+ */
+ const bool check_for_distorted_cells;
+
/**
* Cache to hold the numbers of lines,
* quads, hexes, etc. These numbers
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
template <int spacedim>
static
typename Triangulation<1,spacedim>::DistortedCellList
- execute_refinement (Triangulation<1,spacedim> &triangulation)
+ execute_refinement (Triangulation<1,spacedim> &triangulation,
+ const bool check_for_distorted_cells)
{
const unsigned int dim = 1;
template <int spacedim>
static
typename Triangulation<2,spacedim>::DistortedCellList
- execute_refinement (Triangulation<2,spacedim> &triangulation)
+ execute_refinement (Triangulation<2,spacedim> &triangulation,
+ const bool check_for_distorted_cells)
{
const unsigned int dim = 2;
next_unused_cell,
cell);
- if (has_distorted_children (cell,
+ if ((check_for_distorted_cells == true)
+ &&
+ has_distorted_children (cell,
internal::int2type<dim>(),
internal::int2type<spacedim>()))
cells_with_distorted_children.distorted_cells.push_back (cell);
template <int spacedim>
static
typename Triangulation<3,spacedim>::DistortedCellList
- execute_refinement (Triangulation<3,spacedim> &triangulation)
+ execute_refinement (Triangulation<3,spacedim> &triangulation,
+ const bool check_for_distorted_cells)
{
const unsigned int dim = 3;
// and if so
// add them to
// our list
- if (has_distorted_children (hex,
+ if ((check_for_distorted_cells == true)
+ &&
+ has_distorted_children (hex,
internal::int2type<dim>(),
internal::int2type<spacedim>()))
cells_with_distorted_children.distorted_cells.push_back (hex);
template <int dim, int spacedim>
-Triangulation<dim, spacedim>::Triangulation (const MeshSmoothing smooth_grid)
+Triangulation<dim, spacedim>::
+Triangulation (const MeshSmoothing smooth_grid,
+ const bool check_for_distorted_cells)
:
faces(NULL),
anisotropic_refinement(false),
- smooth_grid(smooth_grid)
+ smooth_grid(smooth_grid),
+ check_for_distorted_cells(check_for_distorted_cells)
{
// set default boundary for all
// possible components
template <int dim, int spacedim>
-Triangulation<dim, spacedim>::Triangulation (const Triangulation<dim, spacedim> &)
+Triangulation<dim, spacedim>::
+Triangulation (const Triangulation<dim, spacedim> &)
// do not set any subscriptors;
// anyway, calling this constructor
// is an error!
:
- Subscriptor()
+ Subscriptor(),
+ check_for_distorted_cells(check_for_distorted_cells)
{
Assert (false, ExcInternalError());
}
// first collect all distorted
// cells and then throw an
// exception if there are any
- DistortedCellList distorted_cells = collect_distorted_coarse_cells (*this);
- // throw the array (and fill the
- // various location fields) if
- // there are distorted
- // cells. otherwise, just fall off
- // the end of the function
- AssertThrow (distorted_cells.distorted_cells.size() == 0,
- distorted_cells);
+ if (check_for_distorted_cells == true)
+ {
+ DistortedCellList distorted_cells = collect_distorted_coarse_cells (*this);
+ // throw the array (and fill the
+ // various location fields) if
+ // there are distorted
+ // cells. otherwise, just fall off
+ // the end of the function
+ AssertThrow (distorted_cells.distorted_cells.size() == 0,
+ distorted_cells);
+ }
}
{
const DistortedCellList
cells_with_distorted_children
- = internal::Triangulation::Implementation::execute_refinement (*this);
+ =
+ internal::Triangulation::Implementation::
+ execute_refinement (*this,check_for_distorted_cells);
* as the result of mesh refinement if the boundary description in use
* is sufficiently irregular.
*
- * The function Triangulation::create_triangulation, which is called
+ * If the appropriate flag is given upon creation of a triangulation,
+ * the function Triangulation::create_triangulation, which is called
* by the various functions in GridGenerator and GridIn (but can also
- * be called from user code, see step-14 will signal
+ * be called from user code, see step-14, will signal
* the creation of coarse meshes with distorted cells by throwing an
* exception of type Triangulation::DistortedCellList. There are
* legitimate cases for creating meshes with distorted cells (in
* fix up exactly these cells if possible by moving around the node at
* the center of the cell.
*
+ * Note that the Triangulation class does not test for the presence of
+ * distorted cells by default, since the determination whether a cell
+ * is distorted or not is not a cheap operation. If you want a
+ * Triangulation object to test for distortion of cells, you need to
+ * specify this upon creation of the object by passing the appropriate
+ * flag.
+ *
*
* <dt class="glossary">@anchor GlossFaceOrientation <b>Face orientation</b></dt>
* <dd>In a triangulation, the normal vector to a face
<br>
(GK 2009/08/04)
</p>
-
- <li>
- <p>
- Changed: Previously, the Triangulation::create_triangulation
- function silently accepted input meshes with inverted cells
- (i.e. cells with a zero or negative determinant of the Jacobian of
- the mapping from the reference cell to the real cell). This has been
- changed now: The function checks whether cells are distorted or
- inverted, and may throw an exception containing a list of cells
- for which this is the case. If you know that this is harmless, for
- example if you have cells with collapsed vertices in your mesh but
- you do not intend to integrate on them, then you can catch and
- ignore this message. In all other cases, the output of your
- computations are likely to be wrong anyway.
- <br>
- The same is true for the Triangulation::execute_coarsening_and_refinement
- function: if it creates cells that are distorted, it throws a list of cells
- whose children are distorted.
- <br>
- The whole issue is described in some detail in the entry on
- @ref GlossDistorted "distorted cells" in the glossary.
- <br>
- (WB 2009/06/29)
- </p>
- </li>
</ol>
<p>
New: The class MGTransferSelect is prepared for use on adaptively refined meshes.
<br>
- (Bärbel Janssen 2010/02/05)
+ (Bärbel Janssen 2010/02/05)
</p>
</li>
New: The function Cuthill_McKee in namespace DoFRenumbering is now also compiled for
MGDoFHandler as well as the make_sparsity_pattern functions in DoFTools.
<br>
- (Bärbel Janssen 2010/01/08)
+ (Bärbel Janssen 2010/01/08)
</p>
</li>
</p>
</li>
+ <li>
+ <p>
+ New: Previously, the Triangulation::create_triangulation
+ function silently accepted input meshes with inverted cells
+ (i.e. cells with a zero or negative determinant of the Jacobian of
+ the mapping from the reference cell to the real cell). This can been
+ changed now: By passing the appropriate flag to the constructor of
+ the Triangulation class, the Triangulation::create_triangulation
+ function checks whether cells are distorted or
+ inverted, and may throw an exception containing a list of cells
+ for which this is the case. If you know that this is harmless, for
+ example if you have cells with collapsed vertices in your mesh but
+ you do not intend to integrate on them, then you can catch and
+ ignore this message. In all other cases, the output of your
+ computations are likely to be wrong anyway.
+ <br>
+ The same is true for the Triangulation::execute_coarsening_and_refinement
+ function: if it creates cells that are distorted, it throws a list of cells
+ whose children are distorted.
+ <br>
+ The whole issue is described in some detail in the entry on
+ @ref GlossDistorted "distorted cells" in the glossary.
+ <br>
+ (WB 2009/06/29)
+ </p>
+ </li>
+
+
<li>
<p>
New: The new hp::DoFHandler::set_active_fe_indices function allows