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 > 20 class FilteredGridPartIntersection 21 { 22 typedef FilteredGridPartIntersection< Filter, HostIntersection > ThisType; 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 40 FilteredGridPartIntersection () = default; 41 FilteredGridPartIntersection(const FilterType & filter,HostIntersectionType hostIntersection)42 FilteredGridPartIntersection ( const FilterType &filter, HostIntersectionType hostIntersection ) 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 equals(const ThisType & other) const60 bool equals ( const ThisType &other ) const { return (hostIntersection() == other.hostIntersection()); } 61 boundary() const62 bool boundary () const { return boundary_; } neighbor() const63 bool neighbor () const { return neighbor_; } 64 boundaryId() const65 int boundaryId () const { return boundaryId_; } 66 boundarySegmentIndex() const67 std::size_t boundarySegmentIndex () const 68 { 69 DUNE_THROW( NotImplemented, "boundarySegmentIndex not implemented for FilteredGridPart, yet" ); 70 } 71 inside() const72 Entity inside () const { return hostIntersection().inside(); } outside() const73 Entity outside () const { return hostIntersection().outside(); } 74 conforming() const75 bool conforming () const { return hostIntersection().conforming(); } 76 geometryInInside() const77 LocalGeometry geometryInInside () const { return hostIntersection().geometryInInside(); } geometryInOutside() const78 LocalGeometry geometryInOutside () const { return hostIntersection().geometryInOutside(); } 79 geometry() const80 Geometry geometry () const { return hostIntersection().geometry(); } type() const81 GeometryType type () const { return hostIntersection().type(); } 82 indexInInside() const83 int indexInInside () const { return hostIntersection().indexInInside(); } indexInOutside() const84 int indexInOutside () const { return hostIntersection().indexInOutside(); } 85 outerNormal(const LocalCoordinate & local) const86 GlobalCoordinate outerNormal ( const LocalCoordinate & local ) const { return hostIntersection().outerNormal( local ); } integrationOuterNormal(const LocalCoordinate & local) const87 GlobalCoordinate integrationOuterNormal ( const LocalCoordinate & local ) const { return hostIntersection().integrationOuterNormal( local ); } unitOuterNormal(const LocalCoordinate & local) const88 GlobalCoordinate unitOuterNormal ( const LocalCoordinate & local ) const { return hostIntersection().unitOuterNormal( local ); } centerUnitOuterNormal() const89 GlobalCoordinate centerUnitOuterNormal () const { return hostIntersection().centerUnitOuterNormal(); } 90 hostIntersection() const91 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 105