1 #ifndef DUNE_MULTIDOMAINGRID_INTERSECTION_HH 2 #define DUNE_MULTIDOMAINGRID_INTERSECTION_HH 3 4 #include <dune/grid/common/intersection.hh> 5 6 #include <dune/grid/multidomaingrid/hostgridaccessor.hh> 7 #include <dune/grid/multidomaingrid/subdomaingrid/intersection.hh> 8 9 namespace Dune { 10 11 namespace mdgrid { 12 13 template<int codim, int dim, typename GridImp> 14 class EntityWrapper; 15 16 17 template<typename GridImp, typename HostIntersection_> 18 class IntersectionWrapper { 19 20 template<class, class> 21 friend class Dune::Intersection; 22 23 template<typename,typename,typename> 24 friend class subdomain::IntersectionWrapper; 25 26 template<typename,typename> 27 friend class IntersectionIteratorWrapper; 28 29 using HostIntersection = HostIntersection_; 30 using Entity = typename GridImp::Traits::template Codim<0>::Entity; 31 using Geometry = typename GridImp::Traits::template Codim<1>::Geometry; 32 using LocalGeometry = typename GridImp::Traits::template Codim<1>::LocalGeometry; 33 using EntityWrapper = Dune::mdgrid::EntityWrapper<0,GridImp::dimension,GridImp>; 34 35 static const int dimension = GridImp::dimension; 36 static const int dimensionworld = GridImp::dimensionworld; 37 38 using ctype = typename GridImp::ctype; 39 using GlobalCoords = FieldVector<ctype,dimensionworld>; 40 using LocalCoords = FieldVector<ctype,dimension - 1>; 41 42 43 44 protected: 45 46 IntersectionWrapper() = default; 47 IntersectionWrapper(const HostIntersection & hostIntersection)48 explicit IntersectionWrapper(const HostIntersection& hostIntersection) 49 : _hostIntersection(hostIntersection) 50 {} 51 IntersectionWrapper(HostIntersection && hostIntersection)52 explicit IntersectionWrapper(HostIntersection&& hostIntersection) 53 : _hostIntersection(std::move(hostIntersection)) 54 {} 55 56 private: 57 hostIntersection() const58 const HostIntersection& hostIntersection() const { 59 return _hostIntersection; 60 } 61 equals(const IntersectionWrapper & rhs) const62 bool equals(const IntersectionWrapper& rhs) const { 63 return _hostIntersection == rhs._hostIntersection; 64 } 65 boundary() const66 bool boundary() const { 67 return _hostIntersection.boundary(); 68 } 69 boundaryId() const70 int boundaryId() const { 71 return _hostIntersection.boundaryId(); 72 } 73 boundarySegmentIndex() const74 std::size_t boundarySegmentIndex() const { 75 return _hostIntersection.boundarySegmentIndex(); 76 } 77 neighbor() const78 bool neighbor() const { 79 return _hostIntersection.neighbor(); 80 } 81 inside() const82 Entity inside() const { 83 return {EntityWrapper(_hostIntersection.inside())}; 84 } 85 outside() const86 Entity outside() const { 87 return {EntityWrapper(_hostIntersection.outside())}; 88 } 89 conforming() const90 bool conforming() const { 91 return _hostIntersection.conforming(); 92 } 93 geometryInInside() const94 LocalGeometry geometryInInside() const { 95 return LocalGeometry(_hostIntersection.geometryInInside()); 96 } 97 geometryInOutside() const98 LocalGeometry geometryInOutside() const { 99 return LocalGeometry(_hostIntersection.geometryInOutside()); 100 } 101 geometry() const102 Geometry geometry() const { 103 return Geometry(_hostIntersection.geometry()); 104 } 105 type() const106 GeometryType type() const { 107 return _hostIntersection.type(); 108 } 109 indexInInside() const110 int indexInInside() const { 111 return _hostIntersection.indexInInside(); 112 } 113 indexInOutside() const114 int indexInOutside() const { 115 return _hostIntersection.indexInOutside(); 116 } 117 outerNormal(const LocalCoords & local) const118 GlobalCoords outerNormal(const LocalCoords& local) const { 119 return _hostIntersection.outerNormal(local); 120 } 121 integrationOuterNormal(const LocalCoords & local) const122 GlobalCoords integrationOuterNormal(const LocalCoords& local) const { 123 return _hostIntersection.integrationOuterNormal(local); 124 } 125 unitOuterNormal(const LocalCoords & local) const126 GlobalCoords unitOuterNormal(const LocalCoords& local) const { 127 return _hostIntersection.unitOuterNormal(local); 128 } 129 centerUnitOuterNormal() const130 GlobalCoords centerUnitOuterNormal() const { 131 return _hostIntersection.centerUnitOuterNormal(); 132 } 133 134 private: 135 136 HostIntersection _hostIntersection; 137 138 }; 139 140 } // namespace mdgrid 141 142 } // namespace Dune 143 144 #endif // DUNE_MULTIDOMAINGRID_INTERSECTION_HH 145