dune-fem  2.8-git
filteredgridpart/intersection.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_GRIDPART_FILTEREDGRIDPART_INTERSECTION_HH
2 #define DUNE_FEM_GRIDPART_FILTEREDGRIDPART_INTERSECTION_HH
3 
4 #include <utility>
5 
6 #include <dune/common/exceptions.hh>
7 
8 #include <dune/grid/common/intersection.hh>
9 
10 namespace Dune
11 {
12 
13  namespace Fem
14  {
15 
16  // FilteredGridPartIntersection
17  // ----------------------------
18 
19  template< class Filter, class HostIntersection >
21  {
23 
24  public:
25  typedef Filter FilterType;
26  typedef HostIntersection HostIntersectionType;
27 
28  static const int dimensionworld = HostIntersectionType::dimensionworld;
29  static const int mydimension = HostIntersectionType::mydimension;
30 
31  typedef typename HostIntersectionType::ctype ctype;
32 
33  typedef typename HostIntersectionType::Entity Entity;
34  typedef typename HostIntersectionType::Geometry Geometry;
35  typedef typename HostIntersectionType::LocalGeometry LocalGeometry;
36 
37  typedef typename HostIntersectionType::LocalCoordinate LocalCoordinate;
38  typedef typename HostIntersectionType::GlobalCoordinate GlobalCoordinate;
39 
41 
43  : hostIntersection_( std::move( hostIntersection ) ),
44  neighbor_( hostIntersection_.neighbor() ),
45  boundary_( !neighbor_ )
46  {
47  if( neighbor_ )
48  {
49  if( !filter.interiorIntersection( hostIntersection_ ) )
50  {
51  neighbor_ = filter.intersectionNeighbor( hostIntersection_ );
52  boundary_ = filter.intersectionBoundary( hostIntersection_ );
53  boundaryId_ = filter.intersectionBoundaryId( hostIntersection_ );
54  }
55  }
56  else
57  boundaryId_ = filter.intersectionBoundaryId( hostIntersection_ );
58  }
59 
60  bool equals ( const ThisType &other ) const { return (hostIntersection() == other.hostIntersection()); }
61 
62  bool boundary () const { return boundary_; }
63  bool neighbor () const { return neighbor_; }
64 
65  int boundaryId () const { return boundaryId_; }
66 
67  std::size_t boundarySegmentIndex () const
68  {
69  DUNE_THROW( NotImplemented, "boundarySegmentIndex not implemented for FilteredGridPart, yet" );
70  }
71 
72  Entity inside () const { return hostIntersection().inside(); }
73  Entity outside () const { return hostIntersection().outside(); }
74 
75  bool conforming () const { return hostIntersection().conforming(); }
76 
77  LocalGeometry geometryInInside () const { return hostIntersection().geometryInInside(); }
78  LocalGeometry geometryInOutside () const { return hostIntersection().geometryInOutside(); }
79 
80  Geometry geometry () const { return hostIntersection().geometry(); }
81  GeometryType type () const { return hostIntersection().type(); }
82 
83  int indexInInside () const { return hostIntersection().indexInInside(); }
84  int indexInOutside () const { return hostIntersection().indexInOutside(); }
85 
86  GlobalCoordinate outerNormal ( const LocalCoordinate & local ) const { return hostIntersection().outerNormal( local ); }
87  GlobalCoordinate integrationOuterNormal ( const LocalCoordinate & local ) const { return hostIntersection().integrationOuterNormal( local ); }
88  GlobalCoordinate unitOuterNormal ( const LocalCoordinate & local ) const { return hostIntersection().unitOuterNormal( local ); }
89  GlobalCoordinate centerUnitOuterNormal () const { return hostIntersection().centerUnitOuterNormal(); }
90 
91  const HostIntersectionType &hostIntersection () const { return hostIntersection_; }
92 
93  private:
94  HostIntersectionType hostIntersection_;
95  bool neighbor_ = false;
96  bool boundary_ = false;
97  int boundaryId_ = 0;
98  };
99 
100  } // namespace Fem
101 
102 } // namespace Dune
103 
104 #endif // #ifndef DUNE_FEM_GRIDPART_FILTEREDGRIDPART_INTERSECTION_HH
Definition: bindguard.hh:11
Definition: filteredgridpart/intersection.hh:21
GlobalCoordinate centerUnitOuterNormal() const
Definition: filteredgridpart/intersection.hh:89
static const int dimensionworld
Definition: filteredgridpart/intersection.hh:28
bool boundary() const
Definition: filteredgridpart/intersection.hh:62
GlobalCoordinate unitOuterNormal(const LocalCoordinate &local) const
Definition: filteredgridpart/intersection.hh:88
Filter FilterType
Definition: filteredgridpart/intersection.hh:25
GlobalCoordinate integrationOuterNormal(const LocalCoordinate &local) const
Definition: filteredgridpart/intersection.hh:87
Geometry geometry() const
Definition: filteredgridpart/intersection.hh:80
HostIntersectionType::GlobalCoordinate GlobalCoordinate
Definition: filteredgridpart/intersection.hh:38
GlobalCoordinate outerNormal(const LocalCoordinate &local) const
Definition: filteredgridpart/intersection.hh:86
HostIntersectionType::ctype ctype
Definition: filteredgridpart/intersection.hh:31
Entity inside() const
Definition: filteredgridpart/intersection.hh:72
int boundaryId() const
Definition: filteredgridpart/intersection.hh:65
FilteredGridPartIntersection(const FilterType &filter, HostIntersectionType hostIntersection)
Definition: filteredgridpart/intersection.hh:42
HostIntersectionType::Geometry Geometry
Definition: filteredgridpart/intersection.hh:34
Entity outside() const
Definition: filteredgridpart/intersection.hh:73
HostIntersectionType::Entity Entity
Definition: filteredgridpart/intersection.hh:33
int indexInOutside() const
Definition: filteredgridpart/intersection.hh:84
HostIntersectionType::LocalCoordinate LocalCoordinate
Definition: filteredgridpart/intersection.hh:37
std::size_t boundarySegmentIndex() const
Definition: filteredgridpart/intersection.hh:67
HostIntersection HostIntersectionType
Definition: filteredgridpart/intersection.hh:26
bool equals(const ThisType &other) const
Definition: filteredgridpart/intersection.hh:60
HostIntersectionType::LocalGeometry LocalGeometry
Definition: filteredgridpart/intersection.hh:35
LocalGeometry geometryInOutside() const
Definition: filteredgridpart/intersection.hh:78
bool neighbor() const
Definition: filteredgridpart/intersection.hh:63
static const int mydimension
Definition: filteredgridpart/intersection.hh:29
LocalGeometry geometryInInside() const
Definition: filteredgridpart/intersection.hh:77
bool conforming() const
Definition: filteredgridpart/intersection.hh:75
GeometryType type() const
Definition: filteredgridpart/intersection.hh:81
const HostIntersectionType & hostIntersection() const
Definition: filteredgridpart/intersection.hh:91
int indexInInside() const
Definition: filteredgridpart/intersection.hh:83