intersection.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=2 sw=2 sts=2:
3#ifndef DUNE_POLYHEDRALGRID_INTERSECTION_HH
4#define DUNE_POLYHEDRALGRID_INTERSECTION_HH
5
6//- dune-common includes
7#include <dune/common/fvector.hh>
8
9//- local includes
11
12#include <cstddef>
13
14namespace Dune
15{
16
17 // PolyhedralGridIntersection
18 // ------------------
19
20 template< class Grid >
22 {
24 protected:
25 typedef typename Grid :: Traits Traits;
26
27 typedef typename Traits :: ExtraData ExtraData ;
28
29 public:
30 typedef typename Traits::ctype ctype;
31 typedef typename Traits::GlobalCoordinate GlobalCoordinate;
32
33 static const int dimension = Traits::dimension;
34 static const int dimensionworld = Traits::dimensionworld;
35
36 typedef typename Traits::template Codim< 0 >::Entity Entity;
37 typedef typename Traits::template Codim< 0 >::EntityPointer EntityPointer;
38 typedef typename Traits::template Codim< 0 >::EntitySeed EntitySeed;
39 typedef typename Traits::template Codim< 1 >::Geometry Geometry;
40 typedef typename Traits::template Codim< 1 >::LocalGeometry LocalGeometry;
41
42 protected:
43 typedef typename Traits::template Codim< 0 >::EntityPointerImpl EntityPointerImpl;
44 typedef typename Traits::template Codim< 0 >::EntityImpl EntityImpl;
45 typedef typename Traits::template Codim< 1 >::GeometryImpl GeometryImpl;
46 typedef typename Traits::template Codim< 1 >::LocalGeometryImpl LocalGeometryImpl;
47
48 public:
50 : data_( data ),
51 seed_(),
53 {}
54
56 : data_( ),
57 seed_(),
59 {}
60
61 PolyhedralGridIntersection ( ExtraData data, const EntitySeed& seed, const int intersectionIdx )
62 : data_( data ),
63 seed_( seed ),
64 intersectionIdx_( intersectionIdx )
65 {}
66
68 : data_( other.data_ ),
69 seed_( other.seed_ ),
71 {}
72
73 Entity inside () const
74 {
75 return Entity( EntityImpl( data(), seed_ ) );
76 }
77
78 Entity outside () const
79 {
80 return Entity( EntityImpl(data(),
82 }
83
85 {
86 data_ = other.data_;
87 seed_ = other.seed_;
89 return *this;
90 }
91
92 bool operator == ( const This& other ) const
93 {
94 return (seed_ == other.seed_) &&
96 }
97
98 bool boundary () const { return !neighbor(); }
99
100 bool conforming () const { return false; }
101
102 bool neighbor () const { return data()->neighbor(seed_, intersectionIdx_).isValid(); }
103
104 int boundaryId () const { return 1; }
105
106 size_t boundarySegmentIndex () const
107 {
108 return data()->boundarySegmentIndex( seed_, intersectionIdx_);
109 }
110
112 {
113 return LocalGeometry( LocalGeometryImpl( data() ) );
114 }
115
117 {
118 return LocalGeometry( LocalGeometryImpl( data() ) );
119 }
120
122 {
123 return Geometry( GeometryImpl(data(), data()->template subEntitySeed<1>(seed_, intersectionIdx_)));
124 }
125
126 GeometryType type () const
127 {
128 return Dune::GeometryTypes::cube(dimension);
129 }
130
131 int indexInInside () const
132 {
133 return data()->indexInInside(seed_, intersectionIdx_);
134 }
135
136 int indexInOutside () const
137 {
138 return data()->indexInOutside(seed_, intersectionIdx_);
139 }
140
142 integrationOuterNormal ( const FieldVector< ctype, dimension-1 > &local ) const
143 {
144 return outerNormal( local );
145 }
146
148 outerNormal ( const FieldVector< ctype, dimension-1 > & ) const
149 { return outerNormal(); }
150
152 { return data()->outerNormal(seed_, intersectionIdx_); }
153
155 unitOuterNormal ( const FieldVector< ctype, dimension-1 > & ) const
156 {
157 return centerUnitOuterNormal();
158 }
159
162 { return data()->unitOuterNormal(seed_, intersectionIdx_); }
163
164 ExtraData data() const { return data_; }
165
166 bool equals(const This& other) const
167 {
168 return seed_.equals(other.seed_) && intersectionIdx_ == other.intersectionIdx_;
169 }
170
171 // intersection id (here index of the face in the grid)
172 int id() const
173 {
174 // return face number of current intersection
175 return data()->template subEntitySeed<1>( seed_, intersectionIdx_).index();
176 }
177
178 protected:
181 public:
182 int intersectionIdx_; // the element-local index
183 };
184
185} // namespace Dune
186
187#endif // #ifndef DUNE_POLYHEDRALGRID_INTERSECTION_HH
Definition: intersection.hh:22
int intersectionIdx_
Definition: intersection.hh:182
GeometryType type() const
Definition: intersection.hh:126
bool equals(const This &other) const
Definition: intersection.hh:166
ExtraData data() const
Definition: intersection.hh:164
GlobalCoordinate outerNormal(const FieldVector< ctype, dimension-1 > &) const
Definition: intersection.hh:148
Traits::template Codim< 0 >::EntityImpl EntityImpl
Definition: intersection.hh:44
PolyhedralGridIntersection & operator=(const PolyhedralGridIntersection &other)
Definition: intersection.hh:84
GlobalCoordinate integrationOuterNormal(const FieldVector< ctype, dimension-1 > &local) const
Definition: intersection.hh:142
GlobalCoordinate unitOuterNormal(const FieldVector< ctype, dimension-1 > &) const
Definition: intersection.hh:155
Traits::template Codim< 1 >::Geometry Geometry
Definition: intersection.hh:39
Traits::template Codim< 0 >::Entity Entity
Definition: intersection.hh:36
LocalGeometry geometryInOutside() const
Definition: intersection.hh:116
Traits::GlobalCoordinate GlobalCoordinate
Definition: intersection.hh:31
Traits::template Codim< 1 >::GeometryImpl GeometryImpl
Definition: intersection.hh:45
static const int dimensionworld
Definition: intersection.hh:34
int boundaryId() const
Definition: intersection.hh:104
EntitySeed seed_
Definition: intersection.hh:180
bool operator==(const This &other) const
Definition: intersection.hh:92
bool boundary() const
Definition: intersection.hh:98
bool neighbor() const
Definition: intersection.hh:102
Traits::template Codim< 0 >::EntityPointer EntityPointer
Definition: intersection.hh:37
static const int dimension
Definition: intersection.hh:33
Grid::Traits Traits
Definition: intersection.hh:25
size_t boundarySegmentIndex() const
Definition: intersection.hh:106
PolyhedralGridIntersection(ExtraData data)
Definition: intersection.hh:49
int indexInInside() const
Definition: intersection.hh:131
LocalGeometry geometryInInside() const
Definition: intersection.hh:111
Traits::template Codim< 1 >::LocalGeometryImpl LocalGeometryImpl
Definition: intersection.hh:46
ExtraData data_
Definition: intersection.hh:179
GlobalCoordinate centerUnitOuterNormal() const
Definition: intersection.hh:161
PolyhedralGridIntersection(const This &other)
Definition: intersection.hh:67
Traits::template Codim< 0 >::EntitySeed EntitySeed
Definition: intersection.hh:38
int indexInOutside() const
Definition: intersection.hh:136
Entity inside() const
Definition: intersection.hh:73
Traits::template Codim< 1 >::LocalGeometry LocalGeometry
Definition: intersection.hh:40
bool conforming() const
Definition: intersection.hh:100
int id() const
Definition: intersection.hh:172
Traits::template Codim< 0 >::EntityPointerImpl EntityPointerImpl
Definition: intersection.hh:43
Traits::ctype ctype
Definition: intersection.hh:30
PolyhedralGridIntersection()
Definition: intersection.hh:55
PolyhedralGridIntersection(ExtraData data, const EntitySeed &seed, const int intersectionIdx)
Definition: intersection.hh:61
GlobalCoordinate outerNormal() const
Definition: intersection.hh:151
Traits::ExtraData ExtraData
Definition: intersection.hh:27
Geometry geometry() const
Definition: intersection.hh:121
Entity outside() const
Definition: intersection.hh:78
The namespace Dune is the main namespace for all Dune code.
Definition: common/CartesianIndexMapper.hpp:10