/**
* A namespace for classes internal to the
* triangulation classes and helpers.
- */
+ */
namespace Triangulation
{
-
+
/**
* Cache class used to store the number of used and active elements
* (lines or quads etc) within the levels of a triangulation. This
* @author Wolfgang Bangerth, 1999
*/
template <>
- struct NumberCache<1>
+ struct NumberCache<1>
{
/**
* Number of used lines in the whole
* lines on each level.
*/
std::vector<unsigned int> n_lines_level;
-
+
/**
* Number of active lines in the
* whole triangulation.
* quads on each level.
*/
std::vector<unsigned int> n_quads_level;
-
+
/**
* Number of active quads in the
* whole triangulation.
* hexes on each level.
*/
std::vector<unsigned int> n_hexes_level;
-
+
/**
* Number of active hexes in the
* whole triangulation.
/**
* Triangulations denote a hierarchy of levels of elements which together
- * form a @p dim -dimensional manifold in @p spacedim spatial dimensions
+ * form a @p dim -dimensional manifold in @p spacedim spatial dimensions
* (if spacedim is not specified it takes the default value @ spacedim=dim).
- *
- * Thus, for example, an object of type @p Triangulation<1,1> (or simply
- * @p Triangulation<1> since @p spacedim==dim by default) is used to represent
- * and handle the usual one-dimensional triangulation used in the finite
- * element method (so, segments on a straight line). On the other hand,
- * objects such as @p Triangulation<1,2> or @p Triangulation<2,3> (that
- * are associated with curves in 2D or surfaces in 3D)
+ *
+ * Thus, for example, an object of type @p Triangulation<1,1> (or simply
+ * @p Triangulation<1> since @p spacedim==dim by default) is used to represent
+ * and handle the usual one-dimensional triangulation used in the finite
+ * element method (so, segments on a straight line). On the other hand,
+ * objects such as @p Triangulation<1,2> or @p Triangulation<2,3> (that
+ * are associated with curves in 2D or surfaces in 3D)
* are the ones one wants to use in the boundary element method.
*
* This class is written to be as independent of the dimension as possible
* concept of iterators (see the STL documentation and TriaRawIterator).
* In order to make things as easy and dimension independent as possible,
* use of class local typedefs is made, see below.
- *
+ *
* The Triangulation class provides iterator which enable looping over all
* lines, cells, etc without knowing the exact representation used to
* describe them. Their names are typedefs imported from the Iterators
* <ul>
* <li> @p raw_line_iterator: loop over all lines, used or not (declared for
* all dimensions).
- *
+ *
* <li> @p line_iterator: loop over all used lines (declared for all dimensions).
*
* <li> @p active_line_iterator: loop over all active lines (declared for all
*
* <li> @p raw_quad_iterator: loop over all quads, used or not (declared only
* for <tt>dim>=2</tt>).
- *
+ *
* <li> @p quad_iterator: loop over all quads (declared only for @p dim>=2).
*
* <li> @p active_quad_iterator: loop over all active quads (declared only for
* @endverbatim
* while for @p dim==2
* @verbatim
- * typedef quad_line_iterator raw_cell_iterator;
+ * typedef quad_line_iterator raw_cell_iterator;
* typedef quad_iterator cell_iterator;
* typedef active_quad_iterator active_cell_iterator;
*
* typedef raw_line_iterator raw_face_iterator;
* typedef line_iterator face_iterator;
- * typedef active_line_iterator active_face_iterator;
+ * typedef active_line_iterator active_face_iterator;
* @endverbatim
*
* By using the cell iterators, you can write code nearly independent of
* Usage of these iterators works mostly like with the STL iterators. Some
* examples taken from the Triangulation source code follow (notice that in the last
* two examples the template parameter @p spacedim has been omitted, so it takes
- * the default value @ dim).
+ * the default value <code>dim</code>).
* <ul>
* <li> <em>Counting the number of cells on a specific level</em>
* @verbatim
* begin (level+1)),
* n);
* return n;
- * };
+ * };
* @endverbatim
- *
+ *
* <li> <em>Refining all cells of a triangulation</em>
* @verbatim
* template <int dim>
* // we want to log the
* // refinement history
* ofstream history ("mesh.history");
- *
+ *
* // refine first cell
* tria.begin_active()->set_refine_flag();
* tria.save_refine_flags (history);
* tria.begin_active()->set_refine_flag ();
* tria.save_refine_flags (history);
* tria.execute_coarsening_and_refinement ();
- *
+ *
* Triangulation<2>::active_cell_iterator cell;
- * for (int i=0; i<17; ++i)
+ * for (int i=0; i<17; ++i)
* {
* // refine the presently
* // second last cell 17
* // output the grid
* ofstream out("grid.1");
* GridOut::write_gnuplot (tria, out);
- * };
+ * };
* @endverbatim
*
- *
+ *
* <h3>Creating a triangulation</h3>
*
* There are several possibilities to create a triangulation:
* generalizations and others, are provided by the GridGenerator
* class which takes a triangulation and fills it by a division
* of the required domain.
- *
+ *
* <li> Reading in a triangulation: By using an object of the GridIn
* class, you can read in fairly general triangulations. See there for
* more information. The mentioned class uses the interface described
* This flag includes all the above ones and therefore combines all
* smoothing algorithms implemented.
*
- * <li> @p allow_anisotropic_smoothing:
+ * <li> @p allow_anisotropic_smoothing:
* This flag is not included in @p maximum_smoothing. The flag is
* concerned with the following case: consider the case that an
* unrefined and a refined cell share a common face and that one
* ...;
* tria.save_refine_flags (history);
* tria.execute_coarsening_and_refinement ();
- * };
+ * };
* @endverbatim
*
* If you want to re-create the grid from the stored information, you write:
* for (int step=0; step<10; ++step) {
* tria.load_refine_flags (history);
* tria.execute_coarsening_and_refinement ();
- * };
+ * };
* @endverbatim
*
* The same scheme is employed for coarsening and the coarsening flags.
*
* Just like the user flags, this field is not available for vertices,
* which does no harm since the vertices have a unique and continuous number
- * unlike the structured objects lines and quads.
+ * unlike the structured objects lines and quads.
*
*
* <h3>Boundary approximation</h3>
* determine the proper component. See Boundary for the
* details. Usage with the Triangulation object is then like this
* (let @p Ball be a class derived from Boundary<tt><2></tt>):
- *
+ *
* @verbatim
* void main () {
* Triangulation<2> tria;
*
*
* Triangulation<2>::active_cell_iterator cell, endc;
- * for (int i=0; i<8; ++i)
+ * for (int i=0; i<8; ++i)
* {
* cell = tria.begin_active();
* endc = tria.end();
*
* tria.execute_coarsening_and_refinement();
* };
- * };
+ * };
* @endverbatim
*
* You should take note of one caveat: if you have concave
* apply some smoothing for multigrid algorithms, but this has to be decided
* upon later.
*
- *
+ *
* <h3>Warning</h3>
*
* It seems impossible to preserve @p constness of a triangulation through
* classes simpler.
*/
typedef internal::Triangulation::Iterators<dim, spacedim> IteratorSelector;
-
+
public:
/**
* Default boundary object. This is used
*/
static const StraightBoundary<dim,spacedim> straight_boundary;
- /**
+ /**
* Default boundary object to be
* used in the codimension 1
* case. This is used for those
enum MeshSmoothing
{
none = 0x0,
- limit_level_difference_at_vertices = 0x1,
+ limit_level_difference_at_vertices = 0x1,
eliminate_unrefined_islands = 0x2,
patch_level_1 = 0x4,
coarsest_level_1 = 0x8,
allow_anisotropic_smoothing = 0x10,
-
+
eliminate_refined_inner_islands = 0x100,
eliminate_refined_boundary_islands = 0x200,
do_not_produce_unrefined_islands = 0x400,
-
+
smoothing_on_refinement = (limit_level_difference_at_vertices |
eliminate_unrefined_islands),
smoothing_on_coarsening = (eliminate_refined_inner_islands |
eliminate_refined_boundary_islands |
do_not_produce_unrefined_islands),
-
+
maximum_smoothing = 0xffff ^ allow_anisotropic_smoothing
};
-
+
typedef typename IteratorSelector::raw_line_iterator raw_line_iterator;
typedef typename IteratorSelector::line_iterator line_iterator;
typedef typename IteratorSelector::raw_face_iterator raw_face_iterator;
typedef typename IteratorSelector::face_iterator face_iterator;
typedef typename IteratorSelector::active_face_iterator active_face_iterator;
-
+
/**
- * Base class for refinement listeners.
+ * Base class for refinement listeners.
* Other classes, which need to be
* informed about refinements of the
* Triangulation,
* class also has virtual functions.
*/
virtual ~RefinementListener ();
-
+
/**
* Before refinement is actually
* performed, the triangulation class
virtual
void
pre_refinement_notification (const Triangulation<dim, spacedim> &tria);
-
+
/**
* After refinement is actually
* performed, the triangulation class
std::list<typename Triangulation<dim,spacedim>::cell_iterator>
distorted_cells;
};
-
-
+
+
/**
* Make the dimension available
* in function templates.
* avoid copies.
*/
Triangulation (const Triangulation<dim, spacedim> &t);
-
+
/**
* Delete the object and all levels of
* the hierarchy.
* triangulation is empty.
*/
void set_mesh_smoothing(const MeshSmoothing mesh_smoothing);
-
- /**
+
+ /**
* If @p dim==spacedim, assign a boundary
* object to a certain part of the
* boundary of a the triangulation. If a
* non-linear (i.e.: non-Q1)
* transformations of cells to the unit
* cell in shape function calculations.
- *
+ *
* If @p dim!=spacedim the boundary object
* is in fact the exact manifold that the
* triangulation is approximating (for
* same name and two arguments.
*/
void set_boundary (const unsigned int number);
-
+
/**
* Return a constant reference to
* a boundary object used for
* or equal one).
*/
std::vector<unsigned char> get_boundary_indicators() const;
-
+
/**
* Copy a triangulation. This
* operation is not cheap, so
* class).
*/
virtual void execute_coarsening_and_refinement ();
-
+
/**
* Do both preparation for
* refinement and coarsening as
* returns whether additional
* cells have been flagged for
* refinement.
- *
+ *
* See the general doc of this
* class for more information on
* smoothing upon refinement.
* flagging and deflagging cells
* in preparation of the actual
* coarsening step are done. This
- * includes deleting coarsen
+ * includes deleting coarsen
* flags from cells which may not
* be deleted (e.g. because one
* neighbor is more refined
* still need them afterwards.
*/
bool prepare_coarsening_and_refinement ();
-
+
/**
* Add a
* RefinementListener. Adding
* both for next access.
*/
void clear_user_data ();
-
+
/**
* @deprecated User
* clear_user_data() instead.
* Clear all user pointers.
*/
void clear_user_pointers ();
-
+
/**
* Save all user indices. The
* output vector is resized if
*/
void load_user_pointers_hex (const std::vector<void *> &v);
/*@}*/
-
-
+
+
/**
* @name Cell iterator functions
*/
* <tt>end()</tt>.
*/
cell_iterator end (const unsigned int level) const;
-
+
/**
* Return a raw iterator which is the first
* iterator not on level. If @p level is
/**
* Iterator to the first face, used
* or not. As faces have no level,
- * no argument can be given.
+ * no argument can be given.
*
* This function calls @p begin_raw_line
* in 2D and @p begin_raw_quad in 3D.
* If lines are no cells, i.e. for @p dim>1
* no @p level argument must be given.
* The same applies for all the other functions
- * above, of course.
+ * above, of course.
*/
raw_line_iterator
begin_raw_line (const unsigned int level = 0) const;
* <tt>end()</tt>.
*/
line_iterator end_line (const unsigned int level) const;
-
+
/**
* Return a raw iterator which is the first
* iterator not on level. If @p level is
*/
active_line_iterator
last_active_line (const unsigned int level) const;
- /*@}*/
+ /*@}*/
/*---------------------------------------*/
* is returned.
* If quads are no cells, i.e. for $dim>2$
* no level argument must be given.
-
+
*/
raw_quad_iterator
begin_raw_quad (const unsigned int level = 0) const;
* <tt>end()</tt>.
*/
quad_iterator end_quad (const unsigned int level) const;
-
+
/**
* Return a raw iterator which is the first
* iterator not on level. If @p level is
* <tt>end()</tt>.
*/
hex_iterator end_hex (const unsigned int level) const;
-
+
/**
* Return a raw iterator which is the first
* iterator not on level. If @p level is
/*@}*/
/*---------------------------------------*/
-
+
/**
* @name Information about the triangulation
*/
* are faces in 2D and therefore
* have no level.
*/
-
+
/**
* Total Number of lines, used or
* unused.
* active or not.
*/
unsigned int n_lines () const;
-
+
/**
* Return total number of used lines,
* active or not on level @p level.
*/
unsigned int n_lines (const unsigned int level) const;
-
+
/**
* Return total number of active lines.
*/
unsigned int n_active_lines () const;
-
+
/**
* Return total number of active lines,
* on level @p level.
*/
unsigned int n_active_lines (const unsigned int level) const;
-
+
/**
* Total number of quads, used or
* unused.
* active or not on level @p level.
*/
unsigned int n_quads (const unsigned int level) const;
-
+
/**
* Return total number of active quads,
* active or not.
*/
unsigned int n_active_quads () const;
-
+
/**
* Return total number of active quads,
* active or not on level @p level.
*/
unsigned int n_active_quads (const unsigned int level) const;
-
+
/**
* Total number of hexs, used or
* unused.
* active or not on level @p level.
*/
unsigned int n_hexs(const unsigned int level) const;
-
+
/**
* Return total number of active hexahedra,
* active or not.
*/
unsigned int n_active_hexs() const;
-
+
/**
* Return total number of active hexahedra,
* active or not on level @p level.
* with this @p index is used.
*/
bool vertex_used (const unsigned int index) const;
-
+
/**
* Return a constant reference to
* the array of @p bools
*/
const std::vector<bool> &
get_used_vertices () const;
-
+
/**
* Return the maximum number of
* cells meeting at a common
* derived class.
*/
virtual unsigned int memory_consumption () const;
-
+
/**
* @name Exceptions
* function).
*/
void clear_despite_subscriptions ();
-
+
/**
* Refine all cells on all levels which
* were previously flagged for refinement.
* children that satisfy the
* criteria of
* @ref GlossDistorted "distorted cells".
- */
+ */
DistortedCellList execute_refinement ();
/**
* List of RefinementListeners,
* which want to be informed if the
* Triangulation is refined.
- */
+ */
mutable std::list<RefinementListener *> refinement_listeners;
// make a couple of classes
template <int,int,int> friend class TriaAccessor;
friend class CellAccessor<dim, spacedim>;
- friend class internal::TriaAccessor::Implementation;
-
+ friend class internal::TriaAccessor::Implementation;
+
friend class hp::DoFHandler<dim,spacedim>;
friend class internal::Triangulation::Implementation;