1 #ifndef DUNE_FEM_TWISTUTILITY_HH 2 #define DUNE_FEM_TWISTUTILITY_HH 6 #include <dune/common/version.hh> 7 #include <dune/geometry/type.hh> 8 #include <dune/geometry/genericgeometry/topologytypes.hh> 10 #include <dune/grid/utility/hostgridaccess.hh> 25 template<
class Gr
id >
31 template<
class Intersection >
32 static int twistInSelf (
const GridType &,
const Intersection & )
38 template<
class Intersection >
45 template<
class Intersection >
46 static GeometryType
elementGeometry (
const Intersection &intersection,
const bool inside )
48 typedef Dune::Capabilities::hasSingleGeometryType< GridType > hasSingleGeometryType;
49 if( hasSingleGeometryType::v )
50 return GeometryType( hasSingleGeometryType::topologyId, GridType::dimension );
52 return inside ?
make_entity( intersection.inside() ).type() :
make_entity( intersection.outside() ).type();
82 template<
class Gr
id >
91 template<
int dimw,
class CoordCont >
101 template<
int dim,
int dimworld,
class ctype >
124 template<
int dim,
int dimW >
128 typedef typename GridType::Traits::LeafIntersectionIterator LeafIntersectionIterator;
129 typedef typename LeafIntersectionIterator::Intersection LeafIntersection;
130 typedef typename GridType::Traits::LevelIntersectionIterator LevelIntersectionIterator;
131 typedef typename LevelIntersectionIterator::Intersection LevelIntersection;
133 static const int dimension = GridType::dimension;
137 static int twistInSelf (
const GridType &grid,
const LeafIntersection &it )
139 return grid.getTwistInInside( it );
143 static int twistInNeighbor (
const GridType &grid,
const LeafIntersection &it )
145 return grid.getTwistInOutside( it );
150 template <
class Intersection>
151 static inline GeometryType
155 return GeometryType( GenericGeometry::SimplexTopology< dimension >::type::id,
169 template<
int dim,
int dimw >
172 typedef ALUSimplexGrid< dim, dimw >
GridType;
174 typedef typename GridType::Traits::LeafIntersectionIterator
175 LeafIntersectionIterator;
176 typedef typename LeafIntersectionIterator::Intersection LeafIntersection;
178 typedef typename GridType::Traits::LevelIntersectionIterator
179 LevelIntersectionIterator;
180 typedef typename LevelIntersectionIterator::Intersection LevelIntersection;
182 static const int dimension = GridType::dimension;
186 template <
class Intersection>
187 static inline int twistInSelf(
const GridType & grid,
188 const Intersection& intersection)
190 return grid.getRealIntersection( intersection ).twistInInside();
194 template <
class Intersection>
196 const Intersection& intersection)
198 return grid.getRealIntersection( intersection ).twistInOutside();
203 template <
class Intersection>
204 static inline GeometryType
208 return GeometryType( GenericGeometry::SimplexTopology< dim >::type::id,
218 template<
int dim,
int dimw >
221 typedef ALUCubeGrid< dim, dimw >
GridType;
222 typedef typename GridType::Traits::LeafIntersectionIterator LeafIntersectionIterator;
223 typedef typename LeafIntersectionIterator::Intersection LeafIntersection;
224 typedef typename GridType::Traits::LevelIntersectionIterator LevelIntersectionIterator;
225 typedef typename LevelIntersectionIterator::Intersection LevelIntersection;
229 template <
class Intersection>
230 static inline int twistInSelf(
const GridType & grid,
231 const Intersection& intersection)
233 return grid.getRealIntersection( intersection ).twistInInside();
237 template <
class Intersection>
239 const Intersection& intersection)
241 return grid.getRealIntersection( intersection ).twistInOutside();
246 template <
class Intersection>
247 static inline GeometryType
251 return GeometryType( GenericGeometry::CubeTopology< dim >::type::id,
262 template<
int dim,
int dimw >
265 typedef ALUConformGrid< dim, dimw >
GridType;
266 typedef typename GridType::Traits::LeafIntersectionIterator LeafIntersectionIterator;
267 typedef typename LeafIntersectionIterator::Intersection LeafIntersection;
268 typedef typename GridType::Traits::LevelIntersectionIterator LevelIntersectionIterator;
269 typedef typename LevelIntersectionIterator::Intersection LevelIntersection;
273 static inline int twistInSelf(
const GridType & grid,
const LeafIntersection& intersection)
275 return grid.getRealIntersection( intersection ).twistInInside();
279 static inline int twistInNeighbor(
const GridType &grid,
const LeafIntersection& intersection )
281 return grid.getRealIntersection( intersection ).twistInOutside();
286 template <
class Intersection>
287 static inline GeometryType
291 return GeometryType( GenericGeometry::SimplexTopology< dim >::type::id,
299 #endif // #if HAVE_ALUGRID 301 #if HAVE_ALUGRID || HAVE_DUNE_ALUGRID 304 template<
int dim,
int dimw, ALUGr
idElementType elType, ALUGr
idRefinementType refineType,
class Comm >
305 struct TwistUtility< ALUGrid< dim, dimw, elType, refineType, Comm > >
307 typedef ALUGrid< dim, dimw, elType, refineType, Comm >
GridType;
308 typedef typename GridType::Traits::LeafIntersectionIterator LeafIntersectionIterator;
309 typedef typename LeafIntersectionIterator::Intersection LeafIntersection;
310 typedef typename GridType::Traits::LevelIntersectionIterator LevelIntersectionIterator;
311 typedef typename LevelIntersectionIterator::Intersection LevelIntersection;
315 static inline int twistInSelf(
const GridType & grid,
const LeafIntersection& intersection)
317 return (dim == 2) ?
std::abs(grid.getRealIntersection( intersection ).twistInInside()) : grid.getRealIntersection( intersection ).twistInInside();
321 static inline int twistInNeighbor(
const GridType &grid,
const LeafIntersection& intersection )
323 return (dim == 2) ?
std::abs(grid.getRealIntersection( intersection ).twistInOutside()) : grid.getRealIntersection( intersection ).twistInOutside();
328 template <
class Intersection>
329 static inline GeometryType
333 return GeometryType( Dune::Capabilities::hasSingleGeometryType< GridType > :: topologyId,
341 #endif // #if HAVE_ALUGRID || HAVE_DUNE_ALUGRID 353 typedef typename GridType::Traits::LeafIntersectionIterator LeafIntersectionIterator;
354 typedef typename LeafIntersectionIterator::Intersection LeafIntersection;
355 typedef typename GridType::Traits::LevelIntersectionIterator LevelIntersectionIterator;
356 typedef typename LevelIntersectionIterator::Intersection LevelIntersection;
358 static int twistInSelf (
const GridType &grid,
const LeafIntersection &it );
359 static int twistInSelf (
const GridType &grid,
const LevelIntersection &it );
361 static int twistInNeighbor (
const GridType &grid,
const LeafIntersection &it );
362 static int twistInNeighbor (
const GridType &grid,
const LevelIntersection &it );
364 template<
class Intersection >
366 elementGeometry (
const Intersection &intersection,
const bool inside )
368 return (inside ? intersection.inside().type() : intersection.outside().type());
371 #endif // #ifdef ENABLE_UG 378 template<
class HostGr
id,
class CoordFunction,
class Allocator >
379 struct TwistUtility< GeometryGrid< HostGrid, CoordFunction, Allocator > >
381 typedef GeometryGrid< HostGrid, CoordFunction, Allocator >
GridType;
393 template<
class Intersection >
394 static int twistInSelf (
const GridType &grid,
const Intersection &intersection )
396 return HostTwistUtility::twistInSelf( grid.hostGrid(), HostGridAccess::hostIntersection( intersection ) );
400 template<
class Intersection >
403 return HostTwistUtility::twistInNeighbor( grid.hostGrid(), HostGridAccess::hostIntersection( intersection ) );
407 template<
class Intersection >
410 return HostTwistUtility::elementGeometry( HostGridAccess::hostIntersection( intersection ), inside );
418 #endif // #ifndef DUNE_FEM_TWISTUTILITY_HH GeometryGrid< HostGrid, CoordFunction, Allocator > GridType
Definition: twistutility.hh:381
Definition: griddeclaration.hh:41
Definition: griddeclaration.hh:38
Utility to get twist from IntersectionIterator, if provided by grid (i.e. AlbertaGrid, ALUGrid) otherwise return default values (correct for YASP/SGRID).
Definition: twistutility.hh:83
static GeometryType elementGeometry(const Intersection &intersection, bool inside)
return element geometry type of inside or outside entity
Definition: twistutility.hh:408
Definition: griddeclaration.hh:44
static GeometryType elementGeometry(const Intersection &intersection, const bool inside)
return geometry type of inside or outside entity
Definition: twistutility.hh:46
static int twistInSelf(const GridType &, const Intersection &)
return 0 for inner face
Definition: twistutility.hh:32
GridType::Traits::LevelIntersectionIterator LevelIntersectionIterator
Definition: twistutility.hh:384
Definition: boundaryidprovider.hh:21
static int twistInNeighbor(const GridType &grid, const Intersection &intersection)
return twist for outer face
Definition: twistutility.hh:401
static int twistInSelf(const GridType &grid, const Intersection &intersection)
return twist for inner face
Definition: twistutility.hh:394
Double abs(const Double &a)
Definition: double.hh:860
Dune::EntityPointer< Grid, Implementation >::Entity make_entity(const Dune::EntityPointer< Grid, Implementation > &entityPointer)
Definition: compatibility.hh:23
Definition: griddeclaration.hh:35
Definition: coordinate.hh:4
Grid GridType
Definition: twistutility.hh:28
GridType::Traits::LeafIntersectionIterator LeafIntersectionIterator
Definition: twistutility.hh:382
static int twistInNeighbor(const GridType &, const Intersection &)
return 0 for outer face
Definition: twistutility.hh:39
LevelIntersectionIterator::Intersection LevelIntersection
Definition: twistutility.hh:385
LeafIntersectionIterator::Intersection LeafIntersection
Definition: twistutility.hh:383
TwistFreeTwistUtility provides the default implementation for twistfree grid such as Cartesian grids...
Definition: twistutility.hh:26