1#ifndef DUNE_FEM_GRIDPART_FILTER_SIMPLE_HH
2#define DUNE_FEM_GRIDPART_FILTER_SIMPLE_HH
9#include <dune/geometry/dimension.hh>
13#include <dune/fem/gridpart/filter/filter.hh>
14#include <dune/fem/misc/boundaryidprovider.hh>
25 template<
class Gr
idPart >
33 template<
class Gr
idPart >
34 struct SimpleFilterTraits
36 typedef SimpleFilter< GridPart > FilterType;
41 typedef typename GridPart::template Codim< codim >::EntityType EntityType;
50 template<
class Gr
idPart >
52 :
public FilterDefaultImplementation< SimpleFilterTraits< GridPart > >
54 typedef SimpleFilter< GridPart > This;
55 typedef FilterDefaultImplementation< SimpleFilterTraits< GridPart > > Base;
57 typedef std::make_integer_sequence< int, GridPart::dimension+1 > AllCodims;
61 using Codim =
typename Base::template Codim< codim >;
63 template<
class Contains >
64 SimpleFilter (
const GridPart &gridPart, Contains
contains,
int domainId )
66 contains_( mapper_.size(), false ),
68 domainIds_( mapper0_.size(), -1 )
70 for(
const typename Codim< 0 >::EntityType &entity : elements( gridPart ) )
72 domainIds_[ mapper0_.index( entity ) ] =
contains( entity );
73 if( domainIds_[ mapper0_.index( entity ) ] == domainId )
74 mark( entity, AllCodims() );
79 bool contains (
const typename Codim< codim >::EntityType &entity )
const
81 return contains_[ mapper_.index( entity ) ];
84 template<
class Entity >
85 bool contains (
const Entity &entity )
const
87 return contains< Entity::codimension >( entity );
90 template<
class Intersection >
91 bool interiorIntersection (
const Intersection &intersection )
const
93 return contains( intersection.outside() );
96 template<
class Intersection >
97 bool intersectionBoundary (
const Intersection & )
const
102 template<
class Intersection >
103 int intersectionBoundaryId (
const Intersection &intersection )
const
105 return ( intersection.boundary() ?
106 Dune::Fem::BoundaryIdProvider<typename GridPart::GridType>::boundaryId( intersection ) :
107 domainIds_[ mapper0_.index( intersection.outside() ) ] );
110 template<
class Intersection >
111 bool intersectionNeighbor (
const Intersection & )
const
117 template<
int codim >
120 for(
unsigned int i = 0, n = entity.subEntities( codim ); i < n; ++i )
121 contains_[ mapper_.subIndex( entity, i, codim ) ] =
true;
124 template<
int... codim >
125 void mark (
const typename Codim< 0 >::EntityType &entity, std::integer_sequence< int, codim... > )
131 std::vector< bool > contains_;
133 std::vector< int > domainIds_;
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:158
Mapper for multiple codim and multiple geometry types.
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