DUNE-FEM (unstable)

domainfilter.hh
1#ifndef DUNE_FEM_DOMAINFILTER_HH
2#define DUNE_FEM_DOMAINFILTER_HH
3
4#include <dune/fem/gridpart/filter/filter.hh>
5#include <dune/fem/storage/dynamicarray.hh>
6
7#include <dune/fem/misc/boundaryidprovider.hh>
8
9namespace 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 >
25 struct DomainFilterTraits
26 {
28 typedef GridPartImp GridPartType;
29
31 typedef DomainArrayImp DomainArrayType;
32
34 typedef DomainFilter< GridPartType, DomainArrayType > FilterType;
35
37 template < int cd >
38 struct Codim
39 {
41 typedef typename GridPartType::template Codim< cd >::EntityType EntityType;
42 };
43
45 typedef typename Codim< 0 >::EntityType EntityType;
46 };
47
48
49 // DomainFilter
50 // ------------------
51
52 template< class GridPartImp, class DomainArrayImp = DynamicArray< int > >
53 class DomainFilter
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
67 typedef DomainFilterTraits< GridPartType, DomainArrayType > Traits;
68
70 typedef BoundaryIdProvider< typename GridPartType::GridType >
71 BoundaryIdProviderType;
72 protected:
74 typedef DomainFilter< GridPartType, DomainArrayType > ThisType;
75
77 typedef FilterDefaultImplementation< Traits > BaseType;
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:
160 const IndexSetType& indexSet_;
161 const DomainArrayType& tags_;
162 const FieldType tag_;
163 };
164
165 } // end namespace Fem
166
167} // end namespace Dune
168
169#endif // #ifndef DUNE_FEM_DOMAINFILTER_HH
Dune namespace.
Definition: alignedallocator.hh:13
constexpr std::bool_constant<((II==value)||...)> contains(std::integer_sequence< T, II... >, std::integral_constant< T, value >)
Checks whether or not a given sequence contains a value.
Definition: integersequence.hh:137
Static tag representing a codimension.
Definition: dimension.hh:24
entity types
Definition: domainfilter.hh:39
GridPartType::template Codim< cd >::EntityType EntityType
entity type for given codimension
Definition: domainfilter.hh:41
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 27, 22:29, 2024)