DUNE-FEM (unstable)

radialfilter.hh
1#ifndef DUNE_FEM_GRIDPART_FILTER_RADIALFILTER_HH
2#define DUNE_FEM_GRIDPART_FILTER_RADIALFILTER_HH
3
5
6namespace Dune
7{
8
9 namespace Fem
10 {
11
12 // RadialFilter
13 // ------------
14
17 template < typename ct, int dimw >
19 {
20 public:
22 typedef ct ctype;
23
25 static constexpr int dimensionworld = dimw;
26
29
32 ctype radius = 0.25)
33 : center_( center ),
34 radius_( radius )
35 { }
36
38 template< class Entity >
39 bool contains ( const Entity & entity ) const
40 {
41 constexpr int cc = Entity::codimension;
42 if( cc != 0 )
43 DUNE_THROW( InvalidStateException, "RadialFilter::contains only available for codim 0 entities" );
44 ctype dist = (entity.geometry().center() - center_).two_norm();
45 return (dist > radius_);
46 }
47
49 template< class Intersection >
50 bool interiorIntersection( const Intersection &intersection ) const
51 {
52 return contains( intersection.outside() );
53 }
54
56 // which is either it.boundary == true or contains (it.ouside()) == false
57 // so here true is a good choice
58 template < class Intersection >
59 bool intersectionBoundary( const Intersection & ) const
60 {
61 return true;
62 }
64 // which is either it.boundary == true or contains (it.ouside()) == false
65 template < class Intersection >
67 {
68 return 1;
69 }
70
72 template <class Intersection>
73 bool intersectionNeighbor( const Intersection & ) const
74 {
75 return false;
76 }
77
78 private:
79 const GlobalCoordinateType center_;
80 const ctype radius_;
81
82 }; // end RadialFilter
83
84 } // namespace Fem
85
86} // namespace Dune
87
88#endif // #ifndef DUNE_FEM_GRIDPART_FILTER_RADIALFILTER_HH
89
Wrapper class for entities.
Definition: entity.hh:66
Geometry geometry() const
obtain geometric realization of the entity
Definition: entity.hh:141
static constexpr int codimension
Know your own codimension.
Definition: entity.hh:106
given center x and radius r, filter is characteristic function of clos B_r( x )
Definition: radialfilter.hh:19
static constexpr int dimensionworld
export dimension
Definition: radialfilter.hh:25
bool intersectionBoundary(const Intersection &) const
return what boundary id we have in case of boundary intersection
Definition: radialfilter.hh:59
RadialFilter(const GlobalCoordinateType &center=GlobalCoordinateType(0), ctype radius=0.25)
constructor
Definition: radialfilter.hh:31
int intersectionBoundaryId(const Intersection &) const
return what boundary id we have in case of boundary intersection
Definition: radialfilter.hh:66
Dune::FieldVector< ct, dimw > GlobalCoordinateType
coordinate type
Definition: radialfilter.hh:28
ct ctype
export template parameter
Definition: radialfilter.hh:22
bool contains(const Entity &entity) const
check whether entity center is inside of circle
Definition: radialfilter.hh:39
bool intersectionNeighbor(const Intersection &) const
if contains() is true then we have an interior entity
Definition: radialfilter.hh:73
bool interiorIntersection(const Intersection &intersection) const
default implementation returns contains from neighbor
Definition: radialfilter.hh:50
vector space out of a tensor product of fields.
Definition: fvector.hh:91
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: intersection.hh:164
Entity outside() const
return Entity on the outside of this intersection. That is the neighboring Entity.
Definition: intersection.hh:261
Default exception if a function was called while the object is not in a valid state for that function...
Definition: exceptions.hh:281
Implements a vector constructed from a given type representing a field and a compile-time given size.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)