dune-fem  2.8-git
inversefilter.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_GRIDPART_FILTER_INVERSEFILTER_HH
2 #define DUNE_FEM_GRIDPART_FILTER_INVERSEFILTER_HH
3 
4 namespace Dune
5 {
6 
7  namespace Fem
8  {
9 
10  template< class FilterImp >
12  {
13  public:
15 
17  template< int cd >
18  struct Codim
19  {
20  typedef typename FilterImp::template Codim< cd >::EntityType EntityType;
21  };
22 
25 
27  InverseFilter ( const FilterImp & filter = FilterImp() )
28  : filter_( filter )
29  { }
30 
31  InverseFilter( const ThisType & ) = default;
32  InverseFilter( ThisType && ) = default;
33 
34  ThisType &operator= ( const ThisType & ) = default;
35  ThisType &operator= ( ThisType && ) = default;
36 
38  template< int cd >
39  bool contains ( const typename Codim< cd >::EntityType & entity ) const
40  {
41  return !filter().contains< cd >( entity );
42  }
43 
45  template< class Entity >
46  bool contains ( const Entity & entity ) const
47  {
48  return !filter().contains( entity );
49  }
50 
52  // (allows boundarys within a given domain)
53  template< class Intersection >
54  bool interiorIntersection ( const Intersection &intersection ) const
55  {
56  return contains( intersection.outside() );
57  }
58 
60  template< class Intersection >
61  bool intersectionBoundary( const Intersection &intersection ) const
62  {
63  return filter().intersectionBoundary( intersection );
64  }
65 
67  template< class Intersection >
68  int intersectionBoundaryId ( const Intersection &intersection ) const
69  {
70  return filter().intersectionBoundaryId( intersection );
71  }
72 
74  template< class Intersection >
75  bool intersectionNeighbor ( const Intersection &intersection ) const
76  {
77  return filter().intersectionNeighbor( intersection );
78  }
79 
80  private:
81  const FilterImp filter () const
82  {
83  return filter_;
84  }
85 
86  FilterImp filter_;
87 
88  }; // end class InverseFilter
89 
90  } // namespace Fem
91 
92 } // namespace Dune
93 
94 #endif // #ifndef DUNE_FEM_GRIDPART_FILTER_INVERSEFILTER_HH
Definition: bindguard.hh:11
Definition: inversefilter.hh:12
bool contains(const Entity &entity) const
returns true if the given entity of the pointer in the domain
Definition: inversefilter.hh:46
int intersectionBoundaryId(const Intersection &intersection) const
returns the boundary id for an intersection
Definition: inversefilter.hh:68
bool interiorIntersection(const Intersection &intersection) const
returns true if an intersection is interior
Definition: inversefilter.hh:54
Codim< 0 >::EntityType EntityType
type of entity with codim=0
Definition: inversefilter.hh:24
InverseFilter(ThisType &&)=default
InverseFilter< FilterImp > ThisType
Definition: inversefilter.hh:14
InverseFilter(const FilterImp &filter=FilterImp())
constructor
Definition: inversefilter.hh:27
bool contains(const typename Codim< cd >::EntityType &entity) const
returns true if the given entity of the pointer in the domain
Definition: inversefilter.hh:39
bool intersectionNeighbor(const Intersection &intersection) const
returns true if for an intersection a neighbor exsits
Definition: inversefilter.hh:75
bool intersectionBoundary(const Intersection &intersection) const
returns true if an intersection is a boundary intersection
Definition: inversefilter.hh:61
InverseFilter(const ThisType &)=default
ThisType & operator=(const ThisType &)=default
entity types
Definition: inversefilter.hh:19
FilterImp::template Codim< cd >::EntityType EntityType
Definition: inversefilter.hh:20