template <int dim> class Boundary;
template <int dim> class StraightBoundary;
-template <int dim> class TriangulationLevel;
+namespace internal
+{
+ namespace Triangulation
+ {
+ template <int dim> class TriaLevel;
+ }
+}
template <int dim> class DoFHandler;
namespace hp
{
/*------------------------------------------------------------------------*/
-
+namespace internal
+{
+ /**
+ * 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
* @ingroup grid
* @author Wolfgang Bangerth, 1999
*/
-template <int dim>
-struct TriaNumberCache
-{
-};
+ template <int dim>
+ struct NumberCache
+ {
+ };
/**
* Cache class used to store the number of used and active elements
* @ingroup grid
* @author Wolfgang Bangerth, 1999
*/
-template <>
-struct TriaNumberCache<1>
-{
- /**
- * Number of used lines in the whole
- * triangulation.
- */
- unsigned int n_lines;
+ template <>
+ struct NumberCache<1>
+ {
+ /**
+ * Number of used lines in the whole
+ * triangulation.
+ */
+ unsigned int n_lines;
- /**
- * Array holding the number of used
- * lines on each level.
- */
- std::vector<unsigned int> n_lines_level;
+ /**
+ * Array holding the number of used
+ * lines on each level.
+ */
+ std::vector<unsigned int> n_lines_level;
- /**
- * Number of active lines in the
- * whole triangulation.
- */
- unsigned int n_active_lines;
+ /**
+ * Number of active lines in the
+ * whole triangulation.
+ */
+ unsigned int n_active_lines;
- /**
- * Array holding the number of active
- * lines on each level.
- */
- std::vector<unsigned int> n_active_lines_level;
+ /**
+ * Array holding the number of active
+ * lines on each level.
+ */
+ std::vector<unsigned int> n_active_lines_level;
- /**
- * Constructor. Set values to zero
- * by default.
- */
- TriaNumberCache ();
+ /**
+ * Constructor. Set values to zero
+ * by default.
+ */
+ NumberCache ();
- /**
- * Determine an estimate for the
- * memory consumption (in bytes)
- * of this object.
- */
- unsigned int memory_consumption () const;
-};
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+ };
/**
* Cache class used to store the number of used and active elements
* (lines or quads etc) within the levels of a triangulation. This
* specialization stores the numbers of quads. Due to the inheritance
- * from the base class TriaNumberCache<1>, the numbers of lines
+ * from the base class NumberCache<1>, the numbers of lines
* are also within this class.
*
* In the old days, whenever one wanted to access one of these
* @ingroup grid
* @author Wolfgang Bangerth, 1999
*/
-template <>
-struct TriaNumberCache<2> : public TriaNumberCache<1>
-{
- /**
- * Number of used quads in the whole
- * triangulation.
- */
- unsigned int n_quads;
+ template <>
+ struct NumberCache<2> : public NumberCache<1>
+ {
+ /**
+ * Number of used quads in the whole
+ * triangulation.
+ */
+ unsigned int n_quads;
- /**
- * Array holding the number of used
- * quads on each level.
- */
- std::vector<unsigned int> n_quads_level;
+ /**
+ * Array holding the number of used
+ * quads on each level.
+ */
+ std::vector<unsigned int> n_quads_level;
- /**
- * Number of active quads in the
- * whole triangulation.
- */
- unsigned int n_active_quads;
+ /**
+ * Number of active quads in the
+ * whole triangulation.
+ */
+ unsigned int n_active_quads;
- /**
- * Array holding the number of active
- * quads on each level.
- */
- std::vector<unsigned int> n_active_quads_level;
+ /**
+ * Array holding the number of active
+ * quads on each level.
+ */
+ std::vector<unsigned int> n_active_quads_level;
- /**
- * Constructor. Set values to zero
- * by default.
- */
- TriaNumberCache ();
+ /**
+ * Constructor. Set values to zero
+ * by default.
+ */
+ NumberCache ();
- /**
- * Determine an estimate for the
- * memory consumption (in bytes)
- * of this object.
- */
- unsigned int memory_consumption () const;
-};
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+ };
//TODO: Replace boundary[255] by a std::vector so we can use constructor of SmartPointer
* Cache class used to store the number of used and active elements
* (lines or quads etc) within the levels of a triangulation. This
* specialization stores the numbers of hexes. Due to the inheritance
- * from the base class TriaNumberCache<2>, the numbers of lines
+ * from the base class NumberCache<2>, the numbers of lines
* and quads are also within this class.
*
* In the old days, whenever one wanted to access one of these
* @ingroup grid
* @author Wolfgang Bangerth, 1999
*/
-template <>
-struct TriaNumberCache<3> : public TriaNumberCache<2>
-{
- /**
- * Number of used hexes in the whole
- * triangulation.
- */
- unsigned int n_hexes;
+ template <>
+ struct NumberCache<3> : public NumberCache<2>
+ {
+ /**
+ * Number of used hexes in the whole
+ * triangulation.
+ */
+ unsigned int n_hexes;
- /**
- * Array holding the number of used
- * hexes on each level.
- */
- std::vector<unsigned int> n_hexes_level;
+ /**
+ * Array holding the number of used
+ * hexes on each level.
+ */
+ std::vector<unsigned int> n_hexes_level;
- /**
- * Number of active hexes in the
- * whole triangulation.
- */
- unsigned int n_active_hexes;
+ /**
+ * Number of active hexes in the
+ * whole triangulation.
+ */
+ unsigned int n_active_hexes;
- /**
- * Array holding the number of active
- * hexes on each level.
- */
- std::vector<unsigned int> n_active_hexes_level;
+ /**
+ * Array holding the number of active
+ * hexes on each level.
+ */
+ std::vector<unsigned int> n_active_hexes_level;
- /**
- * Constructor. Set values to zero
- * by default.
- */
- TriaNumberCache ();
+ /**
+ * Constructor. Set values to zero
+ * by default.
+ */
+ NumberCache ();
- /**
- * Determine an estimate for the
- * memory consumption (in bytes)
- * of this object.
- */
- unsigned int memory_consumption () const;
-};
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+ };
+ }
+}
/*------------------------------------------------------------------------*/
* form a region in @p dim spatial dimensions.
*
* This class is written to be as independent of the dimension as possible
- * (thus the complex construction of the TriangulationLevel classes) to
- * allow code-sharing, to allow reducing the need to mirror changes in the code
- * for one dimension to the code for other dimensions. Nonetheless, some of
- * the functions are dependent of the dimension and there only exist
- * specialized versions for distinct dimensions.
+ * (thus the complex construction of the internal::Triangulation::TriaLevel
+ * classes) to allow code-sharing, to allow reducing the need to mirror
+ * changes in the code for one dimension to the code for other
+ * dimensions. Nonetheless, some of the functions are dependent of the
+ * dimension and there only exist specialized versions for distinct
+ * dimensions.
*
*
* <h3>Structure and iterators</h3>
/**
* Array of pointers pointing to the
- * <tt>TriangulationLevel<dim></tt> objects
- * storing the data on the different
- * levels.
- *
- * Usage is like <tt>levels[3]->quads</tt>.
+ * objects storing the data on the
+ * different levels.
*/
- std::vector<TriangulationLevel<dim>*> levels;
+ std::vector<internal::Triangulation::TriaLevel<dim>*> levels;
/**
* Array of the vertices of this
* frequent operation, this was not
* an optimal solution.
*/
- TriaNumberCache<dim> number_cache;
+ internal::Triangulation::NumberCache<dim> number_cache;
/**
* List of RefinementListeners,
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 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 dim, typename Accessor> class TriaRawIterator;
template <int dim, typename Accessor> class TriaIterator;
template <int dim, typename Accessor> class TriaActiveIterator;
-class Line;
-class Quad;
-class Hexahedron;
-
+namespace internal
+{
+ namespace Triangulation
+ {
+ class Line;
+ class Quad;
+ class Hexahedron;
+ }
+}
template <int celldim, int dim> class TriaObjectAccessor;
template <int dim> class TriaObjectAccessor<0, dim>;
template <int dim> class TriaObjectAccessor<1, dim>;
* <tt>celldim==1</tt>.
*/
- void set (const Line&) const;
+ void set (const internal::Triangulation::Line&) const;
/**
* Copy the data of the given
* quad. Only implemented for
* <tt>celldim==2</tt>.
*/
- void set (const Quad&) const;
+ void set (const internal::Triangulation::Quad&) const;
/**
* Copy the data of the given
* hex. Only implemented for
* <tt>celldim==3</tt>.
*/
- void set (const Hexahedron&) const;
+ void set (const internal::Triangulation::Hexahedron&) const;
/**
* Index of vertex. The
* Copy the data of the given
* line.
*/
- void set (const Line &l) const;
+ void set (const internal::Triangulation::Line &l) const;
/**
* Return the index of vertex
/**
* Copy the data of the given quad.
*/
- void set (const Quad &q) const;
+ void set (const internal::Triangulation::Quad &q) const;
/**
* Return index of a vertex of a
* Copy the data of the given
* hex.
*/
- void set (const Hexahedron &h) const;
+ void set (const internal::Triangulation::Hexahedron &h) const;
/**
* Return index of a vertex of a hex in the internal structures of Triangulation.
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* HyperBallBoundary creating a hyperball with given radius
* around a given center point.
*
- * @ingroup grid
+ * @ingroup boundary
* @author Wolfgang Bangerth, 1999, 2001, Ralf Hartmann, 2001
*/
template <int dim>
* polygon/polyhedron defined by the boundary of the initial coarse
* triangulation.
*
+ * @ingroup boundary
+ *
* @author Wolfgang Bangerth, 1998, 2001, Ralf Hartmann, 2001
*/
template <int dim>
// $Id$
// Version: $Name$
//
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* Boundary, which would seem natural, since this way we can use the
* StraightBoundary::in_between() function.
*
+ * @ingroup boundary
+ *
* @author Guido Kanschat, 2001
*/
template <int dim>
* Boundary, which would seem natural, since this way we can use the
* StraightBoundary::in_between() function.
*
+ * @ingroup boundary
+ *
* @author Wolfgang Bangerth, 1998, Ralf Hartmann, 2001
*/
template <int dim>
* might be useful for computations with rotational symmetry, where
* one dimension is the radius from the axis of rotation.
*
+ * @ingroup boundary
+ *
* @author Wolfgang Bangerth, 1999, 2001
*/
template <int dim>
* sphere are computed automatically upon calling one of the virtual
* functions.
*
+ * @ingroup boundary
+ *
* @author Wolfgang Bangerth, 1999
*/
template <int dim>
* useful for computations with rotational symmetry, where one
* dimension is the radius from the axis of rotation.
*
+ * @ingroup boundary
+ *
* @author Wolfgang Bangerth, 2000
*/
template <int dim>
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
#include <base/config.h>
#include <base/exceptions.h>
+namespace internal
+{
+ namespace Triangulation
+ {
+
/**
* @p Hexahedrons denote the fundamental entities of triangulations
* in three dimensions. They are characterized by the (global)
* @ingroup grid
* @author Wolfgang Bangerth, 1998
*/
-class Hexahedron
-{
- public:
-
- /**
- * Construct a Hex with quad
- * indices @p i0 through
- * @p i5. By default, indices
- * are set to -1, i.e. an
- * invalid value.
- *
- * No convention is set as of
- * now on the order of quads
- */
- Hexahedron (const int i0 = -1,
- const int i1 = -1,
- const int i2 = -1,
- const int i3 = -1,
- const int i4 = -1,
- const int i5 = -1);
+ class Hexahedron
+ {
+ public:
+
+ /**
+ * Construct a Hex with quad
+ * indices @p i0 through
+ * @p i5. By default, indices
+ * are set to -1, i.e. an
+ * invalid value.
+ *
+ * No convention is set as of
+ * now on the order of quads
+ */
+ Hexahedron (const int i0 = -1,
+ const int i1 = -1,
+ const int i2 = -1,
+ const int i3 = -1,
+ const int i4 = -1,
+ const int i5 = -1);
- /**
- * Return the index of quad
- * @p i=0 through 5.
- */
- int quad (const int i) const;
+ /**
+ * Return the index of quad
+ * @p i=0 through 5.
+ */
+ int quad (const int i) const;
- /**
- * Set the index of the @p ith
- * quad to @p index. @p i=0
- * through 5.
- */
- void set_quad (const int i, const int index);
+ /**
+ * Set the index of the @p ith
+ * quad to @p index. @p i=0
+ * through 5.
+ */
+ void set_quad (const int i, const int index);
- /**
- * Determine an estimate for the
- * memory consumption (in bytes)
- * of this object.
- */
- static unsigned int memory_consumption ();
-
- /**
- * Exception
- */
- DeclException1 (ExcRange,
- int,
- << "Indices for the quad number must be 0 through 5, "
- << "but you gave " << arg1);
- protected:
- /**
- * Indices of the six quads that
- * bound this hexahedron. The
- * level index is implicitly
- * given by the level of this
- * hexahedron, so this is only
- * the index within this level.
- */
- int quads[6];
-};
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ static unsigned int memory_consumption ();
+
+ /**
+ * Exception
+ */
+ DeclException1 (ExcRange,
+ int,
+ << "Indices for the quad number must be 0 through 5, "
+ << "but you gave " << arg1);
+ protected:
+ /**
+ * Indices of the six quads that
+ * bound this hexahedron. The
+ * level index is implicitly
+ * given by the level of this
+ * hexahedron, so this is only
+ * the index within this level.
+ */
+ int quads[6];
+ };
/*----------------------------- Inline Function: Hexahedron ------------------------*/
-inline
-Hexahedron::Hexahedron (const int i0, const int i1,
- const int i2, const int i3,
- const int i4, const int i5)
-{
- quads[0] = i0;
- quads[1] = i1;
- quads[2] = i2;
- quads[3] = i3;
- quads[4] = i4;
- quads[5] = i5;
-}
+ inline
+ Hexahedron::Hexahedron (const int i0, const int i1,
+ const int i2, const int i3,
+ const int i4, const int i5)
+ {
+ quads[0] = i0;
+ quads[1] = i1;
+ quads[2] = i2;
+ quads[3] = i3;
+ quads[4] = i4;
+ quads[5] = i5;
+ }
-inline
-int Hexahedron::quad (const int i) const
-{
- Assert ((i>=0) && (i<6),
- ExcRange(i));
- return quads[i];
-}
+ inline
+ int Hexahedron::quad (const int i) const
+ {
+ Assert ((i>=0) && (i<6),
+ ExcRange(i));
+ return quads[i];
+ }
-inline
-void Hexahedron::set_quad (const int i, const int index)
-{
- Assert ((i>=0) && (i<6),
- ExcRange(i));
- quads[i] = index;
-}
+ inline
+ void Hexahedron::set_quad (const int i, const int index)
+ {
+ Assert ((i>=0) && (i<6),
+ ExcRange(i));
+ quads[i] = index;
+ }
-inline
-unsigned int
-Hexahedron::memory_consumption ()
-{
- return sizeof(Hexahedron);
+ inline
+ unsigned int
+ Hexahedron::memory_consumption ()
+ {
+ return sizeof(Hexahedron);
+ }
+
+ }
+
}
#endif
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
#include <grid/tria_hex.h>
#include <base/point.h>
+namespace internal
+{
+ /**
+ * A namespace for classes internal to the
+ * triangulation classes and helpers.
+ */
+ namespace Triangulation
+ {
/**
- * General template for information belonging to one level of a multilevel
- * hierarchy of a triangulation. This template is only declared to allow
- * specializations for different dimensions.
+ * General template for information belonging to one level of a multilevel
+ * hierarchy of a triangulation. This template is only declared to allow
+ * specializations for different dimensions.
*
* @ingroup grid
*/
-template <int dim>
-class TriangulationLevel
-{
-};
+ template <int dim>
+ class TriaLevel
+ {
+ };
/**
- * Store all information which belongs to one level of the multilevel hierarchy.
+ * Store all information which belongs to one level of the multilevel
+ * hierarchy.
*
- * In TriangulationLevel<0> all data is stored which is not
- * dependent on the dimension, e.g. a field to store the
- * refinement flag for the cells (what a cell actually is
- * is declared elsewhere), etc. Actually, it is only cell-based
- * data, like neighborship info or refinement flags. There is another
- * field, which may fit in here, namely the material data (for cells)
- * or the boundary indicators (for faces), but since we need for a line
- * or quad either boundary information or material data, we store them
- * with the lines and quads rather than with the common data. We may,
- * however lose some memory in three dimensions, when we need the
- * material data for cell, boundary data for the quads, but nothing
- * for the lines. Since we only store one byte per line, quad or hex,
- * this is a minor loss and we can live with that.
+ * In TriaLevel<0> all data is stored which is not
+ * dependent on the dimension, e.g. a field to store the
+ * refinement flag for the cells (what a cell actually is
+ * is declared elsewhere), etc. Actually, it is only cell-based
+ * data, like neighborship info or refinement flags. There is another
+ * field, which may fit in here, namely the material data (for cells)
+ * or the boundary indicators (for faces), but since we need for a line
+ * or quad either boundary information or material data, we store them
+ * with the lines and quads rather than with the common data. We may,
+ * however lose some memory in three dimensions, when we need the
+ * material data for cell, boundary data for the quads, but nothing
+ * for the lines. Since we only store one byte per line, quad or hex,
+ * this is a minor loss and we can live with that.
*
* @ingroup grid
- * @author Wolfgang Bangerth, 1998
+ * @author Wolfgang Bangerth, 1998
*/
-template <>
-class TriangulationLevel<0>
-{
- public:
- /**
- * Flags for the cells whether they are
- * to be refined or not. The meaning
- * what a cell is, is dimension specific,
- * therefore also the length of this
- * vector depends on the dimension: in
- * one dimension, the length of this
- * vector equals the length of the
- * @p lines vector, in two dimensions
- * that of the @p quads vector, etc.
- */
- std::vector<bool> refine_flags;
-
- /**
- * Same meaning as the one above, but
- * specifies whether a cell must be
- * coarsened.
- */
- std::vector<bool> coarsen_flags;
+ template <>
+ class TriaLevel<0>
+ {
+ public:
+ /**
+ * Flags for the cells whether they are
+ * to be refined or not. The meaning
+ * what a cell is, is dimension specific,
+ * therefore also the length of this
+ * vector depends on the dimension: in
+ * one dimension, the length of this
+ * vector equals the length of the
+ * @p lines vector, in two dimensions
+ * that of the @p quads vector, etc.
+ */
+ std::vector<bool> refine_flags;
+
+ /**
+ * Same meaning as the one above, but
+ * specifies whether a cell must be
+ * coarsened.
+ */
+ std::vector<bool> coarsen_flags;
- /**
- * Levels and indices of the neighbors
- * of the cells. Convention is, that the
- * neighbors of the cell with index @p i
- * are stored in the fields following
- * $i*(2*real_space_dimension)$, e.g. in
- * one spatial dimension, the neighbors
- * of cell 0 are stored in <tt>neighbors[0]</tt>
- * and <tt>neighbors[1]</tt>, the neighbors of
- * cell 1 are stored in <tt>neighbors[2]</tt>
- * and <tt>neighbors[3]</tt>, and so on.
- *
- * In neighbors, <tt>neighbors[i].first</tt> is
- * the level, while <tt>neighbors[i].first</tt>
- * is the index of the neighbor.
- *
- * If a neighbor does not exist (cell is
- * at the boundary), <tt>level=index=-1</tt>
- * is set.
- *
- * <em>Conventions:</em> The
- * @p ith neighbor of a cell is
- * the one which shares the
- * @p ith face (@p Line in 2D,
- * @p Quad in 3D) of this cell.
- *
- * The neighbor of a cell has at most the
- * same level as this cell, i.e. it may
- * or may not be refined.
- *
- * In one dimension, a neighbor may have
- * any level less or equal the level of
- * this cell. If it has the same level,
- * it may be refined an arbitrary number
- * of times, but the neighbor pointer
- * still points to the cell on the same
- * level, while the neighbors of the
- * childs of the neighbor may point to
- * this cell or its children.
- *
- * In two and more dimensions, the
- * neighbor is either on the same level
- * and refined (in which case its children
- * have neighbor pointers to this cell or
- * its direct children), unrefined on
- * the same level or one level down (in
- * which case its neighbor pointer points
- * to the mother cell of this cell).
- */
- std::vector<std::pair<int,int> > neighbors;
-
- /**
- * One integer per cell to store
- * which subdomain it belongs
- * to. This field is most often
- * used in parallel computations,
- * where it denotes which
- * processor shall work on the
- * cells with a given subdomain
- * number.
- */
- std::vector<unsigned int> subdomain_ids;
+ /**
+ * Levels and indices of the neighbors
+ * of the cells. Convention is, that the
+ * neighbors of the cell with index @p i
+ * are stored in the fields following
+ * $i*(2*real_space_dimension)$, e.g. in
+ * one spatial dimension, the neighbors
+ * of cell 0 are stored in <tt>neighbors[0]</tt>
+ * and <tt>neighbors[1]</tt>, the neighbors of
+ * cell 1 are stored in <tt>neighbors[2]</tt>
+ * and <tt>neighbors[3]</tt>, and so on.
+ *
+ * In neighbors, <tt>neighbors[i].first</tt> is
+ * the level, while <tt>neighbors[i].first</tt>
+ * is the index of the neighbor.
+ *
+ * If a neighbor does not exist (cell is
+ * at the boundary), <tt>level=index=-1</tt>
+ * is set.
+ *
+ * <em>Conventions:</em> The
+ * @p ith neighbor of a cell is
+ * the one which shares the
+ * @p ith face (@p Line in 2D,
+ * @p Quad in 3D) of this cell.
+ *
+ * The neighbor of a cell has at most the
+ * same level as this cell, i.e. it may
+ * or may not be refined.
+ *
+ * In one dimension, a neighbor may have
+ * any level less or equal the level of
+ * this cell. If it has the same level,
+ * it may be refined an arbitrary number
+ * of times, but the neighbor pointer
+ * still points to the cell on the same
+ * level, while the neighbors of the
+ * childs of the neighbor may point to
+ * this cell or its children.
+ *
+ * In two and more dimensions, the
+ * neighbor is either on the same level
+ * and refined (in which case its children
+ * have neighbor pointers to this cell or
+ * its direct children), unrefined on
+ * the same level or one level down (in
+ * which case its neighbor pointer points
+ * to the mother cell of this cell).
+ */
+ std::vector<std::pair<int,int> > neighbors;
+
+ /**
+ * One integer per cell to store
+ * which subdomain it belongs
+ * to. This field is most often
+ * used in parallel computations,
+ * where it denotes which
+ * processor shall work on the
+ * cells with a given subdomain
+ * number.
+ */
+ std::vector<unsigned int> subdomain_ids;
- /**
- * Reserve enough space to accomodate
- * @p total_cells cells on this level.
- * Since there are no @p used flags on this
- * level, you have to give the total number
- * of cells, not only the number of newly
- * to accomodate ones, like in the
- * <tt>TriangulationLevel<N>::reserve_space</tt>
- * functions, with <tt>N>0</tt>.
- *
- * Since the
- * number of neighbors per cell depends
- * on the dimensions, you have to pass
- * that additionally.
- */
- void reserve_space (const unsigned int total_cells,
- const unsigned int dimension);
-
- /**
- * Check the memory consistency of the
- * different containers. Should only be
- * called with the prepro flag @p DEBUG
- * set. The function should be called from
- * the functions of the higher
- * TriangulationLevel classes.
- */
- void monitor_memory (const unsigned int true_dimension) const;
-
- /**
- * Determine an estimate for the
- * memory consumption (in bytes)
- * of this object.
- */
- unsigned int memory_consumption () const;
-
- /**
- * Exception
- */
- DeclException3 (ExcMemoryWasted,
- char*, int, int,
- << "The container " << arg1 << " contains "
- << arg2 << " elements, but it`s capacity is "
- << arg3 << ".");
- /**
- * Exception
- */
- DeclException2 (ExcMemoryInexact,
- int, int,
- << "The containers have sizes " << arg1 << " and "
- << arg2 << ", which is not as expected.");
-};
+ /**
+ * Reserve enough space to accomodate
+ * @p total_cells cells on this level.
+ * Since there are no @p used flags on this
+ * level, you have to give the total number
+ * of cells, not only the number of newly
+ * to accomodate ones, like in the
+ * <tt>TriaLevel<N>::reserve_space</tt>
+ * functions, with <tt>N>0</tt>.
+ *
+ * Since the
+ * number of neighbors per cell depends
+ * on the dimensions, you have to pass
+ * that additionally.
+ */
+ void reserve_space (const unsigned int total_cells,
+ const unsigned int dimension);
+
+ /**
+ * Check the memory consistency of the
+ * different containers. Should only be
+ * called with the prepro flag @p DEBUG
+ * set. The function should be called from
+ * the functions of the higher
+ * TriaLevel classes.
+ */
+ void monitor_memory (const unsigned int true_dimension) const;
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
+ /**
+ * Exception
+ */
+ DeclException3 (ExcMemoryWasted,
+ char*, int, int,
+ << "The container " << arg1 << " contains "
+ << arg2 << " elements, but it`s capacity is "
+ << arg3 << ".");
+ /**
+ * Exception
+ */
+ DeclException2 (ExcMemoryInexact,
+ int, int,
+ << "The containers have sizes " << arg1 << " and "
+ << arg2 << ", which is not as expected.");
+ };
* @ingroup grid
* @author Wolfgang Bangerth, 1998
*/
-template <>
-class TriangulationLevel<1> : public TriangulationLevel<0>
-{
- private:
-
- /**
- * This subclass groups together all that
- * is needed to describe the lines on one
- * level.
- */
- struct LinesData
+ template <>
+ class TriaLevel<1> : public TriaLevel<0>
{
- /**
- * Vector of the lines belonging to
- * this level. The index of the line
- * on this level equals the index in
- * this container, while the global
- * index of a line is stored in the
- * line itself.
- */
- std::vector<Line> lines;
- /**
- * Index of the first child of a line
- * in the list on the next level.
- * Since when lines are refined, both
- * children are created at the same
- * time, they are appended to the list
- * on the next level after each other.
- * We therefore only store the index
- * of the first child, the second
- * follows immediately afterwards.
- *
- * If a line has no children, -1 is
- * stored in this list. A line is
- * called active if it has no
- * children. The function
- * TriaAccessor::has_children()
- * tests for this.
- */
- std::vector<int> children;
+ private:
+
+ /**
+ * This subclass groups together all that
+ * is needed to describe the lines on one
+ * level.
+ */
+ struct LinesData
+ {
+ /**
+ * Vector of the lines belonging to
+ * this level. The index of the line
+ * on this level equals the index in
+ * this container, while the global
+ * index of a line is stored in the
+ * line itself.
+ */
+ std::vector<Line> lines;
+ /**
+ * Index of the first child of a line
+ * in the list on the next level.
+ * Since when lines are refined, both
+ * children are created at the same
+ * time, they are appended to the list
+ * on the next level after each other.
+ * We therefore only store the index
+ * of the first child, the second
+ * follows immediately afterwards.
+ *
+ * If a line has no children, -1 is
+ * stored in this list. A line is
+ * called active if it has no
+ * children. The function
+ * TriaAccessor::has_children()
+ * tests for this.
+ */
+ std::vector<int> children;
- /**
- * Vector storing whether a line is
- * used in the @p lines vector.
- *
- * Since it is difficult to delete
- * elements in a @p vector, when an
- * element is not needed any more
- * (e.g. after derefinement), it is
- * not deleted from the list, but
- * rather the according @p used flag
- * is set to @p false.
- */
- std::vector<bool> used;
-
- /**
- * Make available a field for user data,
- * one bit per line. This field is usually
- * used when an operation runs over all
- * cells and needs information whether
- * another cell (e.g. a neighbor) has
- * already been processed.
- *
- * You can clear all used flags using
- * Triangulation::clear_user_flags().
- */
- std::vector<bool> user_flags;
-
- /**
- * Store boundary and material data. In
- * one dimension, this field stores
- * the material id of a line, which is a
- * number between 0 and 254. In more
- * than one dimension, lines have no
- * material id, but they may be at the
- * boundary; then, we store the
- * boundary indicator in this field,
- * which denotes to which part of the
- * boundary this line belongs and which
- * boundary conditions hold on this
- * part. The boundary indicator also
- * is a number between zero and 254;
- * the id 255 is reserved for lines
- * in the interior and may be used
- * to check whether a line is at the
- * boundary or not, which otherwise
- * is not possible if you don't know
- * which cell it belongs to.
- */
- std::vector<unsigned char> material_id;
-
- /**
- * Pointer which is not used by the
- * library but may be accessed an set
- * by the user to handle data local to
- * a line/quad/etc.
- */
- std::vector<void*> user_pointers;
- };
+ /**
+ * Vector storing whether a line is
+ * used in the @p lines vector.
+ *
+ * Since it is difficult to delete
+ * elements in a @p vector, when an
+ * element is not needed any more
+ * (e.g. after derefinement), it is
+ * not deleted from the list, but
+ * rather the according @p used flag
+ * is set to @p false.
+ */
+ std::vector<bool> used;
+
+ /**
+ * Make available a field for user data,
+ * one bit per line. This field is usually
+ * used when an operation runs over all
+ * cells and needs information whether
+ * another cell (e.g. a neighbor) has
+ * already been processed.
+ *
+ * You can clear all used flags using
+ * Triangulation::clear_user_flags().
+ */
+ std::vector<bool> user_flags;
+
+ /**
+ * Store boundary and material data. In
+ * one dimension, this field stores
+ * the material id of a line, which is a
+ * number between 0 and 254. In more
+ * than one dimension, lines have no
+ * material id, but they may be at the
+ * boundary; then, we store the
+ * boundary indicator in this field,
+ * which denotes to which part of the
+ * boundary this line belongs and which
+ * boundary conditions hold on this
+ * part. The boundary indicator also
+ * is a number between zero and 254;
+ * the id 255 is reserved for lines
+ * in the interior and may be used
+ * to check whether a line is at the
+ * boundary or not, which otherwise
+ * is not possible if you don't know
+ * which cell it belongs to.
+ */
+ std::vector<unsigned char> material_id;
+
+ /**
+ * Pointer which is not used by the
+ * library but may be accessed an set
+ * by the user to handle data local to
+ * a line/quad/etc.
+ */
+ std::vector<void*> user_pointers;
+ };
- public:
- /**
- * Data about the lines.
- */
- LinesData lines;
-
- /**
- * Assert that enough space is
- * allocated to accomodate
- * <tt>new_lines</tt> new lines.
- * This function does not only
- * call
- * <tt>vector::reserve()</tt>,
- * but does really append the
- * needed elements. There are
- * pendants for higher
- * dimensions, which you have to
- * call explicitly (they can't
- * hand down the call because
- * there is no easy relation
- * between the number of new
- * quads and the number of new
- * lines, etc.). Also don't
- * forget to call the
- * <tt>TriangulationLevel<0>::reserve_space</tt>
- * function.
- */
- void reserve_space (const unsigned int new_lines);
-
- /**
- * Check the memory consistency of the
- * different containers. Should only be
- * called with the prepro flag @p DEBUG
- * set. The function should be called from
- * the functions of the higher
- * TriangulationLevel classes.
- */
- void monitor_memory (const unsigned int true_dimension) const;
-
- /**
- * Determine an estimate for the
- * memory consumption (in bytes)
- * of this object.
- */
- unsigned int memory_consumption () const;
-};
+ public:
+ /**
+ * Data about the lines.
+ */
+ LinesData lines;
+
+ /**
+ * Assert that enough space is
+ * allocated to accomodate
+ * <tt>new_lines</tt> new lines.
+ * This function does not only
+ * call
+ * <tt>vector::reserve()</tt>,
+ * but does really append the
+ * needed elements. There are
+ * pendants for higher
+ * dimensions, which you have to
+ * call explicitly (they can't
+ * hand down the call because
+ * there is no easy relation
+ * between the number of new
+ * quads and the number of new
+ * lines, etc.). Also don't
+ * forget to call the
+ * <tt>TriaLevel<0>::reserve_space</tt>
+ * function.
+ */
+ void reserve_space (const unsigned int new_lines);
+
+ /**
+ * Check the memory consistency of the
+ * different containers. Should only be
+ * called with the prepro flag @p DEBUG
+ * set. The function should be called from
+ * the functions of the higher
+ * TriaLevel classes.
+ */
+ void monitor_memory (const unsigned int true_dimension) const;
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+ };
* information about the children of these lines and quads.
*
* The vector of lines and their children is derived from
- * TriangulationLevel<1>.
+ * TriaLevel<1>.
*
* @ingroup grid
* @author Wolfgang Bangerth, 1998
*/
-template <>
-class TriangulationLevel<2> : public TriangulationLevel<1>
-{
- /**
- * This subclass groups together all that
- * is needed to describe the quads on one
- * level.
- *
- * It is fully analogous to the
- * TriangulationLevel<1>::LinesData structure inherited from
- * Triangulation<tt><1></tt>.
- */
- struct QuadsData
+ template <>
+ class TriaLevel<2> : public TriaLevel<1>
{
- /**
- * Same as for the @p lines array.
- */
- std::vector<Quad> quads;
- /**
- * Same as for the
- * TriangulationLevel<1>::LinesData@p ::children
- * array, but since there
- * are four children, the
- * index points to the first
- * while the other three are
- * following immediately
- * afterwards.
- */
- std::vector<int> children;
-
- /**
- * Same as for
- * TriangulationLevel<1>::LinesData@p ::used.
- */
- std::vector<bool> used;
-
- /**
- * Same as for
- * TriangulationLevel<1>::LinesData@p ::used.
- */
- std::vector<bool> user_flags;
-
- /**
- * Store boundary and material data. In
- * two dimension, this field stores
- * the material id of a quad, which is a
- * number between 0 and 254. In more
- * than two dimensions, quads have no
- * material id, but they may be at the
- * boundary; then, we store the
- * boundary indicator in this field,
- * which denotes to which part of the
- * boundary this line belongs and which
- * boundary conditions hold on this
- * part. The boundary indicator also
- * is a number between zero and 254;
- * the id 255 is reserved for quads
- * in the interior and may be used
- * to check whether a quad is at the
- * boundary or not, which otherwise
- * is not possible if you don't know
- * which cell it belongs to.
- */
- std::vector<unsigned char> material_id;
-
-
- /**
- * Pointer which is not used by the
- * library but may be accessed and set
- * by the user to handle data local to
- * a line/quad/etc.
- */
- std::vector<void*> user_pointers;
- };
+ /**
+ * This subclass groups together all that
+ * is needed to describe the quads on one
+ * level.
+ *
+ * It is fully analogous to the
+ * TriaLevel<1>::LinesData structure inherited from
+ * Triangulation<tt><1></tt>.
+ */
+ struct QuadsData
+ {
+ /**
+ * Same as for the @p lines array.
+ */
+ std::vector<Quad> quads;
+ /**
+ * Same as for the
+ * TriaLevel<1>::LinesData@p ::children
+ * array, but since there
+ * are four children, the
+ * index points to the first
+ * while the other three are
+ * following immediately
+ * afterwards.
+ */
+ std::vector<int> children;
+
+ /**
+ * Same as for
+ * TriaLevel<1>::LinesData@p ::used.
+ */
+ std::vector<bool> used;
+
+ /**
+ * Same as for
+ * TriaLevel<1>::LinesData@p ::used.
+ */
+ std::vector<bool> user_flags;
+
+ /**
+ * Store boundary and material data. In
+ * two dimension, this field stores
+ * the material id of a quad, which is a
+ * number between 0 and 254. In more
+ * than two dimensions, quads have no
+ * material id, but they may be at the
+ * boundary; then, we store the
+ * boundary indicator in this field,
+ * which denotes to which part of the
+ * boundary this line belongs and which
+ * boundary conditions hold on this
+ * part. The boundary indicator also
+ * is a number between zero and 254;
+ * the id 255 is reserved for quads
+ * in the interior and may be used
+ * to check whether a quad is at the
+ * boundary or not, which otherwise
+ * is not possible if you don't know
+ * which cell it belongs to.
+ */
+ std::vector<unsigned char> material_id;
+
+
+ /**
+ * Pointer which is not used by the
+ * library but may be accessed and set
+ * by the user to handle data local to
+ * a line/quad/etc.
+ */
+ std::vector<void*> user_pointers;
+ };
- public:
- /**
- * Data about the quads.
- */
- QuadsData quads;
-
- /**
- * Assert that enough space is
- * allocated to accomodate
- * <tt>new_quads</tt> new quads.
- */
- void reserve_space (const unsigned int new_quads);
-
- /**
- * Check the memory consistency of the
- * different containers. Should only be
- * called with the prepro flag @p DEBUG
- * set. The function should be called from
- * the functions of the higher
- * TriangulationLevel classes.
- */
- void monitor_memory (const unsigned int true_dimension) const;
-
- /**
- * Determine an estimate for the
- * memory consumption (in bytes)
- * of this object.
- */
- unsigned int memory_consumption () const;
-};
+ public:
+ /**
+ * Data about the quads.
+ */
+ QuadsData quads;
+
+ /**
+ * Assert that enough space is
+ * allocated to accomodate
+ * <tt>new_quads</tt> new quads.
+ */
+ void reserve_space (const unsigned int new_quads);
+
+ /**
+ * Check the memory consistency of the
+ * different containers. Should only be
+ * called with the prepro flag @p DEBUG
+ * set. The function should be called from
+ * the functions of the higher
+ * TriaLevel classes.
+ */
+ void monitor_memory (const unsigned int true_dimension) const;
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+ };
* Triangulation class) or in the opposite direction.
*
* The vectors of lines and quads and their children are derived from
- * TriangulationLevel<2>.
+ * TriaLevel<2>.
*
* @ingroup grid
* @author Wolfgang Bangerth, 1998, 2003
*/
-template <>
-class TriangulationLevel<3> : public TriangulationLevel<2>
-{
- /**
- * This subclass groups together
- * all that is needed to
- * describe the hexes on one
- * level.
- *
- * It is fully analogous to the
- * TriangulationLevel<1>::LinesData
- * structure inherited from
- * Triangulation<1>.
- */
- struct HexesData
+ template <>
+ class TriaLevel<3> : public TriaLevel<2>
{
- /**
- * Same as for the @p lines array.
- */
- std::vector<Hexahedron> hexes;
+ /**
+ * This subclass groups together
+ * all that is needed to
+ * describe the hexes on one
+ * level.
+ *
+ * It is fully analogous to the
+ * TriaLevel<1>::LinesData
+ * structure inherited from
+ * Triangulation<1>.
+ */
+ struct HexesData
+ {
+ /**
+ * Same as for the @p lines array.
+ */
+ std::vector<Hexahedron> hexes;
- /**
- * Same as for the
- * TriangulationLevel<1>::LinesData@p ::chilren
- * array, but since there
- * are four children, the
- * index points to the first
- * while the other three are
- * following immediately
- * afterwards.
- */
- std::vector<int> children;
-
- /**
- * Same as for
- * TriangulationLevel<1>::LinesData@p ::used.
- */
- std::vector<bool> used;
-
- /**
- * Same as for
- * TriangulationLevel<1>::LinesData@p ::used.
- */
- std::vector<bool> user_flags;
-
- /**
- * Store boundary and
- * material data. In two
- * dimension, this field
- * stores the material id of
- * a hex, which is a number
- * between 0 and 254. In more
- * than three dimensions,
- * hexes have no material id,
- * but they may be at the
- * boundary; then, we store
- * the boundary indicator in
- * this field, which denotes
- * to which part of the
- * boundary this line belongs
- * and which boundary
- * conditions hold on this
- * part. The boundary
- * indicator also is a number
- * between zero and 254; the
- * id 255 is reserved for
- * hexes in the interior and
- * may be used to check
- * whether a hex is at the
- * boundary or not, which
- * otherwise is not possible
- * if you don't know which
- * cell it belongs to.
- */
- std::vector<unsigned char> material_id;
-
- /**
- * Pointer which is not used
- * by the library but may be
- * accessed an set by the
- * user to handle data local
- * to a line/quad/etc.
- */
- std::vector<void*> user_pointers;
+ /**
+ * Same as for the
+ * TriaLevel<1>::LinesData@p ::chilren
+ * array, but since there
+ * are four children, the
+ * index points to the first
+ * while the other three are
+ * following immediately
+ * afterwards.
+ */
+ std::vector<int> children;
+
+ /**
+ * Same as for
+ * TriaLevel<1>::LinesData@p ::used.
+ */
+ std::vector<bool> used;
+
+ /**
+ * Same as for
+ * TriaLevel<1>::LinesData@p ::used.
+ */
+ std::vector<bool> user_flags;
+
+ /**
+ * Store boundary and
+ * material data. In two
+ * dimension, this field
+ * stores the material id of
+ * a hex, which is a number
+ * between 0 and 254. In more
+ * than three dimensions,
+ * hexes have no material id,
+ * but they may be at the
+ * boundary; then, we store
+ * the boundary indicator in
+ * this field, which denotes
+ * to which part of the
+ * boundary this line belongs
+ * and which boundary
+ * conditions hold on this
+ * part. The boundary
+ * indicator also is a number
+ * between zero and 254; the
+ * id 255 is reserved for
+ * hexes in the interior and
+ * may be used to check
+ * whether a hex is at the
+ * boundary or not, which
+ * otherwise is not possible
+ * if you don't know which
+ * cell it belongs to.
+ */
+ std::vector<unsigned char> material_id;
+
+ /**
+ * Pointer which is not used
+ * by the library but may be
+ * accessed an set by the
+ * user to handle data local
+ * to a line/quad/etc.
+ */
+ std::vector<void*> user_pointers;
+
+ /**
+ * For edges, we enforce a
+ * standard convention that
+ * opposite edges should be
+ * parallel. Now, that's
+ * enforcable in most cases,
+ * and we have code that
+ * makes sure that if a mesh
+ * allows this to happen,
+ * that we have this
+ * convention. We also know
+ * that it is always possible
+ * to have opposite faces
+ * have parallel normal
+ * vectors. (For both things,
+ * see the Agelek, Anderson,
+ * Bangerth, Barth paper
+ * mentioned in the
+ * publications list.)
+ *
+ * The problem is that we
+ * originally had another
+ * condition, namely that
+ * faces 0, 2 and 6 have
+ * normals that point into
+ * the cell, while the other
+ * faces have normals that
+ * point outward. It turns
+ * out that this is not
+ * always possible. In
+ * effect, we have to store
+ * whether the normal vector
+ * of each face of each cell
+ * follows this convention or
+ * not. If this is so, then
+ * this variable stores a
+ * @p true value, otherwise
+ * a @p false value.
+ *
+ * In effect, this field has
+ * <tt>6*n_cells</tt> elements,
+ * being the number of cells
+ * times the six faces each
+ * has.
+ */
+ std::vector<bool> face_orientations;
+ };
+
+ public:
+ /**
+ * Data about the hexes.
+ */
+ HexesData hexes;
/**
- * For edges, we enforce a
- * standard convention that
- * opposite edges should be
- * parallel. Now, that's
- * enforcable in most cases,
- * and we have code that
- * makes sure that if a mesh
- * allows this to happen,
- * that we have this
- * convention. We also know
- * that it is always possible
- * to have opposite faces
- * have parallel normal
- * vectors. (For both things,
- * see the Agelek, Anderson,
- * Bangerth, Barth paper
- * mentioned in the
- * publications list.)
- *
- * The problem is that we
- * originally had another
- * condition, namely that
- * faces 0, 2 and 6 have
- * normals that point into
- * the cell, while the other
- * faces have normals that
- * point outward. It turns
- * out that this is not
- * always possible. In
- * effect, we have to store
- * whether the normal vector
- * of each face of each cell
- * follows this convention or
- * not. If this is so, then
- * this variable stores a
- * @p true value, otherwise
- * a @p false value.
- *
- * In effect, this field has
- * <tt>6*n_cells</tt> elements,
- * being the number of cells
- * times the six faces each
- * has.
+ * Assert that enough space is
+ * allocated to accomodate
+ * <tt>new_hexes</tt> new hexes.
*/
- std::vector<bool> face_orientations;
+ void reserve_space (const unsigned int new_hexes);
+
+ /**
+ * Check the memory consistency
+ * of the different
+ * containers. Should only be
+ * called with the prepro flag
+ * @p DEBUG set. The function
+ * should be called from the
+ * functions of the higher
+ * TriaLevel
+ * classes.
+ */
+ void monitor_memory (const unsigned int true_dimension) const;
+
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
};
-
- public:
- /**
- * Data about the hexes.
- */
- HexesData hexes;
-
- /**
- * Assert that enough space is
- * allocated to accomodate
- * <tt>new_hexes</tt> new hexes.
- */
- void reserve_space (const unsigned int new_hexes);
-
- /**
- * Check the memory consistency
- * of the different
- * containers. Should only be
- * called with the prepro flag
- * @p DEBUG set. The function
- * should be called from the
- * functions of the higher
- * TriangulationLevel
- * classes.
- */
- void monitor_memory (const unsigned int true_dimension) const;
-
- /**
- * Determine an estimate for the
- * memory consumption (in bytes)
- * of this object.
- */
- unsigned int memory_consumption () const;
-};
+ }
+}
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
#include <base/exceptions.h>
+namespace internal
+{
+ namespace Triangulation
+ {
+
/**
* Lines denote the boundaries of quads and the edges of hexaeders. They are
* characterized by the (global) indices of the endpoints.
* @ingroup grid
* @author Wolfgang Bangerth, 1998
*/
-class Line
-{
- public:
- /**
- * Construct a line with end point
- * indices @p i0 and @p i1. By default,
- * indices are set to -1, i.e. an
- * invalid value.
- */
- Line (const int i0 = -1,
- const int i1 = -1);
+ class Line
+ {
+ public:
+ /**
+ * Construct a line with end point
+ * indices @p i0 and @p i1. By default,
+ * indices are set to -1, i.e. an
+ * invalid value.
+ */
+ Line (const int i0 = -1,
+ const int i1 = -1);
- /**
- * Return the index of end point @p i=0
- * or 1.
- */
- int vertex (const int i) const;
+ /**
+ * Return the index of end point @p i=0
+ * or 1.
+ */
+ int vertex (const int i) const;
- /**
- * Set the index of the @p ith vertex to
- * @p index. @p i=0 or 1.
- */
- void set_vertex (const int i, const int index);
+ /**
+ * Set the index of the @p ith vertex to
+ * @p index. @p i=0 or 1.
+ */
+ void set_vertex (const int i, const int index);
- /**
- * Determine an estimate for the
- * memory consumption (in bytes)
- * of this object.
- */
- static unsigned int memory_consumption ();
-
- /**
- * Exception
- */
- DeclException1 (ExcRange,
- int,
- << "Indices for the point number must be 0 or 1, "
- << "but you gave " << arg1);
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ static unsigned int memory_consumption ();
+
+ /**
+ * Exception
+ */
+ DeclException1 (ExcRange,
+ int,
+ << "Indices for the point number must be 0 or 1, "
+ << "but you gave " << arg1);
- protected:
- /**
- * Global indices of the two end points.
- */
- int end_points[2];
-};
+ protected:
+ /**
+ * Global indices of the two end points.
+ */
+ int end_points[2];
+ };
/*----------------------------- Inline Function: Line ------------------------*/
-inline // truly in-line here!
-Line::Line (const int i0, const int i1)
-{
- end_points[0] = i0;
- end_points[1] = i1;
-}
+ inline // truly in-line here!
+ Line::Line (const int i0, const int i1)
+ {
+ end_points[0] = i0;
+ end_points[1] = i1;
+ }
-inline
-int Line::vertex (const int i) const
-{
- Assert ((i==0) || (i==1),
- ExcRange(i));
- return end_points[i];
-}
+ inline
+ int Line::vertex (const int i) const
+ {
+ Assert ((i==0) || (i==1),
+ ExcRange(i));
+ return end_points[i];
+ }
-inline
-void Line::set_vertex (const int i, const int index)
-{
- Assert ((i==0) || (i==1),
- ExcRange(i));
- end_points[i] = index;
-}
+ inline
+ void Line::set_vertex (const int i, const int index)
+ {
+ Assert ((i==0) || (i==1),
+ ExcRange(i));
+ end_points[i] = index;
+ }
-inline
-unsigned int
-Line::memory_consumption ()
-{
- return sizeof(Line);
+ inline
+ unsigned int
+ Line::memory_consumption ()
+ {
+ return sizeof(Line);
+ }
+
+ }
+
}
-
#endif
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
#include <base/exceptions.h>
+namespace internal
+{
+ namespace Triangulation
+ {
+
/**
* @p Quads denote the fundamental entities of triangulations in two dimensions
* and the boundaries of hexaeders in three dimensions. They are
* @ingroup grid
* @author Wolfgang Bangerth, 1998
*/
-class Quad
-{
- public:
-
- /**
- * Construct a Quad with line
- * indices @p i0 through @p i3. By default,
- * indices are set to -1, i.e. an
- * invalid value.
- *
- * By convention, the four lines
- * must be numbered as follows
- * .--3--.
- * | |
- * 0 1
- * | |
- * .--2--.
- */
- Quad (const int i0 = -1,
- const int i1 = -1,
- const int i2 = -1,
- const int i3 = -1);
+ class Quad
+ {
+ public:
+
+ /**
+ * Construct a Quad with line
+ * indices @p i0 through @p i3. By default,
+ * indices are set to -1, i.e. an
+ * invalid value.
+ *
+ * By convention, the four lines
+ * must be numbered as follows
+ * .--3--.
+ * | |
+ * 0 1
+ * | |
+ * .--2--.
+ */
+ Quad (const int i0 = -1,
+ const int i1 = -1,
+ const int i2 = -1,
+ const int i3 = -1);
- /**
- * Return the index of line @p i=0
- * through 3.
- */
- int line (const int i) const;
+ /**
+ * Return the index of line @p i=0
+ * through 3.
+ */
+ int line (const int i) const;
- /**
- * Set the index of the @p ith line to
- * @p index. @p i=0 through 3.
- */
- void set_line (const int i, const int index);
+ /**
+ * Set the index of the @p ith line to
+ * @p index. @p i=0 through 3.
+ */
+ void set_line (const int i, const int index);
- /**
- * Determine an estimate for the
- * memory consumption (in bytes)
- * of this object.
- */
- static unsigned int memory_consumption ();
-
- /**
- * Exception
- */
- DeclException1 (ExcRange,
- int,
- << "Indices for the line number must be 0, 1, 2 or 3, "
- << "but you gave " << arg1);
- protected:
- int lines[4];
-};
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ static unsigned int memory_consumption ();
+
+ /**
+ * Exception
+ */
+ DeclException1 (ExcRange,
+ int,
+ << "Indices for the line number must be 0, 1, 2 or 3, "
+ << "but you gave " << arg1);
+ protected:
+ int lines[4];
+ };
/*----------------------------- Inline Function: Quad ------------------------*/
-inline
-Quad::Quad (const int i0, const int i1, const int i2, const int i3)
-{
- lines[0] = i0;
- lines[1] = i1;
- lines[2] = i2;
- lines[3] = i3;
-}
+ inline
+ Quad::Quad (const int i0, const int i1, const int i2, const int i3)
+ {
+ lines[0] = i0;
+ lines[1] = i1;
+ lines[2] = i2;
+ lines[3] = i3;
+ }
-inline
-int Quad::line (const int i) const
-{
- Assert ((i>=0) && (i<4),
- ExcRange(i));
- return lines[i];
-}
+ inline
+ int Quad::line (const int i) const
+ {
+ Assert ((i>=0) && (i<4),
+ ExcRange(i));
+ return lines[i];
+ }
-inline
-void Quad::set_line (const int i, const int index)
-{
- Assert ((i>=0) && (i<4),
- ExcRange(i));
- lines[i] = index;
-}
+ inline
+ void Quad::set_line (const int i, const int index)
+ {
+ Assert ((i>=0) && (i<4),
+ ExcRange(i));
+ lines[i] = index;
+ }
-inline
-unsigned int
-Quad::memory_consumption ()
-{
- return sizeof(Quad);
+ inline
+ unsigned int
+ Quad::memory_consumption ()
+ {
+ return sizeof(Quad);
+ }
+
+ }
+
}
#endif
// $Id$
// Version: $Name$
//
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
}
-
-void
-TriangulationLevel<0>::reserve_space (const unsigned int total_cells,
- const unsigned int dimension)
+namespace internal
{
- // we need space for total_cells
- // cells. Maybe we have more already
- // with those cells which are unused,
- // so only allocate new space if needed.
- //
- // note that all arrays should have equal
- // sizes (checked by @p{monitor_memory}
- if (total_cells > refine_flags.size())
+ namespace Triangulation
+ {
+
+ void
+ TriaLevel<0>::reserve_space (const unsigned int total_cells,
+ const unsigned int dimension)
{
- refine_flags.reserve (total_cells);
- refine_flags.insert (refine_flags.end(),
- total_cells - refine_flags.size(),
- false);
+ // we need space for total_cells
+ // cells. Maybe we have more already
+ // with those cells which are unused,
+ // so only allocate new space if needed.
+ //
+ // note that all arrays should have equal
+ // sizes (checked by @p{monitor_memory}
+ if (total_cells > refine_flags.size())
+ {
+ refine_flags.reserve (total_cells);
+ refine_flags.insert (refine_flags.end(),
+ total_cells - refine_flags.size(),
+ false);
- coarsen_flags.reserve (total_cells);
- coarsen_flags.insert (coarsen_flags.end(),
- total_cells - coarsen_flags.size(),
- false);
+ coarsen_flags.reserve (total_cells);
+ coarsen_flags.insert (coarsen_flags.end(),
+ total_cells - coarsen_flags.size(),
+ false);
- subdomain_ids.reserve (total_cells);
- subdomain_ids.insert (subdomain_ids.end(),
- total_cells - subdomain_ids.size(),
- 0);
+ subdomain_ids.reserve (total_cells);
+ subdomain_ids.insert (subdomain_ids.end(),
+ total_cells - subdomain_ids.size(),
+ 0);
- neighbors.reserve (total_cells*(2*dimension));
- neighbors.insert (neighbors.end(),
- total_cells*(2*dimension) - neighbors.size(),
- std::make_pair(-1,-1));
- };
-}
-
+ neighbors.reserve (total_cells*(2*dimension));
+ neighbors.insert (neighbors.end(),
+ total_cells*(2*dimension) - neighbors.size(),
+ std::make_pair(-1,-1));
+ };
+ }
-void
-TriangulationLevel<0>::monitor_memory (const unsigned int true_dimension) const
-{
- // check that we have not allocated
- // too much memory. note that bool
- // vectors allocate their memory in
- // chunks of whole integers, so
- // they may over-allocate by up to
- // as many elements as an integer
- // has bits
- Assert (refine_flags.size() <= refine_flags.capacity() + sizeof(int)*8 ||
- refine_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
- ExcMemoryWasted ("refine_flags",
- refine_flags.size(), refine_flags.capacity()));
- Assert (coarsen_flags.size() <= coarsen_flags.capacity() + sizeof(int)*8 ||
- coarsen_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
- ExcMemoryWasted ("coarsen_flags",
- coarsen_flags.size(), coarsen_flags.capacity()));
- Assert (neighbors.size() == neighbors.capacity() ||
- neighbors.size()<DEAL_II_MIN_VECTOR_CAPACITY,
- ExcMemoryWasted ("neighbors",
- neighbors.size(), neighbors.capacity()));
- Assert (subdomain_ids.size() == subdomain_ids.capacity() ||
- subdomain_ids.size()<DEAL_II_MIN_VECTOR_CAPACITY,
- ExcMemoryWasted ("subdomain_ids",
- subdomain_ids.size(), subdomain_ids.capacity()));
- Assert (2*true_dimension*refine_flags.size() == neighbors.size(),
- ExcMemoryInexact (refine_flags.size(), neighbors.size()));
- Assert (2*true_dimension*coarsen_flags.size() == neighbors.size(),
- ExcMemoryInexact (coarsen_flags.size(), neighbors.size()));
-}
-
-
-unsigned int
-TriangulationLevel<0>::memory_consumption () const
-{
- return (MemoryConsumption::memory_consumption (refine_flags) +
- MemoryConsumption::memory_consumption (coarsen_flags) +
- MemoryConsumption::memory_consumption (neighbors));
-}
+ void
+ TriaLevel<0>::monitor_memory (const unsigned int true_dimension) const
+ {
+ // check that we have not allocated
+ // too much memory. note that bool
+ // vectors allocate their memory in
+ // chunks of whole integers, so
+ // they may over-allocate by up to
+ // as many elements as an integer
+ // has bits
+ Assert (refine_flags.size() <= refine_flags.capacity() + sizeof(int)*8 ||
+ refine_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
+ ExcMemoryWasted ("refine_flags",
+ refine_flags.size(), refine_flags.capacity()));
+ Assert (coarsen_flags.size() <= coarsen_flags.capacity() + sizeof(int)*8 ||
+ coarsen_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
+ ExcMemoryWasted ("coarsen_flags",
+ coarsen_flags.size(), coarsen_flags.capacity()));
+ Assert (neighbors.size() == neighbors.capacity() ||
+ neighbors.size()<DEAL_II_MIN_VECTOR_CAPACITY,
+ ExcMemoryWasted ("neighbors",
+ neighbors.size(), neighbors.capacity()));
+ Assert (subdomain_ids.size() == subdomain_ids.capacity() ||
+ subdomain_ids.size()<DEAL_II_MIN_VECTOR_CAPACITY,
+ ExcMemoryWasted ("subdomain_ids",
+ subdomain_ids.size(), subdomain_ids.capacity()));
+ Assert (2*true_dimension*refine_flags.size() == neighbors.size(),
+ ExcMemoryInexact (refine_flags.size(), neighbors.size()));
+ Assert (2*true_dimension*coarsen_flags.size() == neighbors.size(),
+ ExcMemoryInexact (coarsen_flags.size(), neighbors.size()));
+ }
+
+
+
+ unsigned int
+ TriaLevel<0>::memory_consumption () const
+ {
+ return (MemoryConsumption::memory_consumption (refine_flags) +
+ MemoryConsumption::memory_consumption (coarsen_flags) +
+ MemoryConsumption::memory_consumption (neighbors));
+ }
-void
-TriangulationLevel<1>::reserve_space (const unsigned int new_lines)
-{
- const unsigned int new_size = new_lines +
- std::count_if (lines.used.begin(),
- lines.used.end(),
- std::bind2nd (std::equal_to<bool>(), true));
-
- // same as in @p{reserve_space<0>}: only
- // allocate space if necessary
- if (new_size>lines.lines.size())
+ void
+ TriaLevel<1>::reserve_space (const unsigned int new_lines)
{
- lines.lines.reserve (new_size);
- lines.lines.insert (lines.lines.end(), new_size-lines.lines.size(), Line());
+ const unsigned int new_size = new_lines +
+ std::count_if (lines.used.begin(),
+ lines.used.end(),
+ std::bind2nd (std::equal_to<bool>(), true));
+
+ // same as in @p{reserve_space<0>}: only
+ // allocate space if necessary
+ if (new_size>lines.lines.size())
+ {
+ lines.lines.reserve (new_size);
+ lines.lines.insert (lines.lines.end(), new_size-lines.lines.size(), Line());
- lines.used.reserve (new_size);
- lines.used.insert (lines.used.end(), new_size-lines.used.size(), false);
+ lines.used.reserve (new_size);
+ lines.used.insert (lines.used.end(), new_size-lines.used.size(), false);
- lines.user_flags.reserve (new_size);
- lines.user_flags.insert (lines.user_flags.end(),
- new_size-lines.user_flags.size(), false);
+ lines.user_flags.reserve (new_size);
+ lines.user_flags.insert (lines.user_flags.end(),
+ new_size-lines.user_flags.size(), false);
- lines.children.reserve (new_size);
- lines.children.insert (lines.children.end(), new_size-lines.children.size(),
- -1);
-
- lines.material_id.reserve (new_size);
- lines.material_id.insert (lines.material_id.end(),
- new_size-lines.material_id.size(),
- 255);
-
- lines.user_pointers.reserve (new_size);
- lines.user_pointers.insert (lines.user_pointers.end(),
- new_size-lines.user_pointers.size(), 0);
- };
-}
+ lines.children.reserve (new_size);
+ lines.children.insert (lines.children.end(), new_size-lines.children.size(),
+ -1);
+ lines.material_id.reserve (new_size);
+ lines.material_id.insert (lines.material_id.end(),
+ new_size-lines.material_id.size(),
+ 255);
+ lines.user_pointers.reserve (new_size);
+ lines.user_pointers.insert (lines.user_pointers.end(),
+ new_size-lines.user_pointers.size(), 0);
+ };
+ }
-void
-TriangulationLevel<1>::monitor_memory (const unsigned int true_dimension) const
-{
- // check that we have not allocated
- // too much memory. note that bool
- // vectors allocate their memory in
- // chunks of whole integers, so
- // they may over-allocate by up to
- // as many elements as an integer
- // has bits
- Assert (lines.lines.size() == lines.lines.capacity() ||
- lines.lines.size()<DEAL_II_MIN_VECTOR_CAPACITY,
- ExcMemoryWasted ("lines",
- lines.lines.size(), lines.lines.capacity()));
- Assert (lines.children.size() == lines.children.capacity() ||
- lines.children.size()<DEAL_II_MIN_VECTOR_CAPACITY,
- ExcMemoryWasted ("children",
- lines.children.size(), lines.children.capacity()));
- Assert (lines.used.size() <= lines.used.capacity() + sizeof(int)*8 ||
- lines.used.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
- ExcMemoryWasted ("used",
- lines.used.size(), lines.used.capacity()));
- Assert (lines.user_flags.size() <= lines.user_flags.capacity() + sizeof(int)*8 ||
- lines.user_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
- ExcMemoryWasted ("user_flags",
- lines.user_flags.size(), lines.user_flags.capacity()));
- Assert (lines.lines.size() == lines.used.size(),
- ExcMemoryInexact (lines.lines.size(), lines.used.size()));
- Assert (lines.lines.size() == lines.user_flags.size(),
- ExcMemoryInexact (lines.lines.size(), lines.user_flags.size()));
- Assert (lines.lines.size() == lines.children.size(),
- ExcMemoryInexact (lines.lines.size(), lines.children.size()));
- Assert (lines.lines.size() == lines.material_id.size(),
- ExcMemoryInexact (lines.lines.size(), lines.material_id.size()));
- Assert (lines.lines.size() == lines.user_pointers.size(),
- ExcMemoryInexact (lines.lines.size(), lines.user_pointers.size()));
-
- TriangulationLevel<0>::monitor_memory (true_dimension);
-}
-
-unsigned int
-TriangulationLevel<1>::memory_consumption () const
-{
- return (TriangulationLevel<0>::memory_consumption() +
- MemoryConsumption::memory_consumption (lines.lines) +
- MemoryConsumption::memory_consumption (lines.children) +
- MemoryConsumption::memory_consumption (lines.used) +
- MemoryConsumption::memory_consumption (lines.user_flags) +
- MemoryConsumption::memory_consumption (lines.material_id) +
- MemoryConsumption::memory_consumption (lines.user_pointers));
-}
+ void
+ TriaLevel<1>::monitor_memory (const unsigned int true_dimension) const
+ {
+ // check that we have not allocated
+ // too much memory. note that bool
+ // vectors allocate their memory in
+ // chunks of whole integers, so
+ // they may over-allocate by up to
+ // as many elements as an integer
+ // has bits
+ Assert (lines.lines.size() == lines.lines.capacity() ||
+ lines.lines.size()<DEAL_II_MIN_VECTOR_CAPACITY,
+ ExcMemoryWasted ("lines",
+ lines.lines.size(), lines.lines.capacity()));
+ Assert (lines.children.size() == lines.children.capacity() ||
+ lines.children.size()<DEAL_II_MIN_VECTOR_CAPACITY,
+ ExcMemoryWasted ("children",
+ lines.children.size(), lines.children.capacity()));
+ Assert (lines.used.size() <= lines.used.capacity() + sizeof(int)*8 ||
+ lines.used.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
+ ExcMemoryWasted ("used",
+ lines.used.size(), lines.used.capacity()));
+ Assert (lines.user_flags.size() <= lines.user_flags.capacity() + sizeof(int)*8 ||
+ lines.user_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
+ ExcMemoryWasted ("user_flags",
+ lines.user_flags.size(), lines.user_flags.capacity()));
+ Assert (lines.lines.size() == lines.used.size(),
+ ExcMemoryInexact (lines.lines.size(), lines.used.size()));
+ Assert (lines.lines.size() == lines.user_flags.size(),
+ ExcMemoryInexact (lines.lines.size(), lines.user_flags.size()));
+ Assert (lines.lines.size() == lines.children.size(),
+ ExcMemoryInexact (lines.lines.size(), lines.children.size()));
+ Assert (lines.lines.size() == lines.material_id.size(),
+ ExcMemoryInexact (lines.lines.size(), lines.material_id.size()));
+ Assert (lines.lines.size() == lines.user_pointers.size(),
+ ExcMemoryInexact (lines.lines.size(), lines.user_pointers.size()));
+
+ TriaLevel<0>::monitor_memory (true_dimension);
+ }
+
+
+
+ unsigned int
+ TriaLevel<1>::memory_consumption () const
+ {
+ return (TriaLevel<0>::memory_consumption() +
+ MemoryConsumption::memory_consumption (lines.lines) +
+ MemoryConsumption::memory_consumption (lines.children) +
+ MemoryConsumption::memory_consumption (lines.used) +
+ MemoryConsumption::memory_consumption (lines.user_flags) +
+ MemoryConsumption::memory_consumption (lines.material_id) +
+ MemoryConsumption::memory_consumption (lines.user_pointers));
+ }
-void
-TriangulationLevel<2>::reserve_space (const unsigned int new_quads)
-{
- const unsigned int new_size = new_quads +
- std::count_if (quads.used.begin(),
- quads.used.end(),
- std::bind2nd (std::equal_to<bool>(), true));
-
- // see above...
- if (new_size>quads.quads.size())
+ void
+ TriaLevel<2>::reserve_space (const unsigned int new_quads)
{
- quads.quads.reserve (new_size);
- quads.quads.insert (quads.quads.end(), new_size-quads.quads.size(), Quad());
+ const unsigned int new_size = new_quads +
+ std::count_if (quads.used.begin(),
+ quads.used.end(),
+ std::bind2nd (std::equal_to<bool>(), true));
+
+ // see above...
+ if (new_size>quads.quads.size())
+ {
+ quads.quads.reserve (new_size);
+ quads.quads.insert (quads.quads.end(), new_size-quads.quads.size(), Quad());
- quads.used.reserve (new_size);
- quads.used.insert (quads.used.end(), new_size-quads.used.size(), false);
+ quads.used.reserve (new_size);
+ quads.used.insert (quads.used.end(), new_size-quads.used.size(), false);
- quads.user_flags.reserve (new_size);
- quads.user_flags.insert (quads.user_flags.end(),
- new_size-quads.user_flags.size(), false);
+ quads.user_flags.reserve (new_size);
+ quads.user_flags.insert (quads.user_flags.end(),
+ new_size-quads.user_flags.size(), false);
- quads.children.reserve (new_size);
- quads.children.insert (quads.children.end(), new_size-quads.children.size(),
- -1);
-
- quads.material_id.reserve (new_size);
- quads.material_id.insert (quads.material_id.end(),
- new_size-quads.material_id.size(),
- 255);
-
- quads.user_pointers.reserve (new_size);
- quads.user_pointers.insert (quads.user_pointers.end(),
- new_size-quads.user_pointers.size(), 0);
- };
-}
+ quads.children.reserve (new_size);
+ quads.children.insert (quads.children.end(), new_size-quads.children.size(),
+ -1);
+ quads.material_id.reserve (new_size);
+ quads.material_id.insert (quads.material_id.end(),
+ new_size-quads.material_id.size(),
+ 255);
+ quads.user_pointers.reserve (new_size);
+ quads.user_pointers.insert (quads.user_pointers.end(),
+ new_size-quads.user_pointers.size(), 0);
+ };
+ }
-void
-TriangulationLevel<2>::monitor_memory (const unsigned int true_dimension) const
-{
- // check that we have not allocated
- // too much memory. note that bool
- // vectors allocate their memory in
- // chunks of whole integers, so
- // they may over-allocate by up to
- // as many elements as an integer
- // has bits
- Assert (quads.quads.size() == quads.quads.capacity() ||
- quads.quads.size()<DEAL_II_MIN_VECTOR_CAPACITY,
- ExcMemoryWasted ("quads",
- quads.quads.size(), quads.quads.capacity()));
- Assert (quads.children.size() == quads.children.capacity() ||
- quads.children.size()<DEAL_II_MIN_VECTOR_CAPACITY,
- ExcMemoryWasted ("children",
- quads.children.size(), quads.children.capacity()));
- Assert (quads.used.size() <= quads.used.capacity() + sizeof(int)*8 ||
- quads.used.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
- ExcMemoryWasted ("used",
- quads.used.size(), quads.used.capacity()));
- Assert (quads.user_flags.size() <= quads.user_flags.capacity() + sizeof(int)*8 ||
- quads.user_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
- ExcMemoryWasted ("user_flags",
- quads.user_flags.size(), quads.user_flags.capacity()));
- Assert (quads.quads.size() == quads.used.size(),
- ExcMemoryInexact (quads.quads.size(), quads.used.size()));
- Assert (quads.quads.size() == quads.user_flags.size(),
- ExcMemoryInexact (quads.quads.size(), quads.user_flags.size()));
- Assert (quads.quads.size() == quads.children.size(),
- ExcMemoryInexact (quads.quads.size(), quads.children.size()));
- Assert (quads.quads.size() == quads.material_id.size(),
- ExcMemoryInexact (quads.quads.size(), quads.material_id.size()));
- Assert (quads.quads.size() == quads.user_pointers.size(),
- ExcMemoryInexact (quads.quads.size(), quads.user_pointers.size()));
-
- TriangulationLevel<1>::monitor_memory (true_dimension);
-}
-
-unsigned int
-TriangulationLevel<2>::memory_consumption () const
-{
- return (TriangulationLevel<1>::memory_consumption() +
- MemoryConsumption::memory_consumption (quads.quads) +
- MemoryConsumption::memory_consumption (quads.children) +
- MemoryConsumption::memory_consumption (quads.used) +
- MemoryConsumption::memory_consumption (quads.user_flags) +
- MemoryConsumption::memory_consumption (quads.material_id) +
- MemoryConsumption::memory_consumption (quads.user_pointers));
-}
-
+ void
+ TriaLevel<2>::monitor_memory (const unsigned int true_dimension) const
+ {
+ // check that we have not allocated
+ // too much memory. note that bool
+ // vectors allocate their memory in
+ // chunks of whole integers, so
+ // they may over-allocate by up to
+ // as many elements as an integer
+ // has bits
+ Assert (quads.quads.size() == quads.quads.capacity() ||
+ quads.quads.size()<DEAL_II_MIN_VECTOR_CAPACITY,
+ ExcMemoryWasted ("quads",
+ quads.quads.size(), quads.quads.capacity()));
+ Assert (quads.children.size() == quads.children.capacity() ||
+ quads.children.size()<DEAL_II_MIN_VECTOR_CAPACITY,
+ ExcMemoryWasted ("children",
+ quads.children.size(), quads.children.capacity()));
+ Assert (quads.used.size() <= quads.used.capacity() + sizeof(int)*8 ||
+ quads.used.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
+ ExcMemoryWasted ("used",
+ quads.used.size(), quads.used.capacity()));
+ Assert (quads.user_flags.size() <= quads.user_flags.capacity() + sizeof(int)*8 ||
+ quads.user_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
+ ExcMemoryWasted ("user_flags",
+ quads.user_flags.size(), quads.user_flags.capacity()));
+ Assert (quads.quads.size() == quads.used.size(),
+ ExcMemoryInexact (quads.quads.size(), quads.used.size()));
+ Assert (quads.quads.size() == quads.user_flags.size(),
+ ExcMemoryInexact (quads.quads.size(), quads.user_flags.size()));
+ Assert (quads.quads.size() == quads.children.size(),
+ ExcMemoryInexact (quads.quads.size(), quads.children.size()));
+ Assert (quads.quads.size() == quads.material_id.size(),
+ ExcMemoryInexact (quads.quads.size(), quads.material_id.size()));
+ Assert (quads.quads.size() == quads.user_pointers.size(),
+ ExcMemoryInexact (quads.quads.size(), quads.user_pointers.size()));
+
+ TriaLevel<1>::monitor_memory (true_dimension);
+ }
+
+
+
+ unsigned int
+ TriaLevel<2>::memory_consumption () const
+ {
+ return (TriaLevel<1>::memory_consumption() +
+ MemoryConsumption::memory_consumption (quads.quads) +
+ MemoryConsumption::memory_consumption (quads.children) +
+ MemoryConsumption::memory_consumption (quads.used) +
+ MemoryConsumption::memory_consumption (quads.user_flags) +
+ MemoryConsumption::memory_consumption (quads.material_id) +
+ MemoryConsumption::memory_consumption (quads.user_pointers));
+ }
-void
-TriangulationLevel<3>::reserve_space (const unsigned int new_hexes)
-{
- const unsigned int new_size = new_hexes +
- std::count_if (hexes.used.begin(),
- hexes.used.end(),
- std::bind2nd (std::equal_to<bool>(), true));
- // see above...
- if (new_size>hexes.hexes.size())
+ void
+ TriaLevel<3>::reserve_space (const unsigned int new_hexes)
{
- hexes.hexes.reserve (new_size);
- hexes.hexes.insert (hexes.hexes.end(), new_size-hexes.hexes.size(), Hexahedron());
+ const unsigned int new_size = new_hexes +
+ std::count_if (hexes.used.begin(),
+ hexes.used.end(),
+ std::bind2nd (std::equal_to<bool>(), true));
+
+ // see above...
+ if (new_size>hexes.hexes.size())
+ {
+ hexes.hexes.reserve (new_size);
+ hexes.hexes.insert (hexes.hexes.end(), new_size-hexes.hexes.size(), Hexahedron());
- hexes.used.reserve (new_size);
- hexes.used.insert (hexes.used.end(), new_size-hexes.used.size(), false);
+ hexes.used.reserve (new_size);
+ hexes.used.insert (hexes.used.end(), new_size-hexes.used.size(), false);
- hexes.user_flags.reserve (new_size);
- hexes.user_flags.insert (hexes.user_flags.end(),
- new_size-hexes.user_flags.size(), false);
+ hexes.user_flags.reserve (new_size);
+ hexes.user_flags.insert (hexes.user_flags.end(),
+ new_size-hexes.user_flags.size(), false);
- hexes.children.reserve (new_size);
- hexes.children.insert (hexes.children.end(), new_size-hexes.children.size(),
- -1);
-
- hexes.material_id.reserve (new_size);
- hexes.material_id.insert (hexes.material_id.end(),
- new_size-hexes.material_id.size(),
- 255);
-
- hexes.user_pointers.reserve (new_size);
- hexes.user_pointers.insert (hexes.user_pointers.end(),
- new_size-hexes.user_pointers.size(), 0);
-
- hexes.face_orientations.reserve (new_size * GeometryInfo<3>::faces_per_cell);
- hexes.face_orientations.insert (hexes.face_orientations.end(),
- new_size * GeometryInfo<3>::faces_per_cell
- - hexes.face_orientations.size(),
- true);
- };
-}
+ hexes.children.reserve (new_size);
+ hexes.children.insert (hexes.children.end(), new_size-hexes.children.size(),
+ -1);
+ hexes.material_id.reserve (new_size);
+ hexes.material_id.insert (hexes.material_id.end(),
+ new_size-hexes.material_id.size(),
+ 255);
+ hexes.user_pointers.reserve (new_size);
+ hexes.user_pointers.insert (hexes.user_pointers.end(),
+ new_size-hexes.user_pointers.size(), 0);
-void
-TriangulationLevel<3>::monitor_memory (const unsigned int true_dimension) const
-{
- // check that we have not allocated
- // too much memory. note that bool
- // vectors allocate their memory in
- // chunks of whole integers, so
- // they may over-allocate by up to
- // as many elements as an integer
- // has bits
- Assert (hexes.hexes.size() == hexes.hexes.capacity() ||
- hexes.hexes.size()<DEAL_II_MIN_VECTOR_CAPACITY,
- ExcMemoryWasted ("hexes",
- hexes.hexes.size(), hexes.hexes.capacity()));
- Assert (hexes.children.size() == hexes.children.capacity() ||
- hexes.children.size()<DEAL_II_MIN_VECTOR_CAPACITY,
- ExcMemoryWasted ("children",
- hexes.children.size(), hexes.children.capacity()));
- Assert (hexes.used.size() <= hexes.used.capacity() + sizeof(int)*8 ||
- hexes.used.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
- ExcMemoryWasted ("used",
- hexes.used.size(), hexes.used.capacity()));
- Assert (hexes.user_flags.size() <= hexes.user_flags.capacity() + sizeof(int)*8 ||
- hexes.user_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
- ExcMemoryWasted ("user_flags",
- hexes.user_flags.size(), hexes.user_flags.capacity()));
- Assert (hexes.hexes.size() == hexes.used.size(),
- ExcMemoryInexact (hexes.hexes.size(), hexes.used.size()));
- Assert (hexes.hexes.size() == hexes.user_flags.size(),
- ExcMemoryInexact (hexes.hexes.size(), hexes.user_flags.size()));
- Assert (hexes.hexes.size() == hexes.children.size(),
- ExcMemoryInexact (hexes.hexes.size(), hexes.children.size()));
- Assert (hexes.hexes.size() == hexes.material_id.size(),
- ExcMemoryInexact (hexes.hexes.size(), hexes.material_id.size()));
- Assert (hexes.hexes.size() == hexes.user_pointers.size(),
- ExcMemoryInexact (hexes.hexes.size(), hexes.user_pointers.size()));
- Assert (hexes.hexes.size() * GeometryInfo<3>::faces_per_cell
- == hexes.face_orientations.size(),
- ExcMemoryInexact (hexes.hexes.size() * GeometryInfo<3>::faces_per_cell,
- hexes.face_orientations.size()));
-
- TriangulationLevel<2>::monitor_memory (true_dimension);
-}
+ hexes.face_orientations.reserve (new_size * GeometryInfo<3>::faces_per_cell);
+ hexes.face_orientations.insert (hexes.face_orientations.end(),
+ new_size * GeometryInfo<3>::faces_per_cell
+ - hexes.face_orientations.size(),
+ true);
+ };
+ }
-unsigned int
-TriangulationLevel<3>::memory_consumption () const
-{
- return (TriangulationLevel<2>::memory_consumption() +
- MemoryConsumption::memory_consumption (hexes.hexes) +
- MemoryConsumption::memory_consumption (hexes.children) +
- MemoryConsumption::memory_consumption (hexes.used) +
- MemoryConsumption::memory_consumption (hexes.user_flags) +
- MemoryConsumption::memory_consumption (hexes.material_id) +
- MemoryConsumption::memory_consumption (hexes.user_pointers) +
- MemoryConsumption::memory_consumption (hexes.face_orientations));
-}
+ void
+ TriaLevel<3>::monitor_memory (const unsigned int true_dimension) const
+ {
+ // check that we have not allocated
+ // too much memory. note that bool
+ // vectors allocate their memory in
+ // chunks of whole integers, so
+ // they may over-allocate by up to
+ // as many elements as an integer
+ // has bits
+ Assert (hexes.hexes.size() == hexes.hexes.capacity() ||
+ hexes.hexes.size()<DEAL_II_MIN_VECTOR_CAPACITY,
+ ExcMemoryWasted ("hexes",
+ hexes.hexes.size(), hexes.hexes.capacity()));
+ Assert (hexes.children.size() == hexes.children.capacity() ||
+ hexes.children.size()<DEAL_II_MIN_VECTOR_CAPACITY,
+ ExcMemoryWasted ("children",
+ hexes.children.size(), hexes.children.capacity()));
+ Assert (hexes.used.size() <= hexes.used.capacity() + sizeof(int)*8 ||
+ hexes.used.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
+ ExcMemoryWasted ("used",
+ hexes.used.size(), hexes.used.capacity()));
+ Assert (hexes.user_flags.size() <= hexes.user_flags.capacity() + sizeof(int)*8 ||
+ hexes.user_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
+ ExcMemoryWasted ("user_flags",
+ hexes.user_flags.size(), hexes.user_flags.capacity()));
+ Assert (hexes.hexes.size() == hexes.used.size(),
+ ExcMemoryInexact (hexes.hexes.size(), hexes.used.size()));
+ Assert (hexes.hexes.size() == hexes.user_flags.size(),
+ ExcMemoryInexact (hexes.hexes.size(), hexes.user_flags.size()));
+ Assert (hexes.hexes.size() == hexes.children.size(),
+ ExcMemoryInexact (hexes.hexes.size(), hexes.children.size()));
+ Assert (hexes.hexes.size() == hexes.material_id.size(),
+ ExcMemoryInexact (hexes.hexes.size(), hexes.material_id.size()));
+ Assert (hexes.hexes.size() == hexes.user_pointers.size(),
+ ExcMemoryInexact (hexes.hexes.size(), hexes.user_pointers.size()));
+ Assert (hexes.hexes.size() * GeometryInfo<3>::faces_per_cell
+ == hexes.face_orientations.size(),
+ ExcMemoryInexact (hexes.hexes.size() * GeometryInfo<3>::faces_per_cell,
+ hexes.face_orientations.size()));
+
+ TriaLevel<2>::monitor_memory (true_dimension);
+ }
+
+
+
+ unsigned int
+ TriaLevel<3>::memory_consumption () const
+ {
+ return (TriaLevel<2>::memory_consumption() +
+ MemoryConsumption::memory_consumption (hexes.hexes) +
+ MemoryConsumption::memory_consumption (hexes.children) +
+ MemoryConsumption::memory_consumption (hexes.used) +
+ MemoryConsumption::memory_consumption (hexes.user_flags) +
+ MemoryConsumption::memory_consumption (hexes.material_id) +
+ MemoryConsumption::memory_consumption (hexes.user_pointers) +
+ MemoryConsumption::memory_consumption (hexes.face_orientations));
+ }
-TriaNumberCache<1>::TriaNumberCache () :
- n_lines (0),
- n_active_lines (0)
- // all other fields are
- // default constructed
-{}
+ NumberCache<1>::NumberCache () :
+ n_lines (0),
+ n_active_lines (0)
+ // all other fields are
+ // default constructed
+ {}
-unsigned int
-TriaNumberCache<1>::memory_consumption () const
-{
- return (MemoryConsumption::memory_consumption (n_lines) +
- MemoryConsumption::memory_consumption (n_lines_level) +
- MemoryConsumption::memory_consumption (n_active_lines) +
- MemoryConsumption::memory_consumption (n_active_lines_level));
-}
+ unsigned int
+ NumberCache<1>::memory_consumption () const
+ {
+ return (MemoryConsumption::memory_consumption (n_lines) +
+ MemoryConsumption::memory_consumption (n_lines_level) +
+ MemoryConsumption::memory_consumption (n_active_lines) +
+ MemoryConsumption::memory_consumption (n_active_lines_level));
+ }
-TriaNumberCache<2>::TriaNumberCache () :
- n_quads (0),
- n_active_quads (0)
- // all other fields are
- // default constructed
-{}
+ NumberCache<2>::NumberCache () :
+ n_quads (0),
+ n_active_quads (0)
+ // all other fields are
+ // default constructed
+ {}
-unsigned int
-TriaNumberCache<2>::memory_consumption () const
-{
- return (TriaNumberCache<1>::memory_consumption () +
- MemoryConsumption::memory_consumption (n_quads) +
- MemoryConsumption::memory_consumption (n_quads_level) +
- MemoryConsumption::memory_consumption (n_active_quads) +
- MemoryConsumption::memory_consumption (n_active_quads_level));
-}
+ unsigned int
+ NumberCache<2>::memory_consumption () const
+ {
+ return (NumberCache<1>::memory_consumption () +
+ MemoryConsumption::memory_consumption (n_quads) +
+ MemoryConsumption::memory_consumption (n_quads_level) +
+ MemoryConsumption::memory_consumption (n_active_quads) +
+ MemoryConsumption::memory_consumption (n_active_quads_level));
+ }
-TriaNumberCache<3>::TriaNumberCache () :
- n_hexes (0),
- n_active_hexes (0)
- // all other fields are
- // default constructed
-{}
+ NumberCache<3>::NumberCache () :
+ n_hexes (0),
+ n_active_hexes (0)
+ // all other fields are
+ // default constructed
+ {}
-unsigned int
-TriaNumberCache<3>::memory_consumption () const
-{
- return (TriaNumberCache<2>::memory_consumption () +
- MemoryConsumption::memory_consumption (n_hexes) +
- MemoryConsumption::memory_consumption (n_hexes_level) +
- MemoryConsumption::memory_consumption (n_active_hexes) +
- MemoryConsumption::memory_consumption (n_active_hexes_level));
+ unsigned int
+ NumberCache<3>::memory_consumption () const
+ {
+ return (NumberCache<2>::memory_consumption () +
+ MemoryConsumption::memory_consumption (n_hexes) +
+ MemoryConsumption::memory_consumption (n_hexes_level) +
+ MemoryConsumption::memory_consumption (n_active_hexes) +
+ MemoryConsumption::memory_consumption (n_active_hexes_level));
+ }
+ }
}
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
levels.reserve (old_tria.levels.size());
for (unsigned int level=0; level<old_tria.levels.size(); ++level)
- levels.push_back (new TriangulationLevel<dim>(*old_tria.levels[level]));
+ levels.push_back (new internal::Triangulation::TriaLevel<dim>(*old_tria.levels[level]));
number_cache = old_tria.number_cache;
std::vector<std::vector<int> > lines_at_vertex (v.size());
// reserve enough space
- levels.push_back (new TriangulationLevel<dim>);
- levels[0]->TriangulationLevel<0>::reserve_space (cells.size(), dim);
- levels[0]->TriangulationLevel<1>::reserve_space (cells.size());
+ levels.push_back (new internal::Triangulation::TriaLevel<dim>);
+ levels[0]->internal::Triangulation::TriaLevel<0>
+ ::reserve_space (cells.size(), dim);
+ levels[0]->internal::Triangulation::TriaLevel<1>
+ ::reserve_space (cells.size());
// make up cells
raw_line_iterator next_free_line = begin_raw_line ();
while (next_free_line->used())
++next_free_line;
- next_free_line->set (Line (cells[cell].vertices[0], cells[cell].vertices[1]));
+ next_free_line->set (internal::Triangulation
+ ::Line (cells[cell].vertices[0],
+ cells[cell].vertices[1]));
next_free_line->set_used_flag ();
next_free_line->set_material_id (cells[cell].material_id);
next_free_line->clear_user_pointer ();
}
// reserve enough space
- levels.push_back (new TriangulationLevel<dim>);
- levels[0]->TriangulationLevel<0>::reserve_space (cells.size(), dim);
- levels[0]->TriangulationLevel<1>::reserve_space (needed_lines.size());
- levels[0]->TriangulationLevel<2>::reserve_space (cells.size());
+ levels.push_back (new internal::Triangulation::TriaLevel<dim>);
+ levels[0]->internal::Triangulation::TriaLevel<0>
+ ::reserve_space (cells.size(), dim);
+ levels[0]->internal::Triangulation::TriaLevel<1>
+ ::reserve_space (needed_lines.size());
+ levels[0]->internal::Triangulation::TriaLevel<2>
+ ::reserve_space (cells.size());
// make up lines
if (true)
std::map<std::pair<int,int>,line_iterator>::iterator i;
for (i = needed_lines.begin(); line!=end_line(); ++line, ++i)
{
- line->set (Line(i->first.first, i->first.second));
+ line->set (internal::Triangulation::Line(i->first.first,
+ i->first.second));
line->set_used_flag ();
line->clear_user_flag ();
line->clear_user_pointer ();
cells[c].vertices[GeometryInfo<dim>::line_to_cell_vertices(line, 0)],
cells[c].vertices[GeometryInfo<dim>::line_to_cell_vertices(line, 1)])];
- cell->set (Quad(lines[0]->index(),
- lines[1]->index(),
- lines[2]->index(),
- lines[3]->index()));
+ cell->set (internal::Triangulation::Quad(lines[0]->index(),
+ lines[1]->index(),
+ lines[2]->index(),
+ lines[3]->index()));
cell->set_used_flag ();
cell->set_material_id (cells[c].material_id);
#if deal_II_dimension == 3
/**
- * Invent an object which compares two Quads against each other. This
- * comparison is needed in order to establish a map of Quads to
- * iterators in the Triangulation<3>::create_triangulation function.
+ * Invent an object which compares two internal::Triangulation::Quad against
+ * each other. This comparison is needed in order to establish a map of Quads
+ * to iterators in the Triangulation<3>::create_triangulation function.
*
* Since this comparison is not canonical, we do not include it into
- * the general Quad class.
+ * the general internal::Triangulation::Quad class.
*/
struct QuadComparator
{
- inline bool operator () (const Quad &q1, const Quad &q2) const
+ inline bool operator () (const internal::Triangulation::Quad &q1,
+ const internal::Triangulation::Quad &q2) const
{
// here is room to optimize
// the repeated equality test
// actually set up data structures
// for the lines
// reserve enough space
- levels.push_back (new TriangulationLevel<dim>);
- levels[0]->TriangulationLevel<0>::reserve_space (cells.size(), dim);
- levels[0]->TriangulationLevel<1>::reserve_space (needed_lines.size());
+ levels.push_back (new internal::Triangulation::TriaLevel<dim>);
+ levels[0]->internal::Triangulation::TriaLevel<0>
+ ::reserve_space (cells.size(), dim);
+ levels[0]->internal::Triangulation::TriaLevel<1>
+ ::reserve_space (needed_lines.size());
// make up lines
if (true)
std::map<std::pair<int,int>,line_iterator>::iterator i;
for (i = needed_lines.begin(); line!=end_line(); ++line, ++i)
{
- line->set (Line(i->first.first, i->first.second));
+ line->set (internal::Triangulation::Line(i->first.first,
+ i->first.second));
line->set_used_flag ();
line->clear_user_flag ();
line->clear_user_pointer ();
// note that QuadComparator is a
// class declared and defined in
// this file
- std::map<Quad,quad_iterator,QuadComparator> needed_quads;
+ std::map<internal::Triangulation::Quad,quad_iterator,QuadComparator>
+ needed_quads;
for (unsigned int cell=0; cell<cells.size(); ++cell)
{
// the faces are quads which
// get the cell line number
// (0-11) through the
// face_to_cell_lines function
- Quad quad(needed_lines[line_list[GeometryInfo<dim>::
- face_to_cell_lines(face,0)]]->index(),
- needed_lines[line_list[GeometryInfo<dim>::
- face_to_cell_lines(face,1)]]->index(),
- needed_lines[line_list[GeometryInfo<dim>::
- face_to_cell_lines(face,2)]]->index(),
- needed_lines[line_list[GeometryInfo<dim>::
- face_to_cell_lines(face,3)]]->index());
+ internal::Triangulation::Quad
+ quad(needed_lines[line_list[GeometryInfo<dim>::
+ face_to_cell_lines(face,0)]]->index(),
+ needed_lines[line_list[GeometryInfo<dim>::
+ face_to_cell_lines(face,1)]]->index(),
+ needed_lines[line_list[GeometryInfo<dim>::
+ face_to_cell_lines(face,2)]]->index(),
+ needed_lines[line_list[GeometryInfo<dim>::
+ face_to_cell_lines(face,3)]]->index());
// insert quad, with
// invalid iterator
// new one and instead
// later set the
// face_orientation flag
- const Quad test_quad (quad.line(2), quad.line(3),
- quad.line(0), quad.line(1));
+ const internal::Triangulation::Quad
+ test_quad (quad.line(2), quad.line(3),
+ quad.line(0), quad.line(1));
if (needed_quads.find (test_quad) == needed_quads.end())
needed_quads[quad] = end_quad();
}
// the arrays of the Triangulation
//
// first reserve enough space
- levels[0]->TriangulationLevel<2>::reserve_space (needed_quads.size());
+ levels[0]->internal::Triangulation::TriaLevel<2>
+ ::reserve_space (needed_quads.size());
+
if (true)
{
raw_quad_iterator quad = begin_raw_quad();
- std::map<Quad,quad_iterator,QuadComparator>::iterator q;
+ std::map<internal::Triangulation::Quad,quad_iterator,QuadComparator>
+ ::iterator q;
for (q = needed_quads.begin(); quad!=end_quad(); ++quad, ++q)
{
quad->set (q->first);
/////////////////////////////////
// finally create the cells
- levels[0]->TriangulationLevel<3>::reserve_space (cells.size());
+ levels[0]->internal::Triangulation::TriaLevel<3>
+ ::reserve_space (cells.size());
// store for each quad index the
// adjacent cells
bool face_orientation[GeometryInfo<dim>::faces_per_cell];
for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
{
- Quad quad(needed_lines[line_list[GeometryInfo<dim>::
- face_to_cell_lines(face,0)]]->index(),
- needed_lines[line_list[GeometryInfo<dim>::
- face_to_cell_lines(face,1)]]->index(),
- needed_lines[line_list[GeometryInfo<dim>::
- face_to_cell_lines(face,2)]]->index(),
- needed_lines[line_list[GeometryInfo<dim>::
- face_to_cell_lines(face,3)]]->index());
+ internal::Triangulation::Quad
+ quad(needed_lines[line_list[GeometryInfo<dim>::
+ face_to_cell_lines(face,0)]]->index(),
+ needed_lines[line_list[GeometryInfo<dim>::
+ face_to_cell_lines(face,1)]]->index(),
+ needed_lines[line_list[GeometryInfo<dim>::
+ face_to_cell_lines(face,2)]]->index(),
+ needed_lines[line_list[GeometryInfo<dim>::
+ face_to_cell_lines(face,3)]]->index());
if (needed_quads.find (quad) != needed_quads.end())
{
// face must be
// available in
// reverse order then
- const Quad test_quad (quad.line(2), quad.line(3),
- quad.line(0), quad.line(1));
+ const internal::Triangulation::Quad
+ test_quad (quad.line(2), quad.line(3),
+ quad.line(0), quad.line(1));
Assert (needed_quads.find (test_quad) != needed_quads.end(),
ExcInternalError());
face_iterator[face] = needed_quads[test_quad];
// make the cell out of
// these iterators
- cell->set (Hexahedron(face_iterator[0]->index(),
- face_iterator[1]->index(),
- face_iterator[2]->index(),
- face_iterator[3]->index(),
- face_iterator[4]->index(),
- face_iterator[5]->index()));
+ cell->set (internal::Triangulation
+ ::Hexahedron(face_iterator[0]->index(),
+ face_iterator[1]->index(),
+ face_iterator[2]->index(),
+ face_iterator[3]->index(),
+ face_iterator[4]->index(),
+ face_iterator[5]->index()));
cell->set_used_flag ();
cell->set_material_id (cells[c].material_id);
// and because boundary quad
// orientation does not carry
// any information.
- Quad quad_compare_1(line[0]->index(), line[1]->index(), line[2]->index(), line[3]->index());
- Quad quad_compare_2(line[2]->index(), line[3]->index(), line[0]->index(), line[1]->index());
+ internal::Triangulation::Quad
+ quad_compare_1(line[0]->index(), line[1]->index(),
+ line[2]->index(), line[3]->index());
+ internal::Triangulation::Quad
+ quad_compare_2(line[2]->index(), line[3]->index(),
+ line[0]->index(), line[1]->index());
// try to find the quad with
// lines situated as
for (unsigned int i=0; i<255; ++i)
boundary[i] = straight_boundary;
- number_cache = TriaNumberCache<dim>();
+ number_cache = internal::Triangulation::NumberCache<dim>();
}
if (cell->used())
if (cell->refine_flag_set())
{
- levels.push_back (new TriangulationLevel<dim>);
+ levels.push_back (new internal::Triangulation::TriaLevel<dim>);
break;
}
}
// 2*flagged_cells that will be
// created on that level
levels[level+1]->
- TriangulationLevel<0>::reserve_space (used_cells+
- GeometryInfo<1>::children_per_cell *
- flagged_cells, 1);
+ internal::Triangulation::TriaLevel<0>
+ ::reserve_space (used_cells+
+ GeometryInfo<1>::children_per_cell *
+ flagged_cells, 1);
// reserve space for
// 2*flagged_cells new lines on
// the next higher level
levels[level+1]->
- TriangulationLevel<1>::reserve_space (GeometryInfo<1>::children_per_cell*flagged_cells);
+ internal::Triangulation::TriaLevel<1>
+ ::reserve_space (GeometryInfo<1>::children_per_cell*flagged_cells);
needed_vertices += flagged_cells;
}
// insert first child
cell->set_children (first_child->index());
first_child->clear_children ();
- first_child->set (Line (cell->vertex_index(0), next_unused_vertex));
+ first_child->set (internal::Triangulation
+ ::Line (cell->vertex_index(0),
+ next_unused_vertex));
first_child->set_material_id (cell->material_id());
first_child->set_subdomain_id (cell->subdomain_id());
- // reset neighborship
- // info (refer to
- // \Ref{TriangulationLevel<0>}
+ // reset neighborship info (refer
+ // to
+ // internal::Triangulation::TriaLevel<0>
// for details)
first_child->set_neighbor (1, second_child);
if (cell->neighbor(0).state() != IteratorState::valid)
// insert second child
second_child->clear_children ();
- second_child->set (Line (next_unused_vertex, cell->vertex_index(1)));
+ second_child->set (internal::Triangulation
+ ::Line (next_unused_vertex,
+ cell->vertex_index(1)));
second_child->set_neighbor (0, first_child);
second_child->set_material_id (cell->material_id());
second_child->set_subdomain_id (cell->subdomain_id());
if (cell->used())
if (cell->refine_flag_set())
{
- levels.push_back (new TriangulationLevel<dim>);
+ levels.push_back (new internal::Triangulation::TriaLevel<dim>);
break;
}
}
// 4*flagged_cells that will be
// created on that level
levels[level+1]->
- TriangulationLevel<0>::reserve_space (used_cells+4*flagged_cells, 2);
+ internal::Triangulation::TriaLevel<0>
+ ::reserve_space (used_cells+4*flagged_cells, 2);
// reserve space for
// needed_lines new lines
levels[level+1]->
- TriangulationLevel<1>::reserve_space (needed_lines);
+ internal::Triangulation::TriaLevel<1>
+ ::reserve_space (needed_lines);
// reserve space for
// 4*flagged_cells
// new quads on the next higher
// level
levels[level+1]->
- TriangulationLevel<2>::reserve_space (4*flagged_cells);
+ internal::Triangulation::TriaLevel<2>
+ ::reserve_space (4*flagged_cells);
}
// add to needed vertices how many
Assert (children[0]->used() == false, ExcCellShouldBeUnused());
Assert (children[1]->used() == false, ExcCellShouldBeUnused());
- children[0]->set (Line(line->vertex_index(0),
- next_unused_vertex));
- children[1]->set (Line(next_unused_vertex,
- line->vertex_index(1)));
+ children[0]->set (internal::Triangulation
+ ::Line(line->vertex_index(0),
+ next_unused_vertex));
+ children[1]->set (internal::Triangulation
+ ::Line(next_unused_vertex,
+ line->vertex_index(1)));
children[0]->set_used_flag();
children[1]->set_used_flag();
ExcCellShouldBeUnused());
}
- new_lines[8] ->set (Line(new_vertices[6], new_vertices[8]));
- new_lines[9] ->set (Line(new_vertices[8], new_vertices[7]));
- new_lines[10]->set (Line(new_vertices[4], new_vertices[8]));
- new_lines[11]->set (Line(new_vertices[8], new_vertices[5]));
+ new_lines[8] ->set (internal::Triangulation
+ ::Line(new_vertices[6], new_vertices[8]));
+ new_lines[9] ->set (internal::Triangulation
+ ::Line(new_vertices[8], new_vertices[7]));
+ new_lines[10]->set (internal::Triangulation
+ ::Line(new_vertices[4], new_vertices[8]));
+ new_lines[11]->set (internal::Triangulation
+ ::Line(new_vertices[8], new_vertices[5]));
for (l=8; l<12; ++l)
{
cell->set_children (subcells[0]->index());
Assert(n_children==4, ExcNotImplemented());
- subcells[0]->set (Quad(new_lines[0]->index(),
- new_lines[8]->index(),
- new_lines[4]->index(),
- new_lines[10]->index()));
- subcells[1]->set (Quad(new_lines[8]->index(),
- new_lines[2]->index(),
- new_lines[5]->index(),
- new_lines[11]->index()));
- subcells[2]->set (Quad(new_lines[1]->index(),
- new_lines[9]->index(),
- new_lines[10]->index(),
- new_lines[6]->index()));
- subcells[3]->set (Quad(new_lines[9]->index(),
- new_lines[3]->index(),
- new_lines[11]->index(),
- new_lines[7]->index()));
+ subcells[0]->set (internal::Triangulation
+ ::Quad(new_lines[0]->index(),
+ new_lines[8]->index(),
+ new_lines[4]->index(),
+ new_lines[10]->index()));
+ subcells[1]->set (internal::Triangulation
+ ::Quad(new_lines[8]->index(),
+ new_lines[2]->index(),
+ new_lines[5]->index(),
+ new_lines[11]->index()));
+ subcells[2]->set (internal::Triangulation
+ ::Quad(new_lines[1]->index(),
+ new_lines[9]->index(),
+ new_lines[10]->index(),
+ new_lines[6]->index()));
+ subcells[3]->set (internal::Triangulation
+ ::Quad(new_lines[9]->index(),
+ new_lines[3]->index(),
+ new_lines[11]->index(),
+ new_lines[7]->index()));
for (unsigned int i=0; i<n_children; ++i)
{
if (cell->used())
if (cell->refine_flag_set())
{
- levels.push_back (new TriangulationLevel<dim>);
+ levels.push_back (new internal::Triangulation::TriaLevel<dim>);
break;
}
}
// 8*flagged_cells that will be
// created on that level
levels[level+1]->
- TriangulationLevel<0>::reserve_space (used_cells+8*flagged_cells, 3);
+ internal::Triangulation::TriaLevel<0>
+ ::reserve_space (used_cells+8*flagged_cells, 3);
// reserve space for
// needed_lines new lines
levels[level+1]->
- TriangulationLevel<1>::reserve_space (needed_lines);
+ internal::Triangulation::TriaLevel<1>
+ ::reserve_space (needed_lines);
// reserve space for
// needed_quads new quads
levels[level+1]->
- TriangulationLevel<2>::reserve_space (needed_quads);
+ internal::Triangulation::TriaLevel<2>
+ ::reserve_space (needed_quads);
// reserve space for
// 8*flagged_cells
// new hexes on the next higher
// level
levels[level+1]->
- TriangulationLevel<3>::reserve_space (8*flagged_cells);
+ internal::Triangulation::TriaLevel<3>
+ ::reserve_space (8*flagged_cells);
}
// add to needed vertices how many
Assert (children[0]->used() == false, ExcCellShouldBeUnused());
Assert (children[1]->used() == false, ExcCellShouldBeUnused());
- children[0]->set (Line(line->vertex_index(0),
- next_unused_vertex));
- children[1]->set (Line(next_unused_vertex,
- line->vertex_index(1)));
+ children[0]->set (internal::Triangulation
+ ::Line(line->vertex_index(0),
+ next_unused_vertex));
+ children[1]->set (internal::Triangulation
+ ::Line(next_unused_vertex,
+ line->vertex_index(1)));
children[0]->set_used_flag();
children[1]->set_used_flag();
next_unused_vertex
};
- new_lines[0]->set (Line(vertex_indices[2], vertex_indices[4]));
- new_lines[1]->set (Line(vertex_indices[4], vertex_indices[3]));
- new_lines[2]->set (Line(vertex_indices[0], vertex_indices[4]));
- new_lines[3]->set (Line(vertex_indices[4], vertex_indices[1]));
+ new_lines[0]->set (internal::Triangulation
+ ::Line(vertex_indices[2], vertex_indices[4]));
+ new_lines[1]->set (internal::Triangulation
+ ::Line(vertex_indices[4], vertex_indices[3]));
+ new_lines[2]->set (internal::Triangulation
+ ::Line(vertex_indices[0], vertex_indices[4]));
+ new_lines[3]->set (internal::Triangulation
+ ::Line(vertex_indices[4], vertex_indices[1]));
for (unsigned int i=0; i<4; ++i)
{
// present one
quad->set_children (new_quads[0]->index());
- new_quads[0]->set (Quad(line_indices[0],
- line_indices[8],
- line_indices[4],
- line_indices[10]));
- new_quads[1]->set (Quad(line_indices[8],
- line_indices[2],
- line_indices[5],
- line_indices[11]));
- new_quads[2]->set (Quad(line_indices[1],
- line_indices[9],
- line_indices[10],
- line_indices[6]));
- new_quads[3]->set (Quad(line_indices[9],
- line_indices[3],
- line_indices[11],
- line_indices[7]));
+ new_quads[0]->set (internal::Triangulation
+ ::Quad(line_indices[0],
+ line_indices[8],
+ line_indices[4],
+ line_indices[10]));
+ new_quads[1]->set (internal::Triangulation
+ ::Quad(line_indices[8],
+ line_indices[2],
+ line_indices[5],
+ line_indices[11]));
+ new_quads[2]->set (internal::Triangulation
+ ::Quad(line_indices[1],
+ line_indices[9],
+ line_indices[10],
+ line_indices[6]));
+ new_quads[3]->set (internal::Triangulation
+ ::Quad(line_indices[9],
+ line_indices[3],
+ line_indices[11],
+ line_indices[7]));
for (unsigned int i=0; i<4; ++i)
{
new_quads[i]->set_used_flag();
next_unused_vertex
};
- new_lines[0]->set (Line(vertex_indices[2], vertex_indices[6]));
- new_lines[1]->set (Line(vertex_indices[6], vertex_indices[3]));
- new_lines[2]->set (Line(vertex_indices[0], vertex_indices[6]));
- new_lines[3]->set (Line(vertex_indices[6], vertex_indices[1]));
- new_lines[4]->set (Line(vertex_indices[4], vertex_indices[6]));
- new_lines[5]->set (Line(vertex_indices[6], vertex_indices[5]));
+ new_lines[0]->set (internal::Triangulation
+ ::Line(vertex_indices[2], vertex_indices[6]));
+ new_lines[1]->set (internal::Triangulation
+ ::Line(vertex_indices[6], vertex_indices[3]));
+ new_lines[2]->set (internal::Triangulation
+ ::Line(vertex_indices[0], vertex_indices[6]));
+ new_lines[3]->set (internal::Triangulation
+ ::Line(vertex_indices[6], vertex_indices[1]));
+ new_lines[4]->set (internal::Triangulation
+ ::Line(vertex_indices[4], vertex_indices[6]));
+ new_lines[5]->set (internal::Triangulation
+ ::Line(vertex_indices[6], vertex_indices[5]));
for (unsigned int i=0; i<6; ++i)
{
// *----*----* *-26-*-27-*
// / 8 / 9 / 2 24 6
// *----*----*x *--8-*--9-*
- new_quads[0]->set (Quad(line_indices[10],
- line_indices[28],
- line_indices[16],
- line_indices[24]));
- new_quads[1]->set (Quad(line_indices[28],
- line_indices[14],
- line_indices[17],
- line_indices[25]));
- new_quads[2]->set (Quad(line_indices[11],
- line_indices[29],
- line_indices[24],
- line_indices[20]));
- new_quads[3]->set (Quad(line_indices[29],
- line_indices[15],
- line_indices[25],
- line_indices[21]));
- new_quads[4]->set (Quad(line_indices[18],
- line_indices[26],
- line_indices[0],
- line_indices[28]));
- new_quads[5]->set (Quad(line_indices[26],
- line_indices[22],
- line_indices[1],
- line_indices[29]));
- new_quads[6]->set (Quad(line_indices[19],
- line_indices[27],
- line_indices[28],
- line_indices[4]));
- new_quads[7]->set (Quad(line_indices[27],
- line_indices[23],
- line_indices[29],
- line_indices[5]));
- new_quads[8]->set (Quad(line_indices[2],
- line_indices[24],
- line_indices[8],
- line_indices[26]));
- new_quads[9]->set (Quad(line_indices[24],
- line_indices[6],
- line_indices[9],
- line_indices[27]));
- new_quads[10]->set (Quad(line_indices[3],
- line_indices[25],
- line_indices[26],
- line_indices[12]));
- new_quads[11]->set (Quad(line_indices[25],
- line_indices[7],
- line_indices[27],
- line_indices[13]));
+ new_quads[0]->set (internal::Triangulation
+ ::Quad(line_indices[10],
+ line_indices[28],
+ line_indices[16],
+ line_indices[24]));
+ new_quads[1]->set (internal::Triangulation
+ ::Quad(line_indices[28],
+ line_indices[14],
+ line_indices[17],
+ line_indices[25]));
+ new_quads[2]->set (internal::Triangulation
+ ::Quad(line_indices[11],
+ line_indices[29],
+ line_indices[24],
+ line_indices[20]));
+ new_quads[3]->set (internal::Triangulation
+ ::Quad(line_indices[29],
+ line_indices[15],
+ line_indices[25],
+ line_indices[21]));
+ new_quads[4]->set (internal::Triangulation
+ ::Quad(line_indices[18],
+ line_indices[26],
+ line_indices[0],
+ line_indices[28]));
+ new_quads[5]->set (internal::Triangulation
+ ::Quad(line_indices[26],
+ line_indices[22],
+ line_indices[1],
+ line_indices[29]));
+ new_quads[6]->set (internal::Triangulation
+ ::Quad(line_indices[19],
+ line_indices[27],
+ line_indices[28],
+ line_indices[4]));
+ new_quads[7]->set (internal::Triangulation
+ ::Quad(line_indices[27],
+ line_indices[23],
+ line_indices[29],
+ line_indices[5]));
+ new_quads[8]->set (internal::Triangulation
+ ::Quad(line_indices[2],
+ line_indices[24],
+ line_indices[8],
+ line_indices[26]));
+ new_quads[9]->set (internal::Triangulation
+ ::Quad(line_indices[24],
+ line_indices[6],
+ line_indices[9],
+ line_indices[27]));
+ new_quads[10]->set (internal::Triangulation
+ ::Quad(line_indices[3],
+ line_indices[25],
+ line_indices[26],
+ line_indices[12]));
+ new_quads[11]->set (internal::Triangulation
+ ::Quad(line_indices[25],
+ line_indices[7],
+ line_indices[27],
+ line_indices[13]));
for (unsigned int i=0; i<12; ++i)
{
new_quads[i]->set_used_flag();
hex->set_children (new_hexes[0]->index());
// bottom children
- new_hexes[0]->set (Hexahedron(quad_indices[12],
- quad_indices[0],
- quad_indices[20],
- quad_indices[4],
- quad_indices[28],
- quad_indices[8]));
- new_hexes[1]->set (Hexahedron(quad_indices[0],
- quad_indices[16],
- quad_indices[22],
- quad_indices[6],
- quad_indices[29],
- quad_indices[9]));
- new_hexes[2]->set (Hexahedron(quad_indices[13],
- quad_indices[1],
- quad_indices[4],
- quad_indices[24],
- quad_indices[30],
- quad_indices[10]));
- new_hexes[3]->set (Hexahedron(quad_indices[1],
- quad_indices[17],
- quad_indices[6],
- quad_indices[26],
- quad_indices[31],
- quad_indices[11]));
+ new_hexes[0]->set (internal::Triangulation
+ ::Hexahedron(quad_indices[12],
+ quad_indices[0],
+ quad_indices[20],
+ quad_indices[4],
+ quad_indices[28],
+ quad_indices[8]));
+ new_hexes[1]->set (internal::Triangulation
+ ::Hexahedron(quad_indices[0],
+ quad_indices[16],
+ quad_indices[22],
+ quad_indices[6],
+ quad_indices[29],
+ quad_indices[9]));
+ new_hexes[2]->set (internal::Triangulation
+ ::Hexahedron(quad_indices[13],
+ quad_indices[1],
+ quad_indices[4],
+ quad_indices[24],
+ quad_indices[30],
+ quad_indices[10]));
+ new_hexes[3]->set (internal::Triangulation
+ ::Hexahedron(quad_indices[1],
+ quad_indices[17],
+ quad_indices[6],
+ quad_indices[26],
+ quad_indices[31],
+ quad_indices[11]));
// top children
- new_hexes[4]->set (Hexahedron(quad_indices[14],
- quad_indices[2],
- quad_indices[21],
- quad_indices[5],
- quad_indices[8],
- quad_indices[32]));
- new_hexes[5]->set (Hexahedron(quad_indices[2],
- quad_indices[18],
- quad_indices[23],
- quad_indices[7],
- quad_indices[9],
- quad_indices[33]));
- new_hexes[6]->set (Hexahedron(quad_indices[15],
- quad_indices[3],
- quad_indices[5],
- quad_indices[25],
- quad_indices[10],
- quad_indices[34]));
- new_hexes[7]->set (Hexahedron(quad_indices[3],
- quad_indices[19],
- quad_indices[7],
- quad_indices[27],
- quad_indices[11],
- quad_indices[35]));
-
+ new_hexes[4]->set (internal::Triangulation
+ ::Hexahedron(quad_indices[14],
+ quad_indices[2],
+ quad_indices[21],
+ quad_indices[5],
+ quad_indices[8],
+ quad_indices[32]));
+ new_hexes[5]->set (internal::Triangulation
+ ::Hexahedron(quad_indices[2],
+ quad_indices[18],
+ quad_indices[23],
+ quad_indices[7],
+ quad_indices[9],
+ quad_indices[33]));
+ new_hexes[6]->set (internal::Triangulation
+ ::Hexahedron(quad_indices[15],
+ quad_indices[3],
+ quad_indices[5],
+ quad_indices[25],
+ quad_indices[10],
+ quad_indices[34]));
+ new_hexes[7]->set (internal::Triangulation
+ ::Hexahedron(quad_indices[3],
+ quad_indices[19],
+ quad_indices[7],
+ quad_indices[27],
+ quad_indices[11],
+ quad_indices[35]));
+
for (unsigned int i=0; i<8; ++i)
{
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
/*------------------------ Functions: LineAccessor ---------------------------*/
template <int dim>
-void TriaObjectAccessor<1, dim>::set (const Line &line) const
+void
+TriaObjectAccessor<1, dim>::
+set (const internal::Triangulation::Line &line) const
{
- this->tria->levels[this->present_level]->lines.lines[this->present_index] = line;
+ this->tria->levels[this->present_level]
+ ->lines.lines[this->present_index] = line;
}
/*------------------------ Functions: QuadAccessor ---------------------------*/
template <int dim>
-void TriaObjectAccessor<2, dim>::set (const Quad &quad) const
+void
+TriaObjectAccessor<2, dim>::
+set (const internal::Triangulation::Quad &quad) const
{
- this->tria->levels[this->present_level]->quads.quads[this->present_index] = quad;
+ this->tria->levels[this->present_level]
+ ->quads.quads[this->present_index] = quad;
}
/*------------------------ Functions: TriaObjectAccessor ---------------------------*/
template <int dim>
-void TriaObjectAccessor<3, dim>::set (const Hexahedron &hex) const
+void
+TriaObjectAccessor<3, dim>::
+set (const internal::Triangulation::Hexahedron &hex) const
{
- this->tria->levels[this->present_level]->hexes.hexes[this->present_index] = hex;
+ this->tria->levels[this->present_level]
+ ->hexes.hexes[this->present_index] = hex;
}
<ol>
+ <li> <p>
+ Changed: Several classes related to the storage of data in the
+ Triangulation and DoFHandler classes have been moved into internal
+ namespaces, and some have also been removed. Since these were not for
+ use anywhere outside the library, it is unlikely that this poses
+ problems to application programs. On the other hand, it moves common
+ names like <code>Line</code> and <code>Quad</code> out of the global
+ namespace.
+ <br>
+ (WB 2006/01/13)
+ </p>
+
<li> <p>
Changed: Previously, if <code>mg_dof_handler</code> was a
multilevel DoF handler object, calling