1#ifndef DUNE_FEM_TWISTUTILITY_HH
2#define DUNE_FEM_TWISTUTILITY_HH
10#include <dune/grid/utility/hostgridaccess.hh>
13#include <dune/fem/misc/capabilities.hh>
21 template<
class Intersection >
22 struct GridIntersectionAccess;
24 template<
class Gr
id,
class IntersectionImpl >
25 struct GridIntersectionAccess<
Dune::Intersection< const Grid, IntersectionImpl > >
28 typedef IntersectionType GridIntersectionType;
30 static const GridIntersectionType &gridIntersection (
const IntersectionType &isec )
36 template<
class Intersection >
37 const typename GridIntersectionAccess< Intersection >::GridIntersectionType &
38 gridIntersection (
const Intersection &isec )
40 return GridIntersectionAccess< Intersection >::gridIntersection( isec );
47 template<
class Gr
id >
53 template<
class Intersection >
60 template<
class Intersection >
67 template<
class Intersection >
71 if( hasSingleGeometryType::v )
74 return inside ? intersection.
inside().type() : intersection.
outside().type();
104 template<
class Gr
id >
115 template<
int dim,
int dimW >
120 typedef typename LeafIntersectionIterator::Intersection LeafIntersection;
122 typedef typename LevelIntersectionIterator::Intersection LevelIntersection;
130 return grid.getTwistInInside( it );
136 return grid.getTwistInOutside( it );
141 template <
class Intersection>
159 template<
int dim,
int dimw, ALUGr
idElementType elType, ALUGr
idRefinementType refineType,
class Comm >
160 struct TwistUtility< ALUGrid< dim, dimw, elType, refineType, Comm > >
162 typedef ALUGrid< dim, dimw, elType, refineType, Comm > GridType;
166 template<
class Intersection >
169 const auto& intersection = gridIntersection( isec );
170 assert( dim == 2 ? (intersection.impl().twistInInside() == 0 ||
171 intersection.impl().twistInInside() == 1 ) :
true );
172 return intersection.impl().twistInInside();
176 template<
class Intersection >
177 static inline int twistInNeighbor(
const GridType &grid,
const Intersection& isec )
179 const auto& intersection = gridIntersection( isec );
180 assert( dim == 2 ? (intersection.impl().twistInOutside() == 0 ||
181 intersection.impl().twistInOutside() == 1 ) :
true );
182 return intersection.impl().twistInOutside();
187 template <
class Intersection>
197 TwistUtility(
const TwistUtility&);
198 TwistUtility& operator=(
const TwistUtility&);
209 struct TwistUtility< UGGrid< dim > >
211 typedef UGGrid< dim > GridType;
213 typedef typename GridType::Traits::LeafIntersectionIterator LeafIntersectionIterator;
214 typedef typename LeafIntersectionIterator::Intersection LeafIntersection;
215 typedef typename GridType::Traits::LevelIntersectionIterator LevelIntersectionIterator;
216 typedef typename LevelIntersectionIterator::Intersection LevelIntersection;
218 static int twistInSelf (
const GridType &grid,
const LeafIntersection &it );
219 static int twistInSelf (
const GridType &grid,
const LevelIntersection &it );
221 static int twistInNeighbor (
const GridType &grid,
const LeafIntersection &it );
222 static int twistInNeighbor (
const GridType &grid,
const LevelIntersection &it );
224 template<
class Intersection >
226 elementGeometry (
const Intersection &intersection,
const bool inside )
228 return (inside ? intersection.inside().type() : intersection.outside().type());
238 template<
class HostGr
id,
class CoordFunction,
class Allocator >
239 struct TwistUtility< GeometryGrid< HostGrid, CoordFunction, Allocator > >
241 typedef GeometryGrid< HostGrid, CoordFunction, Allocator > GridType;
242 typedef typename GridType::Traits::LeafIntersectionIterator LeafIntersectionIterator;
243 typedef typename LeafIntersectionIterator::Intersection LeafIntersection;
244 typedef typename GridType::Traits::LevelIntersectionIterator LevelIntersectionIterator;
245 typedef typename LevelIntersectionIterator::Intersection LevelIntersection;
248 typedef TwistUtility< HostGrid > HostTwistUtility;
253 template<
class Intersection >
254 static int twistInSelf (
const GridType &grid,
const Intersection &intersection )
256 return HostTwistUtility::twistInSelf( grid.hostGrid(), HostGridAccess::hostIntersection( intersection ) );
260 template<
class Intersection >
261 static int twistInNeighbor (
const GridType &grid,
const Intersection &intersection )
263 return HostTwistUtility::twistInNeighbor( grid.hostGrid(), HostGridAccess::hostIntersection( intersection ) );
267 template<
class Intersection >
270 return HostTwistUtility::elementGeometry( HostGridAccess::hostIntersection( intersection ), inside );
[ provides Dune::Grid ]
Definition: agrid.hh:109
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
Grid abstract base class.
Definition: grid.hh:375
static constexpr int dimension
The dimension of the grid.
Definition: grid.hh:387
GridFamily::Traits::LeafIntersectionIterator LeafIntersectionIterator
A type that is a model of Dune::IntersectionIterator which is an iterator that allows to examine,...
Definition: grid.hh:468
GridFamily::Traits::LevelIntersectionIterator LevelIntersectionIterator
A type that is a model of Dune::IntersectionIterator which is an iterator that allows to examine,...
Definition: grid.hh:475
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: intersection.hh:164
Entity outside() const
return Entity on the outside of this intersection. That is the neighboring Entity.
Definition: intersection.hh:261
Entity inside() const
return Entity on the inside of this intersection. That is the Entity where we started this.
Definition: intersection.hh:250
Various macros to work with Dune module version numbers.
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
constexpr GeometryType simplex(unsigned int dim)
Returns a GeometryType representing a simplex of dimension dim.
Definition: type.hh:453
Dune namespace.
Definition: alignedallocator.hh:13
Specialize with 'true' for if the codimension 0 entity of the grid has only one possible geometry typ...
Definition: capabilities.hh:27
TwistFreeTwistUtility provides the default implementation for twistfree grid such as Cartesian grids.
Definition: twistutility.hh:49
static int twistInSelf(const GridType &, const Intersection &)
return 0 for inner face
Definition: twistutility.hh:54
static GeometryType elementGeometry(const Intersection &intersection, const bool inside)
return geometry type of inside or outside entity
Definition: twistutility.hh:68
static int twistInNeighbor(const GridType &, const Intersection &)
return 0 for outer face
Definition: twistutility.hh:61
static int twistInNeighbor(const GridType &grid, const LeafIntersection &it)
return twist for outer face
Definition: twistutility.hh:134
static GeometryType elementGeometry(const Intersection &intersection, const bool inside)
return element geometry type of inside or outside entity
Definition: twistutility.hh:143
static int twistInSelf(const GridType &grid, const LeafIntersection &it)
return twist for inner face
Definition: twistutility.hh:128
Utility to get twist from IntersectionIterator, if provided by grid (i.e. AlbertaGrid,...
Definition: twistutility.hh:107
provides access to host grid objects from GeometryGrid
Definition: identitygrid.hh:37
A unique label for each type of element that can occur in a grid.