dune-fem  2.8-git
domainfilter.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_DOMAINFILTER_HH
2 #define DUNE_FEM_DOMAINFILTER_HH
3 
6 
8 
9 namespace Dune
10 {
11  namespace Fem
12  {
13 
14  // forward declarations
15  // --------------------
16 
17  template< class > class FilterDefaultImplementation;
18  template< class , class > class DomainFilter;
19 
20 
21  // DomainFilterTraits
22  // ------------------------
23 
24  template< class GridPartImp, class DomainArrayImp >
26  {
28  typedef GridPartImp GridPartType;
29 
31  typedef DomainArrayImp DomainArrayType;
32 
35 
37  template < int cd >
38  struct Codim
39  {
41  typedef typename GridPartType::template Codim< cd >::EntityType EntityType;
42  };
43 
46  };
47 
48 
49  // DomainFilter
50  // ------------------
51 
52  template< class GridPartImp, class DomainArrayImp = DynamicArray< int > >
54  : public FilterDefaultImplementation< DomainFilterTraits< GridPartImp, DomainArrayImp > >
55  {
56  public:
58  typedef GridPartImp GridPartType;
59 
61  typedef DomainArrayImp DomainArrayType;
62 
64  typedef typename DomainArrayType::value_type FieldType;
65 
68 
72  protected:
75 
78 
79  public:
81  typedef typename Traits::FilterType FilterType;
82 
84  typedef typename GridPartType :: IndexSetType IndexSetType;
85 
86  template< int cd >
87  struct Codim
88  {
89  typedef typename Traits::template Codim< cd >::EntityType EntityType;
90  };
91 
93  typedef typename Traits::EntityType EntityType;
94 
96  DomainFilter ( const GridPartType & gridPart,
97  const DomainArrayType& tags,
98  const FieldType tag )
99  : indexSet_( gridPart.indexSet() ),
100  tags_( tags ),
101  tag_( tag )
102  {}
103 
104  DomainFilter ( const ThisType & ) = default;
105  DomainFilter ( ThisType && ) = default;
106 
107  ThisType &operator= ( const ThisType & ) = default;
108  ThisType &operator= ( ThisType && ) = default;
109 
111  template< class Intersection >
112  bool interiorIntersection( const Intersection & ) const
113  {
114  return false;
115  }
116 
119  template< int cd >
120  bool contains ( const typename Codim< cd >::EntityType & entity ) const
121  {
122  if( cd == 0 )
123  {
124  return ( tag_ == tags_[ indexSet_.index( entity ) ] );
125  }
126  else
127  return false;
128  }
129 
132  template< class Entity >
133  bool contains ( const Entity & entity ) const
134  {
135  return contains< Entity::codimension >( entity );
136  }
137 
139  template< class Intersection >
140  bool intersectionBoundary( const Intersection & intersection ) const
141  {
142  return BoundaryIdProviderType::boundaryId( intersection );
143  }
144 
146  template< class Intersection >
147  int intersectionBoundaryId ( const Intersection & intersection ) const
148  {
149  return BoundaryIdProviderType::boundaryId( intersection );
150  }
151 
153  template< class Intersection >
154  bool intersectionNeighbor ( const Intersection & intersection ) const
155  {
156  return intersection.neighbor();
157  }
158 
159  protected:
163  };
164 
165  } // end namespace Fem
166 
167 } // end namespace Dune
168 
169 #endif // #ifndef DUNE_FEM_DOMAINFILTER_HH
Definition: bindguard.hh:11
Definition: filter/filter.hh:156
Definition: domainfilter.hh:55
GridPartType ::IndexSetType IndexSetType
type of index set
Definition: domainfilter.hh:84
DomainFilter(const ThisType &)=default
const IndexSetType & indexSet_
Definition: domainfilter.hh:160
bool intersectionNeighbor(const Intersection &intersection) const
returns true if for an intersection a neighbor exsits
Definition: domainfilter.hh:154
DomainArrayImp DomainArrayType
type of array
Definition: domainfilter.hh:61
int intersectionBoundaryId(const Intersection &intersection) const
returns the boundary id for an intersection
Definition: domainfilter.hh:147
BoundaryIdProvider< typename GridPartType::GridType > BoundaryIdProviderType
boundary id provider, specialized for each grid
Definition: domainfilter.hh:71
DomainArrayType::value_type FieldType
type of array field
Definition: domainfilter.hh:64
Traits::FilterType FilterType
type of the filter implementation
Definition: domainfilter.hh:81
DomainFilter< GridPartType, DomainArrayType > ThisType
this type
Definition: domainfilter.hh:74
const DomainArrayType & tags_
Definition: domainfilter.hh:161
bool intersectionBoundary(const Intersection &intersection) const
returns true if an intersection is a boundary intersection
Definition: domainfilter.hh:140
bool interiorIntersection(const Intersection &) const
return false since all interior intersections should be skipped
Definition: domainfilter.hh:112
GridPartImp GridPartType
type of grid part
Definition: domainfilter.hh:58
bool contains(const Entity &entity) const
returns true if the given entity has the correct tag for higher codims false is returned
Definition: domainfilter.hh:133
DomainFilter(ThisType &&)=default
const FieldType tag_
Definition: domainfilter.hh:162
DomainFilterTraits< GridPartType, DomainArrayType > Traits
type of traits
Definition: domainfilter.hh:67
ThisType & operator=(const ThisType &)=default
DomainFilter(const GridPartType &gridPart, const DomainArrayType &tags, const FieldType tag)
constructor
Definition: domainfilter.hh:96
bool contains(const typename Codim< cd >::EntityType &entity) const
returns true if the given entity has the correct tag for higher codims false is returned
Definition: domainfilter.hh:120
Traits::EntityType EntityType
type of codim 0 entity
Definition: domainfilter.hh:93
FilterDefaultImplementation< Traits > BaseType
base type
Definition: domainfilter.hh:77
Definition: domainfilter.hh:26
DomainFilter< GridPartType, DomainArrayType > FilterType
filter type
Definition: domainfilter.hh:34
DomainArrayImp DomainArrayType
array type
Definition: domainfilter.hh:31
Codim< 0 >::EntityType EntityType
entity type for codimension 0
Definition: domainfilter.hh:45
GridPartImp GridPartType
grid part type
Definition: domainfilter.hh:28
entity types
Definition: domainfilter.hh:39
GridPartType::template Codim< cd >::EntityType EntityType
entity type for given codimension
Definition: domainfilter.hh:41
Definition: domainfilter.hh:88
Traits::template Codim< cd >::EntityType EntityType
Definition: domainfilter.hh:89
Definition: boundaryidprovider.hh:36