/usr/include/dune/grid/geometrygrid/intersection.hh is in libdune-grid-dev 2.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_GEOGRID_INTERSECTION_HH
#define DUNE_GEOGRID_INTERSECTION_HH
#include <dune/grid/geometrygrid/declaration.hh>
#include <dune/grid/geometrygrid/entitypointer.hh>
#include <dune/grid/geometrygrid/cornerstorage.hh>
namespace Dune
{
namespace GeoGrid
{
// Intersection
// ------------
template< class Grid, class HostIntersection >
class Intersection
{
typedef typename HostIntersection::Geometry HostGeometry;
typedef typename HostIntersection::LocalGeometry HostLocalGeometry;
typedef typename remove_const< Grid >::type::Traits Traits;
public:
typedef typename Traits::ctype ctype;
static const int dimension = Traits::dimension;
static const int dimensionworld = Traits::dimensionworld;
typedef typename Traits::template Codim< 0 >::Entity Entity;
typedef typename Traits::template Codim< 0 >::EntityPointer EntityPointer;
typedef typename Traits::template Codim< 1 >::Geometry Geometry;
typedef typename Traits::template Codim< 1 >::LocalGeometry LocalGeometry;
typedef typename Traits::template Codim< 0 >::Geometry ElementGeometry;
private:
typedef GeoGrid::IntersectionCoordVector< Grid > CoordVector;
typedef typename Traits::template Codim< 0 >::EntityPointerImpl EntityPointerImpl;
typedef typename Traits::template Codim< 1 >::GeometryImpl GeometryImpl;
typedef typename Traits::template Codim< 0 >::GeometryImpl ElementGeometryImpl;
public:
explicit Intersection ( const ElementGeometry &insideGeo )
: insideGeo_( Grid::getRealImplementation( insideGeo ) ),
hostIntersection_( 0 ),
geo_( grid() )
{}
Intersection ( const Intersection &other )
: insideGeo_( other.insideGeo_ ),
hostIntersection_( 0 ),
geo_( grid() )
{}
const Intersection &operator= ( const Intersection &other )
{
insideGeo_ = other.insideGeo_;
invalidate();
return *this;
}
operator bool () const { return bool( hostIntersection_ ); }
EntityPointer inside () const
{
return EntityPointerImpl( insideGeo_, hostIntersection().inside() );
}
EntityPointer outside () const
{
return EntityPointerImpl( grid(), hostIntersection().outside() );
}
bool boundary () const { return hostIntersection().boundary(); }
bool conforming () const { return hostIntersection().conforming(); }
bool neighbor () const { return hostIntersection().neighbor(); }
int boundaryId () const { return hostIntersection().boundaryId(); }
size_t boundarySegmentIndex () const
{
return hostIntersection().boundarySegmentIndex();
}
LocalGeometry geometryInInside () const
{
return hostIntersection().geometryInInside();
}
LocalGeometry geometryInOutside () const
{
return hostIntersection().geometryInOutside();
}
Geometry geometry () const
{
if( !geo_ )
{
CoordVector coords( insideGeo_, geometryInInside() );
geo_ = GeometryImpl( grid(), type(), coords );
}
return Geometry( geo_ );
}
GeometryType type () const { return hostIntersection().type(); }
int indexInInside () const
{
return hostIntersection().indexInInside();
}
int indexInOutside () const
{
return hostIntersection().indexInOutside();
}
FieldVector< ctype, dimensionworld >
integrationOuterNormal ( const FieldVector< ctype, dimension-1 > &local ) const
{
const ReferenceElement< ctype, dimension > &refElement
= ReferenceElements< ctype, dimension>::general( insideGeo_.type() );
FieldVector< ctype, dimension > x( geometryInInside().global( local ) );
const typename ElementGeometryImpl::JacobianInverseTransposed &jit = insideGeo_.jacobianInverseTransposed( x );
const FieldVector< ctype, dimension > &refNormal = refElement.integrationOuterNormal( indexInInside() );
FieldVector< ctype, dimensionworld > normal;
jit.mv( refNormal, normal );
normal *= jit.detInv();
//normal *= insideGeo_.integrationElement( x );
return normal;
}
FieldVector< ctype, dimensionworld >
outerNormal ( const FieldVector< ctype, dimension-1 > &local ) const
{
const ReferenceElement< ctype, dimension > &refElement
= ReferenceElements< ctype, dimension>::general( insideGeo_.type() );
FieldVector< ctype, dimension > x( geometryInInside().global( local ) );
const typename ElementGeometryImpl::JacobianInverseTransposed &jit = insideGeo_.jacobianInverseTransposed( x );
const FieldVector< ctype, dimension > &refNormal = refElement.integrationOuterNormal( indexInInside() );
FieldVector< ctype, dimensionworld > normal;
jit.mv( refNormal, normal );
return normal;
}
FieldVector< ctype, dimensionworld >
unitOuterNormal ( const FieldVector< ctype, dimension-1 > &local ) const
{
FieldVector< ctype, dimensionworld > normal = outerNormal( local );
normal *= (ctype( 1 ) / normal.two_norm());
return normal;
}
FieldVector< ctype, dimensionworld > centerUnitOuterNormal () const
{
const ReferenceElement< ctype, dimension-1 > &refFace
= ReferenceElements< ctype, dimension-1 >::general( type() );
return unitOuterNormal( refFace.position( 0, 0 ) );
}
const HostIntersection &hostIntersection () const
{
assert( *this );
return *hostIntersection_;
}
const Grid &grid () const { return insideGeo_.grid(); }
void invalidate ()
{
hostIntersection_ = 0;
geo_ = GeometryImpl( grid() );
}
void initialize ( const HostIntersection &hostIntersection )
{
assert( !(*this) );
hostIntersection_ = &hostIntersection;
}
private:
ElementGeometryImpl insideGeo_;
const HostIntersection *hostIntersection_;
mutable GeometryImpl geo_;
};
} // namespace GeoGrid
} // namespace Dune
#endif // #ifndef DUNE_GEOGRID_INTERSECTION_HH
|