/usr/include/dune/grid/common/refinement/base.cc is in libdune-grid-dev 2.2.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=8 sw=2 sts=2:
#ifndef DUNE_GRID_COMMON_REFINEMENT_BASE_CC
#define DUNE_GRID_COMMON_REFINEMENT_BASE_CC
// This file is part of DUNE, a Distributed and Unified Numerics Environment
// This file is copyright (C) 2005 Jorrit Fahlke <jorrit@jorrit.de>
// This file is licensed under version 2 of the GNU General Public License,
// with a special "runtime exception." See COPYING at the top of the source
// tree for the full licence.
/*! @file
@brief This file contains the parts independent of a particular @ref
Refinement implementation.
@verbatim
$Id: base.cc 8046 2012-05-06 14:56:50Z sander $
@endverbatim
*/
#include <dune/geometry/type.hh>
#include <dune/geometry/genericgeometry/topologytypes.hh>
namespace Dune {
/*! @addtogroup Refinement Refinement
@{
*/
//! @brief This namespace contains the implementation of @ref
//! Refinement.
namespace RefinementImp {
// /////////////////////////////////
//
// Declaration of RefinementImp::Traits
//
#ifdef DOXYGEN
// This is just for Doxygen
/*!
@brief Mapping from geometryType, CoordType and coerceTo to a
particular @ref Refinement implementation.
@tparam topologyId The topology id of the element to refine
@tparam CoordType The C++ type of the coordinates
@tparam coerceToId The topologyId of the subelements
@tparam dimension The dimension of the refinement.
@tparam Dummy Dummy parameter which can be used for SFINAE, should
always be void.
Each @ref Refinement implementation has to define one or more
specialisations of this struct to declare what it implements.
Template class Refinement uses this struct to know which
implementation it should inherit from. Since non-type template
arguments of specializations may not involve template parameters, it is
often impossible to specify the specialization for all cases directly.
As the workaround, the template parameter \c Dummy can be used for
SFINAE with \ref enable_if.
Each specialisation should contain a single member typedef Imp,
e.g.:
@code
template<class CoordType>
struct Traits<sphereTopologyId, CoordType, GenericGeometry::CubeToplogy<2>::id, 2>
{
typedef SquaringTheCircle::Refinement Imp;
};
@endcode
*/
template<unsigned topologyId, class CoordType,
unsigned coerceToId, int dimension, class Dummy = void>
struct Traits
{
//! The implementation this specialisation maps to
typedef SquaringTheCircle::Refinement Imp;
};
#else // !DOXYGEN
// Doxygen won't see this
template< unsigned topologyId
, class CoordType
, unsigned coerceToId
, int dimension
, class = void
>
struct Traits;
#endif // !DOXYGEN
} // namespace RefinementImp
/////////////////
///
/// Static Refinement
///
/*! @brief Wrap each @ref Refinement implementation to get a
consistent interface
@tparam topologyId The topology id of the element to refine
@tparam CoordType The C++ type of the coordinates
@tparam coerceToId The topology id of the subelements
@tparam dimension The dimension of the refinement.
*/
template<
unsigned topologyId
, class CoordType
, unsigned coerceToId
, int dimension_
>
class StaticRefinement
: public RefinementImp::Traits< topologyId
, CoordType
, coerceToId
, dimension_ >::Imp
{
public:
#ifdef DOXYGEN
/*! @brief The Codim struct inherited from the @ref Refinement implementation
@tparam codimension There is a different struct Codim for each codimension
*/
template<int codimension>
struct Codim
{
/*! @brief The SubEntityIterator for each codim
This is @em some sort of type, not necessarily a typedef
*/
typedef SubEntityIterator;
};
//! The VertexIterator of the Refinement
typedef Codim<dimension>::SubEntityIterator VertexIterator;
//! The ElementIterator of the Refinement
typedef Codim<0>::SubEntityIterator ElementIterator;
/*! @brief The CoordVector of the Refinement
This is always a typedef to a FieldVector
*/
typedef CoordVector;
/*! @brief The IndexVector of the Refinement
This is always a typedef to a FieldVector
*/
typedef IndexVector;
//! Get the number of Vertices
static int nVertices(int level);
//! Get a VertexIterator
static VertexIterator vBegin(int level);
//! Get a VertexIterator
static VertexIterator vEnd(int level);
//! Get the number of Elements
static int nElements(int level);
//! Get an ElementIterator
static ElementIterator eBegin(int level);
//! Get an ElementIterator
static ElementIterator eEnd(int level);
#endif //DOXYGEN
typedef typename RefinementImp::Traits< topologyId, CoordType, coerceToId, dimension_>::Imp RefinementImp;
using RefinementImp::dimension;
using RefinementImp::Codim;
using typename RefinementImp::VertexIterator;
using typename RefinementImp::CoordVector;
using typename RefinementImp::ElementIterator;
using typename RefinementImp::IndexVector;
};
namespace RefinementImp {
#ifndef DOXYGEN
template<GeometryType::BasicType basicType, unsigned dim>
struct BasicTypeToTopologyId;
template<unsigned dim>
struct BasicTypeToTopologyId<GeometryType::simplex, dim> {
static const unsigned value =
GenericGeometry::SimplexTopology<dim>::type::id;
};
template<unsigned dim>
struct BasicTypeToTopologyId<GeometryType::cube, dim> {
static const unsigned value =
GenericGeometry::CubeTopology<dim>::type::id;
};
template<>
struct BasicTypeToTopologyId<GeometryType::pyramid, 3> {
static const unsigned value = GenericGeometry::Pyramid<
GenericGeometry::Prism<
GenericGeometry::Pyramid<GenericGeometry::Point>
>
>::id;
};
template<>
struct BasicTypeToTopologyId<GeometryType::prism, 3> {
static const unsigned value = GenericGeometry::Prism<
GenericGeometry::Pyramid<
GenericGeometry::Pyramid<GenericGeometry::Point>
>
>::id;
};
#endif // !DOXYGEN
} // namespace RefinementImp
/*! @} */
} // namespace Dune
#endif //DUNE_GRID_COMMON_REFINEMENT_BASE_CC
|