From b70b468737af2eb515a5aa5ecf8308b40c09fc39 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 13 Jan 2006 23:00:33 +0000 Subject: [PATCH] Move a bunch of classes pertaining to the storage of data of the Triangulation class to an internal namespace. git-svn-id: https://svn.dealii.org/trunk@12011 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/grid/tria.h | 264 ++-- deal.II/deal.II/include/grid/tria_accessor.h | 27 +- deal.II/deal.II/include/grid/tria_boundary.h | 6 +- .../deal.II/include/grid/tria_boundary_lib.h | 12 +- deal.II/deal.II/include/grid/tria_hex.h | 185 +-- deal.II/deal.II/include/grid/tria_levels.h | 1145 +++++++++-------- deal.II/deal.II/include/grid/tria_line.h | 144 ++- deal.II/deal.II/include/grid/tria_quad.h | 163 +-- .../source/grid/tria.all_dimensions.cc | 750 +++++------ deal.II/deal.II/source/grid/tria.cc | 539 ++++---- deal.II/deal.II/source/grid/tria_accessor.cc | 23 +- deal.II/doc/news/changes.html | 12 + 12 files changed, 1725 insertions(+), 1545 deletions(-) diff --git a/deal.II/deal.II/include/grid/tria.h b/deal.II/deal.II/include/grid/tria.h index f2e7c96f96..ac88eb805b 100644 --- a/deal.II/deal.II/include/grid/tria.h +++ b/deal.II/deal.II/include/grid/tria.h @@ -26,7 +26,13 @@ template class Boundary; template class StraightBoundary; -template class TriangulationLevel; +namespace internal +{ + namespace Triangulation + { + template class TriaLevel; + } +} template class DoFHandler; namespace hp { @@ -124,7 +130,15 @@ struct SubCellData /*------------------------------------------------------------------------*/ - +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 @@ -143,10 +157,10 @@ struct SubCellData * @ingroup grid * @author Wolfgang Bangerth, 1999 */ -template -struct TriaNumberCache -{ -}; + template + struct NumberCache + { + }; /** * Cache class used to store the number of used and active elements @@ -165,53 +179,53 @@ struct TriaNumberCache * @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 n_lines_level; + /** + * Array holding the number of used + * lines on each level. + */ + std::vector 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 n_active_lines_level; + /** + * Array holding the number of active + * lines on each level. + */ + std::vector 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 @@ -226,46 +240,46 @@ struct TriaNumberCache<1> * @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 n_quads_level; + /** + * Array holding the number of used + * quads on each level. + */ + std::vector 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 n_active_quads_level; + /** + * Array holding the number of active + * quads on each level. + */ + std::vector 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 @@ -273,7 +287,7 @@ struct TriaNumberCache<2> : public TriaNumberCache<1> * 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 @@ -288,46 +302,48 @@ struct TriaNumberCache<2> : public TriaNumberCache<1> * @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 n_hexes_level; + /** + * Array holding the number of used + * hexes on each level. + */ + std::vector 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 n_active_hexes_level; + /** + * Array holding the number of active + * hexes on each level. + */ + std::vector 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; + }; + } +} /*------------------------------------------------------------------------*/ @@ -338,11 +354,12 @@ struct TriaNumberCache<3> : public TriaNumberCache<2> * 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. * * *

Structure and iterators

@@ -3348,13 +3365,10 @@ class Triangulation : public Subscriptor /** * Array of pointers pointing to the - * TriangulationLevel objects - * storing the data on the different - * levels. - * - * Usage is like levels[3]->quads. + * objects storing the data on the + * different levels. */ - std::vector*> levels; + std::vector*> levels; /** * Array of the vertices of this @@ -3403,7 +3417,7 @@ class Triangulation : public Subscriptor * frequent operation, this was not * an optimal solution. */ - TriaNumberCache number_cache; + internal::Triangulation::NumberCache number_cache; /** * List of RefinementListeners, diff --git a/deal.II/deal.II/include/grid/tria_accessor.h b/deal.II/deal.II/include/grid/tria_accessor.h index 11d9a7009f..d8092eb2f7 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.h +++ b/deal.II/deal.II/include/grid/tria_accessor.h @@ -2,7 +2,7 @@ // $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 @@ -25,10 +25,15 @@ template class Triangulation; template class TriaRawIterator; template class TriaIterator; template class TriaActiveIterator; -class Line; -class Quad; -class Hexahedron; - +namespace internal +{ + namespace Triangulation + { + class Line; + class Quad; + class Hexahedron; + } +} template class TriaObjectAccessor; template class TriaObjectAccessor<0, dim>; template class TriaObjectAccessor<1, dim>; @@ -345,21 +350,21 @@ class TriaObjectAccessor : public TriaAccessor * celldim==1. */ - void set (const Line&) const; + void set (const internal::Triangulation::Line&) const; /** * Copy the data of the given * quad. Only implemented for * celldim==2. */ - void set (const Quad&) const; + void set (const internal::Triangulation::Quad&) const; /** * Copy the data of the given * hex. Only implemented for * celldim==3. */ - void set (const Hexahedron&) const; + void set (const internal::Triangulation::Hexahedron&) const; /** * Index of vertex. The @@ -879,7 +884,7 @@ class TriaObjectAccessor<1, dim> : public TriaAccessor * 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 @@ -1331,7 +1336,7 @@ class TriaObjectAccessor<2, dim> : public TriaAccessor /** * 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 @@ -1838,7 +1843,7 @@ class TriaObjectAccessor<3, dim> : public TriaAccessor * 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. diff --git a/deal.II/deal.II/include/grid/tria_boundary.h b/deal.II/deal.II/include/grid/tria_boundary.h index 2f4365f2a8..7f51c9d91c 100644 --- a/deal.II/deal.II/include/grid/tria_boundary.h +++ b/deal.II/deal.II/include/grid/tria_boundary.h @@ -2,7 +2,7 @@ // $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 @@ -71,7 +71,7 @@ template class Triangulation; * 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 @@ -262,6 +262,8 @@ class Boundary : public Subscriptor * polygon/polyhedron defined by the boundary of the initial coarse * triangulation. * + * @ingroup boundary + * * @author Wolfgang Bangerth, 1998, 2001, Ralf Hartmann, 2001 */ template diff --git a/deal.II/deal.II/include/grid/tria_boundary_lib.h b/deal.II/deal.II/include/grid/tria_boundary_lib.h index c4e415d603..e29b7a79ca 100644 --- a/deal.II/deal.II/include/grid/tria_boundary_lib.h +++ b/deal.II/deal.II/include/grid/tria_boundary_lib.h @@ -2,7 +2,7 @@ // $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 @@ -34,6 +34,8 @@ * Boundary, which would seem natural, since this way we can use the * StraightBoundary::in_between() function. * + * @ingroup boundary + * * @author Guido Kanschat, 2001 */ template @@ -173,6 +175,8 @@ class CylinderBoundary : public StraightBoundary * 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 @@ -319,6 +323,8 @@ class HyperBallBoundary : public StraightBoundary * 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 @@ -396,6 +402,8 @@ class HalfHyperBallBoundary : public HyperBallBoundary * sphere are computed automatically upon calling one of the virtual * functions. * + * @ingroup boundary + * * @author Wolfgang Bangerth, 1999 */ template @@ -426,6 +434,8 @@ class HyperShellBoundary : public HyperBallBoundary * useful for computations with rotational symmetry, where one * dimension is the radius from the axis of rotation. * + * @ingroup boundary + * * @author Wolfgang Bangerth, 2000 */ template diff --git a/deal.II/deal.II/include/grid/tria_hex.h b/deal.II/deal.II/include/grid/tria_hex.h index 291d561e79..d96d63913b 100644 --- a/deal.II/deal.II/include/grid/tria_hex.h +++ b/deal.II/deal.II/include/grid/tria_hex.h @@ -2,7 +2,7 @@ // $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 @@ -17,6 +17,11 @@ #include #include +namespace internal +{ + namespace Triangulation + { + /** * @p Hexahedrons denote the fundamental entities of triangulations * in three dimensions. They are characterized by the (global) @@ -35,110 +40,114 @@ * @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 diff --git a/deal.II/deal.II/include/grid/tria_levels.h b/deal.II/deal.II/include/grid/tria_levels.h index b3c97504b9..f64b39a0e1 100644 --- a/deal.II/deal.II/include/grid/tria_levels.h +++ b/deal.II/deal.II/include/grid/tria_levels.h @@ -2,7 +2,7 @@ // $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 @@ -21,178 +21,187 @@ #include #include +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 -class TriangulationLevel -{ -}; + template + 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 refine_flags; - - /** - * Same meaning as the one above, but - * specifies whether a cell must be - * coarsened. - */ - std::vector 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 refine_flags; + + /** + * Same meaning as the one above, but + * specifies whether a cell must be + * coarsened. + */ + std::vector 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 neighbors[0] - * and neighbors[1], the neighbors of - * cell 1 are stored in neighbors[2] - * and neighbors[3], and so on. - * - * In neighbors, neighbors[i].first is - * the level, while neighbors[i].first - * is the index of the neighbor. - * - * If a neighbor does not exist (cell is - * at the boundary), level=index=-1 - * is set. - * - * Conventions: 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 > 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 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 neighbors[0] + * and neighbors[1], the neighbors of + * cell 1 are stored in neighbors[2] + * and neighbors[3], and so on. + * + * In neighbors, neighbors[i].first is + * the level, while neighbors[i].first + * is the index of the neighbor. + * + * If a neighbor does not exist (cell is + * at the boundary), level=index=-1 + * is set. + * + * Conventions: 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 > 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 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 - * TriangulationLevel::reserve_space - * functions, with N>0. - * - * 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 + * TriaLevel::reserve_space + * functions, with N>0. + * + * 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."); + }; @@ -207,152 +216,152 @@ class TriangulationLevel<0> * @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 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 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 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 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 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 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 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 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 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 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 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 user_pointers; + }; - public: - /** - * Data about the lines. - */ - LinesData lines; - - /** - * Assert that enough space is - * allocated to accomodate - * new_lines new lines. - * This function does not only - * call - * vector::reserve(), - * 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 - * TriangulationLevel<0>::reserve_space - * 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 + * new_lines new lines. + * This function does not only + * call + * vector::reserve(), + * 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 + * TriaLevel<0>::reserve_space + * 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; + }; @@ -364,116 +373,116 @@ class TriangulationLevel<1> : public TriangulationLevel<0> * 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<1>. - */ - struct QuadsData + template <> + class TriaLevel<2> : public TriaLevel<1> { - /** - * Same as for the @p lines array. - */ - std::vector 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 children; - - /** - * Same as for - * TriangulationLevel<1>::LinesData@p ::used. - */ - std::vector used; - - /** - * Same as for - * TriangulationLevel<1>::LinesData@p ::used. - */ - std::vector 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 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 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<1>. + */ + struct QuadsData + { + /** + * Same as for the @p lines array. + */ + std::vector 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 children; + + /** + * Same as for + * TriaLevel<1>::LinesData@p ::used. + */ + std::vector used; + + /** + * Same as for + * TriaLevel<1>::LinesData@p ::used. + */ + std::vector 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 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 user_pointers; + }; - public: - /** - * Data about the quads. - */ - QuadsData quads; - - /** - * Assert that enough space is - * allocated to accomodate - * new_quads 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 + * new_quads 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; + }; @@ -488,177 +497,179 @@ class TriangulationLevel<2> : public TriangulationLevel<1> * 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 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 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 children; - - /** - * Same as for - * TriangulationLevel<1>::LinesData@p ::used. - */ - std::vector used; - - /** - * Same as for - * TriangulationLevel<1>::LinesData@p ::used. - */ - std::vector 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 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 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 children; + + /** + * Same as for + * TriaLevel<1>::LinesData@p ::used. + */ + std::vector used; + + /** + * Same as for + * TriaLevel<1>::LinesData@p ::used. + */ + std::vector 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 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 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 + * 6*n_cells elements, + * being the number of cells + * times the six faces each + * has. + */ + std::vector 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 - * 6*n_cells elements, - * being the number of cells - * times the six faces each - * has. + * Assert that enough space is + * allocated to accomodate + * new_hexes new hexes. */ - std::vector 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 - * new_hexes 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; -}; + } +} diff --git a/deal.II/deal.II/include/grid/tria_line.h b/deal.II/deal.II/include/grid/tria_line.h index c5367b8999..0b2bf11bfc 100644 --- a/deal.II/deal.II/include/grid/tria_line.h +++ b/deal.II/deal.II/include/grid/tria_line.h @@ -2,7 +2,7 @@ // $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 @@ -18,6 +18,11 @@ #include +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. @@ -30,91 +35,94 @@ * @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 diff --git a/deal.II/deal.II/include/grid/tria_quad.h b/deal.II/deal.II/include/grid/tria_quad.h index 45aeb7676f..887abf2a75 100644 --- a/deal.II/deal.II/include/grid/tria_quad.h +++ b/deal.II/deal.II/include/grid/tria_quad.h @@ -2,7 +2,7 @@ // $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 @@ -18,6 +18,11 @@ #include +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 @@ -32,99 +37,103 @@ * @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 diff --git a/deal.II/deal.II/source/grid/tria.all_dimensions.cc b/deal.II/deal.II/source/grid/tria.all_dimensions.cc index 00d1de515b..d07ec6ad8b 100644 --- a/deal.II/deal.II/source/grid/tria.all_dimensions.cc +++ b/deal.II/deal.II/source/grid/tria.all_dimensions.cc @@ -2,7 +2,7 @@ // $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 @@ -49,437 +49,443 @@ SubCellData::check_consistency (const unsigned int dim) const } - -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()::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()::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(), 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(), 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()::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()::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(), 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(), 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()::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()::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(), 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(), 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()::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()::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)); + } + } } diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index 6b5073737f..c73d65c6fe 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -2,7 +2,7 @@ // $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 @@ -235,7 +235,7 @@ void Triangulation::copy_triangulation (const Triangulation &old_tria) levels.reserve (old_tria.levels.size()); for (unsigned int level=0; level(*old_tria.levels[level])); + levels.push_back (new internal::Triangulation::TriaLevel(*old_tria.levels[level])); number_cache = old_tria.number_cache; @@ -287,9 +287,11 @@ void Triangulation<1>::create_triangulation (const std::vector > &v, std::vector > lines_at_vertex (v.size()); // reserve enough space - levels.push_back (new TriangulationLevel); - levels[0]->TriangulationLevel<0>::reserve_space (cells.size(), dim); - levels[0]->TriangulationLevel<1>::reserve_space (cells.size()); + levels.push_back (new internal::Triangulation::TriaLevel); + 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 (); @@ -298,7 +300,9 @@ void Triangulation<1>::create_triangulation (const std::vector > &v, 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 (); @@ -568,10 +572,13 @@ void Triangulation<2>::create_triangulation (const std::vector > &v, } // reserve enough space - levels.push_back (new TriangulationLevel); - 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); + 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) @@ -580,7 +587,8 @@ void Triangulation<2>::create_triangulation (const std::vector > &v, std::map,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 (); @@ -605,10 +613,10 @@ void Triangulation<2>::create_triangulation (const std::vector > &v, cells[c].vertices[GeometryInfo::line_to_cell_vertices(line, 0)], cells[c].vertices[GeometryInfo::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); @@ -735,16 +743,17 @@ void Triangulation<2>::create_triangulation (const std::vector > &v, #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 @@ -992,9 +1001,11 @@ Triangulation<3>::create_triangulation (const std::vector > &v, // actually set up data structures // for the lines // reserve enough space - levels.push_back (new TriangulationLevel); - 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); + 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) @@ -1003,7 +1014,8 @@ Triangulation<3>::create_triangulation (const std::vector > &v, std::map,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 (); @@ -1026,7 +1038,8 @@ Triangulation<3>::create_triangulation (const std::vector > &v, // note that QuadComparator is a // class declared and defined in // this file - std::map needed_quads; + std::map + needed_quads; for (unsigned int cell=0; cell::create_triangulation (const std::vector > &v, // get the cell line number // (0-11) through the // face_to_cell_lines function - Quad quad(needed_lines[line_list[GeometryInfo:: - face_to_cell_lines(face,0)]]->index(), - needed_lines[line_list[GeometryInfo:: - face_to_cell_lines(face,1)]]->index(), - needed_lines[line_list[GeometryInfo:: - face_to_cell_lines(face,2)]]->index(), - needed_lines[line_list[GeometryInfo:: - face_to_cell_lines(face,3)]]->index()); + internal::Triangulation::Quad + quad(needed_lines[line_list[GeometryInfo:: + face_to_cell_lines(face,0)]]->index(), + needed_lines[line_list[GeometryInfo:: + face_to_cell_lines(face,1)]]->index(), + needed_lines[line_list[GeometryInfo:: + face_to_cell_lines(face,2)]]->index(), + needed_lines[line_list[GeometryInfo:: + face_to_cell_lines(face,3)]]->index()); // insert quad, with // invalid iterator @@ -1112,8 +1126,9 @@ Triangulation<3>::create_triangulation (const std::vector > &v, // 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(); } @@ -1125,11 +1140,14 @@ Triangulation<3>::create_triangulation (const std::vector > &v, // 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::iterator q; + std::map + ::iterator q; for (q = needed_quads.begin(); quad!=end_quad(); ++quad, ++q) { quad->set (q->first); @@ -1145,7 +1163,8 @@ Triangulation<3>::create_triangulation (const std::vector > &v, ///////////////////////////////// // 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 @@ -1183,14 +1202,15 @@ Triangulation<3>::create_triangulation (const std::vector > &v, bool face_orientation[GeometryInfo::faces_per_cell]; for (unsigned int face=0; face::faces_per_cell; ++face) { - Quad quad(needed_lines[line_list[GeometryInfo:: - face_to_cell_lines(face,0)]]->index(), - needed_lines[line_list[GeometryInfo:: - face_to_cell_lines(face,1)]]->index(), - needed_lines[line_list[GeometryInfo:: - face_to_cell_lines(face,2)]]->index(), - needed_lines[line_list[GeometryInfo:: - face_to_cell_lines(face,3)]]->index()); + internal::Triangulation::Quad + quad(needed_lines[line_list[GeometryInfo:: + face_to_cell_lines(face,0)]]->index(), + needed_lines[line_list[GeometryInfo:: + face_to_cell_lines(face,1)]]->index(), + needed_lines[line_list[GeometryInfo:: + face_to_cell_lines(face,2)]]->index(), + needed_lines[line_list[GeometryInfo:: + face_to_cell_lines(face,3)]]->index()); if (needed_quads.find (quad) != needed_quads.end()) { @@ -1202,8 +1222,9 @@ Triangulation<3>::create_triangulation (const std::vector > &v, // 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]; @@ -1213,12 +1234,13 @@ Triangulation<3>::create_triangulation (const std::vector > &v, // 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); @@ -1487,8 +1509,12 @@ Triangulation<3>::create_triangulation (const std::vector > &v, // 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 @@ -4340,7 +4366,7 @@ Triangulation::clear_despite_subscriptions() for (unsigned int i=0; i<255; ++i) boundary[i] = straight_boundary; - number_cache = TriaNumberCache(); + number_cache = internal::Triangulation::NumberCache(); } @@ -4366,7 +4392,7 @@ Triangulation<1>::execute_refinement () if (cell->used()) if (cell->refine_flag_set()) { - levels.push_back (new TriangulationLevel); + levels.push_back (new internal::Triangulation::TriaLevel); break; } } @@ -4406,14 +4432,16 @@ Triangulation<1>::execute_refinement () // 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; } @@ -4491,13 +4519,15 @@ Triangulation<1>::execute_refinement () // 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) @@ -4544,7 +4574,9 @@ Triangulation<1>::execute_refinement () // 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()); @@ -4623,7 +4655,7 @@ Triangulation<2>::execute_refinement () if (cell->used()) if (cell->refine_flag_set()) { - levels.push_back (new TriangulationLevel); + levels.push_back (new internal::Triangulation::TriaLevel); break; } } @@ -4715,17 +4747,20 @@ Triangulation<2>::execute_refinement () // 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 @@ -4814,10 +4849,12 @@ Triangulation<2>::execute_refinement () 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(); @@ -4993,10 +5030,14 @@ Triangulation<2>::execute_refinement () 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) { @@ -5033,22 +5074,26 @@ Triangulation<2>::execute_refinement () 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::execute_refinement () if (cell->used()) if (cell->refine_flag_set()) { - levels.push_back (new TriangulationLevel); + levels.push_back (new internal::Triangulation::TriaLevel); break; } } @@ -5419,21 +5464,25 @@ Triangulation<3>::execute_refinement () // 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 @@ -5554,10 +5603,12 @@ Triangulation<3>::execute_refinement () 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(); @@ -5710,10 +5761,14 @@ Triangulation<3>::execute_refinement () 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) { @@ -5783,22 +5838,26 @@ Triangulation<3>::execute_refinement () // 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(); @@ -5964,12 +6023,18 @@ Triangulation<3>::execute_refinement () 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) { @@ -6183,54 +6248,66 @@ Triangulation<3>::execute_refinement () // *----*----* *-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(); @@ -6364,57 +6441,65 @@ Triangulation<3>::execute_refinement () 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) { diff --git a/deal.II/deal.II/source/grid/tria_accessor.cc b/deal.II/deal.II/source/grid/tria_accessor.cc index 598c4cfc94..2eb854ee41 100644 --- a/deal.II/deal.II/source/grid/tria_accessor.cc +++ b/deal.II/deal.II/source/grid/tria_accessor.cc @@ -2,7 +2,7 @@ // $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 @@ -29,9 +29,12 @@ /*------------------------ Functions: LineAccessor ---------------------------*/ template -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; } @@ -255,9 +258,12 @@ unsigned int TriaObjectAccessor<1, dim>::number_of_children () const /*------------------------ Functions: QuadAccessor ---------------------------*/ template -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; } @@ -665,9 +671,12 @@ unsigned int TriaObjectAccessor<2, dim>::number_of_children () const /*------------------------ Functions: TriaObjectAccessor ---------------------------*/ template -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; } diff --git a/deal.II/doc/news/changes.html b/deal.II/doc/news/changes.html index bd2e3b6476..1b2a19d0a6 100644 --- a/deal.II/doc/news/changes.html +++ b/deal.II/doc/news/changes.html @@ -44,6 +44,18 @@ inconvenience this causes.
    +
  1. + 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 Line and Quad out of the global + namespace. +
    + (WB 2006/01/13) +

    +
  2. Changed: Previously, if mg_dof_handler was a multilevel DoF handler object, calling -- 2.39.5