/usr/include/dune/grid/identitygrid/identitygridintersections.hh is in libdune-grid-dev 2.5.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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_IDENTITYGRID_INTERSECTIONS_HH
#define DUNE_IDENTITYGRID_INTERSECTIONS_HH
#include "identitygridleafiterator.hh"
#include <dune/grid/identitygrid/identitygridentity.hh>
/** \file
* \brief The IdentityGridLeafIntersection and IdentityGridLevelIntersection classes
*/
namespace Dune {
// External forward declarations
template< class Grid >
struct HostGridAccess;
/** \brief An intersection with a leaf neighbor element
* \ingroup IdentityGrid
* Mesh entities of codimension 0 ("elements") allow to visit all neighbors, where
* a neighbor is an entity of codimension 0 which has a common entity of codimension 1
* These neighbors are accessed via a IntersectionIterator. This allows the implement
* non-matching meshes. The number of neighbors may be different from the number
* of an element!
*/
template<class GridImp>
class IdentityGridLeafIntersection
{
friend class IdentityGridLeafIntersectionIterator<GridImp>;
friend struct HostGridAccess< typename std::remove_const< GridImp >::type >;
enum {dim=GridImp::dimension};
enum {dimworld=GridImp::dimensionworld};
// The type used to store coordinates
typedef typename GridImp::ctype ctype;
typedef typename GridImp::HostGridType::LeafGridView::Intersection HostLeafIntersection;
public:
typedef typename GridImp::template Codim<1>::Geometry Geometry;
typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
typedef typename GridImp::template Codim<0>::Entity Entity;
typedef FieldVector<ctype, dimworld> NormalVector;
IdentityGridLeafIntersection()
{}
IdentityGridLeafIntersection(const GridImp* identityGrid,
const HostLeafIntersection& hostIntersection)
: identityGrid_(identityGrid)
, hostIntersection_(hostIntersection)
{}
IdentityGridLeafIntersection(const GridImp* identityGrid,
HostLeafIntersection&& hostIntersection)
: identityGrid_(identityGrid)
, hostIntersection_(std::move(hostIntersection))
{}
bool equals(const IdentityGridLeafIntersection& other) const
{
return hostIntersection_ == other.hostIntersection_;
}
//! return Entity on the inside of this intersection
//! (that is the Entity where we started this Iterator)
Entity inside() const {
return IdentityGridEntity<0,dim,GridImp>(identityGrid_,hostIntersection_.inside());
}
//! return Entity on the outside of this intersection
//! (that is the neighboring Entity)
Entity outside() const {
return IdentityGridEntity<0,dim,GridImp>(identityGrid_,hostIntersection_.outside());
}
//! return true if intersection is with boundary.
bool boundary () const {
return hostIntersection_.boundary();
}
/** \brief Return unit outer normal (length == 1)
*
* The returned vector is the normal at the center() of the
* intersection's geometry.
* It is scaled to have unit length. */
NormalVector centerUnitOuterNormal () const {
return hostIntersection_.centerUnitOuterNormal();
}
//! return true if across the edge an neighbor on this level exists
bool neighbor () const {
return hostIntersection_.neighbor();
}
//! return information about the Boundary
int boundaryId () const {
return hostIntersection_.boundaryId();
}
//! return the boundary segment index
size_t boundarySegmentIndex() const {
return hostIntersection_.boundarySegmentIndex();
}
//! Return true if this is a conforming intersection
bool conforming () const {
return hostIntersection_.conforming();
}
//! Geometry type of an intersection
GeometryType type () const {
return hostIntersection_.type();
}
//! intersection of codimension 1 of this neighbor with element where
//! iteration started.
//! Here returned element is in LOCAL coordinates of the element
//! where iteration started.
LocalGeometry geometryInInside () const
{
return LocalGeometry( hostIntersection_.geometryInInside() );
}
//! intersection of codimension 1 of this neighbor with element where iteration started.
//! Here returned element is in LOCAL coordinates of neighbor
LocalGeometry geometryInOutside () const
{
return LocalGeometry( hostIntersection_.geometryInOutside() );
}
//! intersection of codimension 1 of this neighbor with element where iteration started.
//! Here returned element is in GLOBAL coordinates of the element where iteration started.
Geometry geometry () const
{
return Geometry( hostIntersection_.geometry() );
}
//! local number of codim 1 entity in self where intersection is contained in
int indexInInside () const {
return hostIntersection_.indexInInside();
}
//! local number of codim 1 entity in neighbor where intersection is contained
int indexInOutside () const {
return hostIntersection_.indexInOutside();
}
//! return outer normal
FieldVector<ctype, GridImp::dimensionworld> outerNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const {
return hostIntersection_.outerNormal(local);
}
//! return outer normal multiplied by the integration element
FieldVector<ctype, GridImp::dimensionworld> integrationOuterNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const {
return hostIntersection_.integrationOuterNormal(local);
}
//! return unit outer normal
FieldVector<ctype, GridImp::dimensionworld> unitOuterNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const {
return hostIntersection_.unitOuterNormal(local);
}
private:
//**********************************************************
// private methods
//**********************************************************
const GridImp* identityGrid_;
HostLeafIntersection hostIntersection_;
};
//! \todo Please doc me !
template<class GridImp>
class IdentityGridLevelIntersection
{
friend class IdentityGridLevelIntersectionIterator<GridImp>;
friend struct HostGridAccess< typename std::remove_const< GridImp >::type >;
enum {dim=GridImp::dimension};
enum {dimworld=GridImp::dimensionworld};
// The type used to store coordinates
typedef typename GridImp::ctype ctype;
typedef typename GridImp::HostGridType::LevelGridView::Intersection HostLevelIntersection;
public:
typedef typename GridImp::template Codim<1>::Geometry Geometry;
typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
typedef typename GridImp::template Codim<0>::Entity Entity;
typedef FieldVector<ctype, dimworld> NormalVector;
IdentityGridLevelIntersection()
{}
IdentityGridLevelIntersection(const GridImp* identityGrid,
const HostLevelIntersection& hostIntersection)
: identityGrid_(identityGrid)
, hostIntersection_(hostIntersection)
{}
IdentityGridLevelIntersection(const GridImp* identityGrid,
HostLevelIntersection&& hostIntersection)
: identityGrid_(identityGrid)
, hostIntersection_(std::move(hostIntersection))
{}
bool equals(const IdentityGridLevelIntersection& other) const
{
return hostIntersection_ == other.hostIntersection_;
}
//! return Entity on the inside of this intersection
//! (that is the Entity where we started this Iterator)
Entity inside() const {
return IdentityGridEntity<0,dim,GridImp>(identityGrid_,hostIntersection_.inside());
}
//! return Entity on the outside of this intersection
//! (that is the neighboring Entity)
Entity outside() const {
return IdentityGridEntity<0,dim,GridImp>(identityGrid_,hostIntersection_.outside());
}
/** \brief return true if intersection is with boundary.
*/
bool boundary () const {
return hostIntersection_.boundary();
}
/** \brief Return unit outer normal (length == 1)
*
* The returned vector is the normal at the center() of the
* intersection's geometry.
* It is scaled to have unit length. */
NormalVector centerUnitOuterNormal () const {
return hostIntersection_.centerUnitOuterNormal();
}
//! return true if across the edge an neighbor on this level exists
bool neighbor () const {
return hostIntersection_.neighbor();
}
//! return information about the Boundary
int boundaryId () const {
return hostIntersection_.boundaryId();
}
//! return the boundary segment index
size_t boundarySegmentIndex() const {
return hostIntersection_.boundarySegmentIndex();
}
//! Return true if this is a conforming intersection
bool conforming () const {
return hostIntersection_.conforming();
}
//! Geometry type of an intersection
GeometryType type () const {
return hostIntersection_.type();
}
//! intersection of codimension 1 of this neighbor with element where
//! iteration started.
//! Here returned element is in LOCAL coordinates of the element
//! where iteration started.
LocalGeometry geometryInInside () const
{
return LocalGeometry( hostIntersection_.geometryInInside() );
}
//! intersection of codimension 1 of this neighbor with element where iteration started.
//! Here returned element is in LOCAL coordinates of neighbor
LocalGeometry geometryInOutside () const
{
return LocalGeometry( hostIntersection_.geometryInOutside() );
}
//! intersection of codimension 1 of this neighbor with element where iteration started.
//! Here returned element is in GLOBAL coordinates of the element where iteration started.
Geometry geometry () const
{
return Geometry( hostIntersection_.geometry() );
}
//! local number of codim 1 entity in self where intersection is contained in
int indexInInside () const {
return hostIntersection_.indexInInside();
}
//! local number of codim 1 entity in neighbor where intersection is contained
int indexInOutside () const {
return hostIntersection_.indexInOutside();
}
//! return outer normal
FieldVector<ctype, dimworld> outerNormal (const FieldVector<ctype, dim-1>& local) const {
return hostIntersection_.outerNormal(local);
}
//! return outer normal multiplied by the integration element
FieldVector<ctype, dimworld> integrationOuterNormal (const FieldVector<ctype, dim-1>& local) const {
return hostIntersection_.integrationOuterNormal(local);
}
//! return unit outer normal
FieldVector<ctype, dimworld> unitOuterNormal (const FieldVector<ctype, dim-1>& local) const {
return hostIntersection_.unitOuterNormal(local);
}
private:
const GridImp* identityGrid_;
HostLevelIntersection hostIntersection_;
};
} // namespace Dune
#endif
|