1#ifndef DUNE_FEM_GRIDPART_FILTER_SIMPLE_HH
2#define DUNE_FEM_GRIDPART_FILTER_SIMPLE_HH
9#include <dune/geometry/dimension.hh>
11#include <dune/grid/common/mcmgmapper.hh>
25 template<
class Gr
idPart >
33 template<
class Gr
idPart >
50 template<
class Gr
idPart >
57 typedef std::make_integer_sequence< int, GridPart::dimension+1 > AllCodims;
63 template<
class Contains >
65 : mapper_( gridPart.gridView(),
66 [](
Dune::GeometryType,int ) {
return true;} ),
67 contains_( mapper_.size(), false ),
68 mapper0_( gridPart.gridView(),
69 [](Dune::GeometryType gt,
int dim) {
return gt.dim()==dim;} ),
70 domainIds_( mapper0_.size(), -1 )
72 for(
const typename Codim< 0 >::EntityType &entity : elements( gridPart ) )
74 domainIds_[ mapper0_.index( entity ) ] =
contains( entity );
75 if( domainIds_[ mapper0_.index( entity ) ] == domainId )
76 mark( entity, AllCodims() );
83 return contains_[ mapper_.index( entity ) ];
86 template<
class Entity >
89 return contains< Entity::codimension >( entity );
92 template<
class Intersection >
95 return contains( intersection.outside() );
98 template<
class Intersection >
104 template<
class Intersection >
107 return ( intersection.boundary() ?
109 domainIds_[ mapper0_.index( intersection.outside() ) ] );
112 template<
class Intersection >
119 template<
int codim >
120 void mark (
const typename Codim< 0 >::EntityType &entity, Dune::Codim< codim > )
122 for(
unsigned int i = 0, n = entity.subEntities( codim ); i < n; ++i )
123 contains_[ mapper_.subIndex( entity, i, codim ) ] =
true;
126 template<
int... codim >
127 void mark (
const typename Codim< 0 >::EntityType &entity, std::integer_sequence< int, codim... > )
129 std::ignore = std::make_tuple( (mark( entity, Dune::Codim< codim >() ), codim)... );
132 MultipleCodimMultipleGeomTypeMapper< typename GridPart::GridViewType > mapper_;
133 std::vector< bool > contains_;
134 MultipleCodimMultipleGeomTypeMapper< typename GridPart::GridViewType > mapper0_;
135 std::vector< int > domainIds_;
Definition: bindguard.hh:11
Definition: filter/filter.hh:156
Definition: gridpart/filter/simple.hh:53
bool intersectionNeighbor(const Intersection &) const
Definition: gridpart/filter/simple.hh:113
bool contains(const Entity &entity) const
Definition: gridpart/filter/simple.hh:87
bool contains(const typename Codim< codim >::EntityType &entity) const
Definition: gridpart/filter/simple.hh:81
bool interiorIntersection(const Intersection &intersection) const
Definition: gridpart/filter/simple.hh:93
typename Base::template Codim< codim > Codim
Definition: gridpart/filter/simple.hh:61
int intersectionBoundaryId(const Intersection &intersection) const
Definition: gridpart/filter/simple.hh:105
bool intersectionBoundary(const Intersection &) const
Definition: gridpart/filter/simple.hh:99
SimpleFilter(const GridPart &gridPart, Contains contains, int domainId)
Definition: gridpart/filter/simple.hh:64
Definition: gridpart/filter/simple.hh:35
SimpleFilter< GridPart > FilterType
Definition: gridpart/filter/simple.hh:36
Definition: gridpart/filter/simple.hh:40
GridPart::template Codim< codim >::EntityType EntityType
Definition: gridpart/filter/simple.hh:41
Definition: boundaryidprovider.hh:36