From 368667b6312fd1ca6e630908bc4f81745437d0a8 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 26 Jan 2006 03:07:48 +0000 Subject: [PATCH] Merge GeometrInfo with its base class again git-svn-id: https://svn.dealii.org/trunk@12169 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/geometry_info.h | 188 +++++++++++----------- deal.II/base/source/geometry_info.cc | 59 ++++++- 2 files changed, 153 insertions(+), 94 deletions(-) diff --git a/deal.II/base/include/base/geometry_info.h b/deal.II/base/include/base/geometry_info.h index 0b622b1b78..21a30b69b2 100644 --- a/deal.II/base/include/base/geometry_info.h +++ b/deal.II/base/include/base/geometry_info.h @@ -23,95 +23,6 @@ template class GeometryInfo; -/** - * Dimension independent base class for the GeometryInfo - * classes with dim=1,2,3,4. Includes all data and methods - * which can be defined in an dimension indendent way. - * - * @ingroup grid geomprimitives - * @author Ralf Hartmann, 2005 - */ -class GeometryInfoBase -{ - private: - /** - * The maximal dimension for - * which data in this class is - * implemented. - */ - static const unsigned int max_dim = 4; - - /** - * Number of faces of a cell for - * dim=max_dim. - */ - static const unsigned int faces_per_cell_max_dim = 2*max_dim; - - public: - - /** - * For each face of the reference - * cell, this field stores the - * coordinate direction in which - * its normal vector points. In - * dim dimension these - * are the 2*dim first - * entries of - * {0,0,1,1,2,2,3,3}. - * - * Remark that this is only the - * coordinate number. The actual - * direction of the normal vector - * is obtained by multiplying the - * unit vector in this direction - * with #unit_normal_orientation. - */ - static const unsigned int unit_normal_direction[faces_per_cell_max_dim]; - - /** - * Orientation of the unit normal - * vector of a face of the - * reference cell. In - * dim dimension these - * are the 2*dim first - * entries of - * {-1,1,-1,1,-1,1,-1,1}. - * - * Each value is either - * 1 or -1, - * corresponding to a normal - * vector pointing in the - * positive or negative - * coordinate direction, - * respectively. - * - * Note that this is only the - * standard orientation - * of faces. At least in 3d, - * actual faces of cells in a - * triangulation can also have - * the opposite orientation, - * depending on a flag that one - * can query from the cell it - * belongs to. For more - * information, see the - * @ref GlossFaceOrientation "glossary" - * entry on - * face orientation. - */ - static const int unit_normal_orientation[faces_per_cell_max_dim]; - - /** - * List of numbers which denotes - * which face is opposite to a - * given face. Its entries are - * { 1, 0, 3, 2, 5, 4, 7, 6}. - */ - static const unsigned int opposite_face[faces_per_cell_max_dim]; -}; - - - /** * Topological description of zero dimensional cells, @@ -217,7 +128,7 @@ struct GeometryInfo<0> * @author Wolfgang Bangerth, 1998, Ralf Hartmann, 2005 */ template -struct GeometryInfo: public GeometryInfoBase +struct GeometryInfo { /** @@ -548,6 +459,68 @@ struct GeometryInfo: public GeometryInfoBase static bool is_inside_unit_cell (const Point &p); /** + * For each face of the reference + * cell, this field stores the + * coordinate direction in which + * its normal vector points. In + * dim dimension these + * are the 2*dim first + * entries of + * {0,0,1,1,2,2,3,3}. + * + * Note that this is only the + * coordinate number. The actual + * direction of the normal vector + * is obtained by multiplying the + * unit vector in this direction + * with #unit_normal_orientation. + */ + static const unsigned int unit_normal_direction[faces_per_cell]; + + /** + * Orientation of the unit normal + * vector of a face of the + * reference cell. In + * dim dimension these + * are the 2*dim first + * entries of + * {-1,1,-1,1,-1,1,-1,1}. + * + * Each value is either + * 1 or -1, + * corresponding to a normal + * vector pointing in the + * positive or negative + * coordinate direction, + * respectively. + * + * Note that this is only the + * standard orientation + * of faces. At least in 3d, + * actual faces of cells in a + * triangulation can also have + * the opposite orientation, + * depending on a flag that one + * can query from the cell it + * belongs to. For more + * information, see the + * @ref GlossFaceOrientation "glossary" + * entry on + * face orientation. + */ + static const int unit_normal_orientation[faces_per_cell]; + + /** + * List of numbers which denotes which + * face is opposite to a given face. Its + * entries are the first 2*dim + * entries of + * { 1, 0, 3, 2, 5, 4, 7, 6}. + */ + static const unsigned int opposite_face[faces_per_cell]; + + + /** * Exception */ DeclException1 (ExcInvalidCoordinate, @@ -557,11 +530,44 @@ struct GeometryInfo: public GeometryInfoBase }; -/* -------------- declaration of explicit specializations ------------- */ #ifndef DOXYGEN + +/* -------------- declaration of explicit specializations ------------- */ + +template <> +const unsigned int GeometryInfo<1>::unit_normal_direction[faces_per_cell]; +template <> +const unsigned int GeometryInfo<2>::unit_normal_direction[faces_per_cell]; +template <> +const unsigned int GeometryInfo<3>::unit_normal_direction[faces_per_cell]; +template <> +const unsigned int GeometryInfo<4>::unit_normal_direction[faces_per_cell]; + +template <> +const int GeometryInfo<1>::unit_normal_orientation[faces_per_cell]; +template <> +const int GeometryInfo<2>::unit_normal_orientation[faces_per_cell]; +template <> +const int GeometryInfo<3>::unit_normal_orientation[faces_per_cell]; +template <> +const int GeometryInfo<4>::unit_normal_orientation[faces_per_cell]; + +template <> +const unsigned int GeometryInfo<1>::opposite_face[faces_per_cell]; +template <> +const unsigned int GeometryInfo<2>::opposite_face[faces_per_cell]; +template <> +const unsigned int GeometryInfo<3>::opposite_face[faces_per_cell]; +template <> +const unsigned int GeometryInfo<4>::opposite_face[faces_per_cell]; + + +/* -------------- inline functions ------------- */ + + template <> inline Point<1> diff --git a/deal.II/base/source/geometry_info.cc b/deal.II/base/source/geometry_info.cc index acf6d9dc92..d261495211 100644 --- a/deal.II/base/source/geometry_info.cc +++ b/deal.II/base/source/geometry_info.cc @@ -49,19 +49,72 @@ namespace internal +template <> +const unsigned int +GeometryInfo<1>::unit_normal_direction[faces_per_cell] += { 0, 0 }; + +template <> +const unsigned int +GeometryInfo<2>::unit_normal_direction[faces_per_cell] += { 0, 0, 1, 1 }; + +template <> +const unsigned int +GeometryInfo<3>::unit_normal_direction[faces_per_cell] += { 0, 0, 1, 1, 2, 2 }; + +template <> const unsigned int -GeometryInfoBase::unit_normal_direction[GeometryInfoBase::faces_per_cell_max_dim] +GeometryInfo<4>::unit_normal_direction[faces_per_cell] = { 0, 0, 1, 1, 2, 2, 3, 3 }; + + +template <> const int -GeometryInfoBase::unit_normal_orientation[GeometryInfoBase::faces_per_cell_max_dim] +GeometryInfo<1>::unit_normal_orientation[faces_per_cell] += { -1, 1 }; + +template <> +const int +GeometryInfo<2>::unit_normal_orientation[faces_per_cell] += { -1, 1, -1, 1 }; + +template <> +const int +GeometryInfo<3>::unit_normal_orientation[faces_per_cell] += { -1, 1, -1, 1, -1, 1 }; + +template <> +const int +GeometryInfo<4>::unit_normal_orientation[faces_per_cell] = { -1, 1, -1, 1, -1, 1, -1, 1 }; + + +template <> const unsigned int -GeometryInfoBase::opposite_face[GeometryInfoBase::faces_per_cell_max_dim] +GeometryInfo<1>::opposite_face[faces_per_cell] += { 1, 0 }; + +template <> +const unsigned int +GeometryInfo<2>::opposite_face[faces_per_cell] += { 1, 0, 3, 2 }; + +template <> +const unsigned int +GeometryInfo<3>::opposite_face[faces_per_cell] += { 1, 0, 3, 2, 5, 4 }; + +template <> +const unsigned int +GeometryInfo<4>::opposite_face[faces_per_cell] = { 1, 0, 3, 2, 5, 4, 7, 6 }; + template <> const unsigned int GeometryInfo<1>::ucd_to_deal[GeometryInfo<1>::vertices_per_cell] = { 0, 1}; -- 2.39.5