1 #ifndef DUNE_GEOGRID_INTERSECTION_HH
2 #define DUNE_GEOGRID_INTERSECTION_HH
17 template<
class Gr
id >
18 class LeafIntersection;
20 template<
class Gr
id >
21 class LevelIntersection;
28 template<
class Gr
id,
class HostIntersection >
31 typedef typename HostIntersection::Geometry HostGeometry;
32 typedef typename HostIntersection::LocalGeometry HostLocalGeometry;
34 typedef typename remove_const< Grid >::type::Traits Traits;
37 typedef typename Traits::ctype
ctype;
42 typedef typename Traits::template Codim< 0 >::Entity
Entity;
43 typedef typename Traits::template Codim< 0 >::EntityPointer
EntityPointer;
44 typedef typename Traits::template Codim< 1 >::Geometry
Geometry;
45 typedef typename Traits::template Codim< 1 >::LocalGeometry
LocalGeometry;
52 typedef typename Traits::template Codim< 0 >::EntityPointerImpl EntityPointerImpl;
54 typedef typename Traits::template Codim< 1 >::GeometryImpl GeometryImpl;
55 typedef typename Traits::template Codim< 0 >::GeometryImpl ElementGeometryImpl;
59 : insideGeo_(
Grid::getRealImplementation( insideGeo ) ),
60 hostIntersection_( 0 ),
65 : insideGeo_( other.insideGeo_ ),
66 hostIntersection_( 0 ),
72 insideGeo_ = other.insideGeo_;
77 operator bool ()
const {
return bool( hostIntersection_ ); }
117 geo_ = GeometryImpl(
grid(),
type(), coords );
139 FieldVector< ctype, dimensionworld >
142 const GenericReferenceElement< ctype, dimension > &refElement
143 = GenericReferenceElements< ctype, dimension>::general( insideGeo_.type() );
146 const typename ElementGeometryImpl::JacobianInverseTransposed &jit = insideGeo_.jacobianInverseTransposed( x );
147 const FieldVector< ctype, dimension > &refNormal = refElement.volumeOuterNormal(
indexInInside() );
149 FieldVector< ctype, dimensionworld > normal;
150 jit.mv( refNormal, normal );
151 normal *=
ctype( 1 ) / jit.det();
156 FieldVector< ctype, dimensionworld >
157 outerNormal (
const FieldVector< ctype, dimension-1 > &local )
const
159 const GenericReferenceElement< ctype, dimension > &refElement
160 = GenericReferenceElements< ctype, dimension>::general( insideGeo_.type() );
163 const typename ElementGeometryImpl::JacobianInverseTransposed &jit = insideGeo_.jacobianInverseTransposed( x );
164 const FieldVector< ctype, dimension > &refNormal = refElement.volumeOuterNormal(
indexInInside() );
166 FieldVector< ctype, dimensionworld > normal;
167 jit.mv( refNormal, normal );
171 FieldVector< ctype, dimensionworld >
174 FieldVector< ctype, dimensionworld > normal =
outerNormal( local );
175 normal *= (
ctype( 1 ) / normal.two_norm());
182 = GenericReferenceElements< ctype, dimension-1 >::general(
type() );
189 return *hostIntersection_;
192 const Grid &
grid ()
const {
return insideGeo_.grid(); }
196 hostIntersection_ = 0;
197 geo_ = GeometryImpl(
grid() );
207 ElementGeometryImpl insideGeo_;
208 const HostIntersection *hostIntersection_;
209 mutable GeometryImpl geo_;
217 template<
class HostGr
id,
class CoordFunction,
class Allocator >
218 class LeafIntersection< const
GeometryGrid< HostGrid, CoordFunction, Allocator > >
220 < const GeometryGrid< HostGrid, CoordFunction, Allocator >,
221 typename HostGrid::Traits::LeafIntersection >
224 typedef typename HostGrid::Traits::LeafIntersection HostIntersection;
241 template<
class HostGr
id,
class CoordFunction,
class Allocator >
242 class LevelIntersection< const
GeometryGrid< HostGrid, CoordFunction, Allocator > >
244 < const GeometryGrid< HostGrid, CoordFunction, Allocator >,
245 typename HostGrid::Traits::LevelIntersection >
248 typedef typename HostGrid::Traits::LevelIntersection HostIntersection;
264 #endif // #ifndef DUNE_GEOGRID_INTERSECTION_HH