1#ifndef DUNE_FEM_GRIDPART_GEOGRIDPART_INTERSECTION_HH
2#define DUNE_FEM_GRIDPART_GEOGRIDPART_INTERSECTION_HH
7#include <dune/fem/gridpart/geogridpart/cornerstorage.hh>
18 template<
class Gr
idFamily >
21 typedef typename std::remove_const< GridFamily >::type::Traits Traits;
24 typedef typename std::remove_const< GridFamily >::type::ctype ctype;
26 static const int dimension = std::remove_const< GridFamily >::type::dimension;
27 static const int dimensionworld = std::remove_const< GridFamily >::type::dimensionworld;
29 typedef typename Traits::template Codim< 0 >::Entity Entity;
30 typedef typename Traits::template Codim< 0 >::Geometry ElementGeometry;
31 typedef typename Traits::template Codim< 1 >::Geometry Geometry;
32 typedef typename Traits::template Codim< 1 >::LocalGeometry LocalGeometry;
34 typedef typename Traits::CoordFunctionType CoordFunctionType;
38 typedef typename ElementGeometry::Implementation ElementGeometryImplType;
41 typedef typename Traits::HostGridPartType HostGridPartType;
42 typedef typename HostGridPartType::IntersectionType HostIntersectionType;
44 typedef GeoIntersectionCoordVector< GridFamily > CoordVectorType;
47 GeoIntersection (
const CoordFunctionType &coordFunction,
const ElementGeometry &insideGeo, HostIntersectionType hostIntersection )
48 : coordFunction_( &coordFunction ),
49 insideGeo_( insideGeo.impl() ),
50 hostIntersection_(
std::move( hostIntersection ) )
54 : coordFunction_( nullptr ),
59 Entity inside ()
const
61 return Entity( EntityImplType( coordFunction(), hostIntersection().inside() ) );
64 Entity outside ()
const
66 return Entity( EntityImplType( coordFunction(), hostIntersection().outside() ) );
69 bool boundary ()
const
71 return hostIntersection().boundary();
76 return hostIntersection().conforming();
79 bool neighbor ()
const
81 return hostIntersection().neighbor();
84 int boundaryId ()
const
86 return hostIntersection().boundaryId();
89 size_t boundarySegmentIndex ()
const
91 return hostIntersection().boundarySegmentIndex();
94 LocalGeometry geometryInInside ()
const
96 return hostIntersection().geometryInInside();
99 LocalGeometry geometryInOutside ()
const
101 return hostIntersection().geometryInOutside();
104 Geometry geometry ()
const
106 const LocalGeometry &localGeo = geometryInInside();
107 CoordVectorType coords( insideGeo_, localGeo );
108 return Geometry( GeometryImplType( type(), coords ) );
113 return hostIntersection().type();
116 int indexInInside ()
const
118 return hostIntersection().indexInInside();
121 int indexInOutside ()
const
123 return hostIntersection().indexInOutside();
126 FieldVector< ctype, dimensionworld >
127 integrationOuterNormal (
const FieldVector< ctype, dimension-1 > &local )
const
129 auto refElement = referenceElement< ctype, dimension>( insideGeo_.type() );
131 FieldVector< ctype, dimension > x( geometryInInside().global( local ) );
132 typedef typename ElementGeometryImplType::JacobianInverseTransposed JacobianInverseTransposed;
133 const JacobianInverseTransposed &jit = insideGeo_.jacobianInverseTransposed( x );
134 const FieldVector< ctype, dimension > &refNormal = refElement.integrationOuterNormal( indexInInside() );
136 FieldVector< ctype, dimensionworld > normal;
137 jit.mv( refNormal, normal );
138 normal *= ctype( 1 ) / jit.det();
142 FieldVector< ctype, dimensionworld >
143 outerNormal (
const FieldVector< ctype, dimension-1 > &local )
const
145 auto refElement = referenceElement< ctype, dimension>( insideGeo_.type() );
147 FieldVector< ctype, dimension > x( geometryInInside().global( local ) );
148 typedef typename ElementGeometryImplType::JacobianInverseTransposed JacobianInverseTransposed;
149 const JacobianInverseTransposed &jit = insideGeo_.jacobianInverseTransposed( x );
150 const FieldVector< ctype, dimension > &refNormal = refElement.integrationOuterNormal( indexInInside() );
152 FieldVector< ctype, dimensionworld > normal;
153 jit.mv( refNormal, normal );
157 FieldVector< ctype, dimensionworld >
158 unitOuterNormal (
const FieldVector< ctype, dimension-1 > &local )
const
160 FieldVector< ctype, dimensionworld > normal = outerNormal( local );
161 normal *= (ctype( 1 ) / normal.two_norm());
165 FieldVector< ctype, dimensionworld > centerUnitOuterNormal ()
const
168 return unitOuterNormal( refFace.position( 0, 0 ) );
171 const CoordFunctionType &coordFunction ()
const
173 assert( coordFunction_ );
174 return *coordFunction_;
177 const HostIntersectionType &hostIntersection ()
const
179 return hostIntersection_;
183 const CoordFunctionType *coordFunction_ =
nullptr;
184 ElementGeometryImplType insideGeo_;
185 HostIntersectionType hostIntersection_;
EntityImp< cd, dim, GridImp > Implementation
type of underlying implementation
Definition: entity.hh:73
GeometryImp< mydim, cdim, GridImp > Implementation
type of underlying implementation
Definition: geometry.hh:78
@ conforming
Output conforming data.
Definition: common.hh:73
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
unspecified value type referenceElement(T &&... t)
Returns a reference element for the objects t....
Dune namespace.
Definition: alignedallocator.hh:13