3#ifndef DUNE_GRID_COMMON_PARTITIONSET_HH
4#define DUNE_GRID_COMMON_PARTITIONSET_HH
6#include <dune/common/typetraits.hh>
19 template<
unsigned int partitions>
20 struct derive_partition_iterator_type
23 static_assert(AlwaysFalse<std::integral_constant<unsigned int,partitions> >::value,
24 "There is no partition iterator for this combination of entity partitions");
31 struct derive_partition_iterator_type<
34 :
public std::integral_constant<PartitionIteratorType,Interior_Partition>
38 struct derive_partition_iterator_type<
42 :
public std::integral_constant<PartitionIteratorType,InteriorBorder_Partition>
46 struct derive_partition_iterator_type<
51 :
public std::integral_constant<PartitionIteratorType,Overlap_Partition>
55 struct derive_partition_iterator_type<
61 :
public std::integral_constant<PartitionIteratorType,OverlapFront_Partition>
65 struct derive_partition_iterator_type<
72 :
public std::integral_constant<PartitionIteratorType,All_Partition>
76 struct derive_partition_iterator_type<
79 :
public std::integral_constant<PartitionIteratorType,Ghost_Partition>
94 template<
unsigned int partitions>
98 static const unsigned int value = partitions;
102 template<
unsigned int p>
110 template<
unsigned int p>
120 unsigned int set = partitions;
121 os <<
"partition set {";
123 for (
unsigned int p = 0; set; set &= ~(1 << p++))
125 if (!(set & (1 << p)))
130 os << static_cast<PartitionType>(p);
143 return derive_partition_iterator_type<partitions>::value;
149 return partitions & (1 << pt);
153 template<
unsigned int contained_partitions>
156 return (partitions & contained_partitions) == contained_partitions;
160 template<
unsigned int p2>
163 return partitions == p2;
167 template<
unsigned int p2>
170 return partitions != p2;
179 template<PartitionType p>
186 namespace Partitions {
250 typedef decltype(partitionSet<InteriorEntity>())
Interior;
251 typedef decltype(partitionSet<BorderEntity>())
Border;
252 typedef decltype(partitionSet<OverlapEntity>())
Overlap;
253 typedef decltype(partitionSet<FrontEntity>())
Front;
254 typedef decltype(partitionSet<GhostEntity>())
Ghost;
PartitionIteratorType
Parameter to be used for the parallel level- and leaf iterators.
Definition gridenums.hh:134
PartitionType
Attributes used in the generic overlap model.
Definition gridenums.hh:28
PartitionSet<(1<< p)> partitionSet()
Creates a PartitionSet for the given PartitionType.
Definition partitionset.hh:180
@ FrontEntity
on boundary between overlap and ghost
Definition gridenums.hh:32
@ InteriorEntity
all interior entities
Definition gridenums.hh:29
@ GhostEntity
ghost entities
Definition gridenums.hh:33
@ BorderEntity
on boundary between interior and overlap
Definition gridenums.hh:30
@ OverlapEntity
all entities lying in the overlap zone
Definition gridenums.hh:31
Include standard header files.
Definition agrid.hh:60
PartitionSet<... > All
Type of PartitionSet for all partitions.
Definition partitionset.hh:216
Interior interior
PartitionSet for the interior partition.
Definition partitionset.hh:220
PartitionSet<... > InteriorBorder
Type of PartitionSet for the interior and border partitions.
Definition partitionset.hh:207
Overlap overlap
PartitionSet for the overlap partition.
Definition partitionset.hh:226
PartitionSet<... > Border
Type of PartitionSet for the border partition.
Definition partitionset.hh:195
All all
PartitionSet for all partitions.
Definition partitionset.hh:244
PartitionSet<... > Front
Type of PartitionSet for the front partition.
Definition partitionset.hh:201
InteriorBorder interiorBorder
PartitionSet for the interior and border partitions.
Definition partitionset.hh:235
PartitionSet<... > Overlap
Type of PartitionSet for the overlap partition.
Definition partitionset.hh:198
Front front
PartitionSet for the front partition.
Definition partitionset.hh:229
PartitionSet<... > Interior
Type of PartitionSet for the interior partition.
Definition partitionset.hh:192
InteriorBorderOverlapFront interiorBorderOverlapFront
PartitionSet for the interior, border, overlap and front partitions.
Definition partitionset.hh:241
Border border
PartitionSet for the border partition.
Definition partitionset.hh:223
Ghost ghost
PartitionSet for the ghost partition.
Definition partitionset.hh:232
InteriorBorderOverlap interiorBorderOverlap
PartitionSet for the interior, border and overlap partitions.
Definition partitionset.hh:238
PartitionSet<... > Ghost
Type of PartitionSet for the ghost partition.
Definition partitionset.hh:204
PartitionSet<... > InteriorBorderOverlap
Type of PartitionSet for the interior, border and overlap partitions.
Definition partitionset.hh:210
PartitionSet<... > InteriorBorderOverlapFront
Type of PartitionSet for the interior, border, overlap and front partitions.
Definition partitionset.hh:213
A set of PartitionType values.
Definition partitionset.hh:96
static constexpr bool contains(PartitionSet< contained_partitions >)
Tests whether the given PartitionSet is contained in this set.
Definition partitionset.hh:154
constexpr bool operator==(PartitionSet< p2 >) const
Tests whether two PartitionsSet are equal.
Definition partitionset.hh:161
static constexpr PartitionIteratorType partitionIterator()
Returns the PartitionIteratorType that can be used to iterate over the partitions in the set.
Definition partitionset.hh:141
constexpr bool operator!=(PartitionSet< p2 >) const
Tests whether two PartitionsSet are not equal.
Definition partitionset.hh:168
friend std::ostream & operator<<(std::ostream &os, const PartitionSet &)
Writes the PartitionSet to an output stream.
Definition partitionset.hh:118
struct PartitionSet< partitions &~p > operator-(const PartitionSet< p > &set) const
Returns a new PartitionSet that does not contain the partitions in set.
Definition partitionset.hh:112
static constexpr bool contains(PartitionType pt)
Tests whether the given PartitionType is contained in this set.
Definition partitionset.hh:147