5#ifndef DUNE_GEOGRID_INTERSECTION_HH
6#define DUNE_GEOGRID_INTERSECTION_HH
20 template<
class Gr
id,
class HostIntersection >
23 typedef typename HostIntersection::Geometry HostGeometry;
24 typedef typename HostIntersection::LocalGeometry HostLocalGeometry;
26 typedef typename std::remove_const< Grid >::type::Traits Traits;
29 typedef typename Traits::ctype
ctype;
34 typedef typename Traits::template Codim< 0 >::Entity
Entity;
35 typedef typename Traits::template Codim< 1 >::Geometry
Geometry;
36 typedef typename Traits::template Codim< 1 >::LocalGeometry
LocalGeometry;
43 typedef typename Traits::template Codim< 0 >::EntityImpl EntityImpl;
45 typedef typename Traits::template Codim< 1 >::GeometryImpl GeometryImpl;
46 typedef typename Traits::template Codim< 0 >::GeometryImpl ElementGeometryImpl;
55 , insideGeo_ ( insideGeo )
61 , insideGeo_ ( insideGeo )
67 return hostIntersection_ == other.hostIntersection_;
70 explicit operator bool ()
const {
return bool( hostIntersection_ ); }
108 geo_ = GeometryImpl(
grid(),
type(), coords );
125 FieldVector< ctype, dimensionworld >
131 auto refElement = referenceElement< ctype, dimension >( insideGeo_.type() );
133 FieldVector< ctype, dimension > x( geoInInside.global( local ) );
134 const typename ElementGeometryImpl::JacobianInverseTransposed &jit = insideGeo_.jacobianInverseTransposed( x );
135 FieldVector< ctype, dimension > refNormal = refElement.integrationOuterNormal( idxInInside );
137 FieldVector< ctype, dimensionworld > normal;
138 jit.mv( refNormal, normal );
140 normal *= geoInInside.volume() / refElement.template geometry< 1 >( idxInInside ).volume();
141 normal *= jit.detInv();
146 FieldVector< ctype, dimensionworld >
147 outerNormal (
const FieldVector< ctype, dimension-1 > &local )
const
149 auto refElement = referenceElement< ctype, dimension >( insideGeo_.type() );
152 const typename ElementGeometryImpl::JacobianInverseTransposed &jit = insideGeo_.jacobianInverseTransposed( x );
153 FieldVector< ctype, dimension > refNormal = refElement.integrationOuterNormal(
indexInInside() );
155 FieldVector< ctype, dimensionworld > normal;
156 jit.mv( refNormal, normal );
160 FieldVector< ctype, dimensionworld >
163 FieldVector< ctype, dimensionworld > normal =
outerNormal( local );
164 normal *= (
ctype( 1 ) / normal.two_norm());
176 return hostIntersection_;
179 const Grid &
grid ()
const {
return insideGeo_.grid(); }
182 HostIntersection hostIntersection_;
183 ElementGeometryImpl insideGeo_;
184 mutable GeometryImpl geo_;
Include standard header files.
Definition: agrid.hh:60
auto referenceElement(const Geometry< mydim, cdim, GridImp, GeometryImp > &geo) -> decltype(referenceElement(geo, geo.impl()))
Definition: common/geometry.hh:558
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
Grid abstract base class.
Definition: common/grid.hh:375
Definition: cornerstorage.hh:123
Definition: geometrygrid/intersection.hh:22
FieldVector< ctype, dimensionworld > integrationOuterNormal(const FieldVector< ctype, dimension-1 > &local) const
Definition: geometrygrid/intersection.hh:126
Traits::ctype ctype
Definition: geometrygrid/intersection.hh:29
GeometryType type() const
Definition: geometrygrid/intersection.hh:113
LocalGeometry geometryInInside() const
Definition: geometrygrid/intersection.hh:93
Geometry geometry() const
Definition: geometrygrid/intersection.hh:103
bool boundary() const
Definition: geometrygrid/intersection.hh:82
Traits::template Codim< 1 >::Geometry Geometry
Definition: geometrygrid/intersection.hh:35
Intersection()
Definition: geometrygrid/intersection.hh:50
bool neighbor() const
Definition: geometrygrid/intersection.hh:86
size_t boundarySegmentIndex() const
Definition: geometrygrid/intersection.hh:88
FieldVector< ctype, dimensionworld > outerNormal(const FieldVector< ctype, dimension-1 > &local) const
Definition: geometrygrid/intersection.hh:147
FieldVector< ctype, dimensionworld > unitOuterNormal(const FieldVector< ctype, dimension-1 > &local) const
Definition: geometrygrid/intersection.hh:161
Intersection(HostIntersection &&hostIntersection, const ElementGeometryImpl &insideGeo)
Definition: geometrygrid/intersection.hh:59
Traits::template Codim< 0 >::Geometry ElementGeometry
Definition: geometrygrid/intersection.hh:38
Intersection(const HostIntersection &hostIntersection, const ElementGeometryImpl &insideGeo)
Definition: geometrygrid/intersection.hh:53
Traits::template Codim< 1 >::LocalGeometry LocalGeometry
Definition: geometrygrid/intersection.hh:36
static const int dimensionworld
Definition: geometrygrid/intersection.hh:32
const HostIntersection & hostIntersection() const
Definition: geometrygrid/intersection.hh:174
int indexInOutside() const
Definition: geometrygrid/intersection.hh:120
const Grid & grid() const
Definition: geometrygrid/intersection.hh:179
bool equals(const Intersection &other) const
Definition: geometrygrid/intersection.hh:65
Traits::template Codim< 0 >::Entity Entity
Definition: geometrygrid/intersection.hh:34
bool conforming() const
Definition: geometrygrid/intersection.hh:84
Entity outside() const
Definition: geometrygrid/intersection.hh:77
int indexInInside() const
Definition: geometrygrid/intersection.hh:115
FieldVector< ctype, dimensionworld > centerUnitOuterNormal() const
Definition: geometrygrid/intersection.hh:168
static const int dimension
Definition: geometrygrid/intersection.hh:31
Entity inside() const
Definition: geometrygrid/intersection.hh:72
LocalGeometry geometryInOutside() const
Definition: geometrygrid/intersection.hh:98