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;
263 const Border border = {};
264 const Overlap overlap = {};
265 const Front front = {};
266 const Ghost ghost = {};
275 typedef decltype(interior + border + overlap + front + ghost)
All;
281 const InteriorBorder interiorBorder = {};
282 const InteriorBorderOverlap interiorBorderOverlap = {};
283 const InteriorBorderOverlapFront interiorBorderOverlapFront = {};
298 #endif // DUNE_GRID_COMMON_PARTITIONSET_HH Ghost ghost
PartitionSet for the ghost partition.
Definition: partitionset.hh:232
PartitionSet<... > InteriorBorderOverlapFront
Type of PartitionSet for the interior, border, overlap and front partitions.
Definition: partitionset.hh:213
InteriorBorderOverlapFront interiorBorderOverlapFront
PartitionSet for the interior, border, overlap and front partitions.
Definition: partitionset.hh:241
all entities lying in the overlap zone
Definition: gridenums.hh:31
InteriorBorder interiorBorder
PartitionSet for the interior and border partitions.
Definition: partitionset.hh:235
ghost entities
Definition: gridenums.hh:33
PartitionType
Attributes used in the generic overlap model.
Definition: gridenums.hh:28
PartitionIteratorType
Parameter to be used for the parallel level- and leaf iterators.
Definition: gridenums.hh:134
PartitionSet<... > Overlap
Type of PartitionSet for the overlap partition.
Definition: partitionset.hh:198
Overlap overlap
PartitionSet for the overlap partition.
Definition: partitionset.hh:226
on boundary between interior and overlap
Definition: gridenums.hh:30
PartitionSet<... > All
Type of PartitionSet for all partitions.
Definition: partitionset.hh:216
constexpr bool operator!=(PartitionSet< p2 >) const
Tests whether two PartitionsSet are not equal.
Definition: partitionset.hh:168
static constexpr bool contains(PartitionType pt)
Tests whether the given PartitionType is contained in this set.
Definition: partitionset.hh:147
constexpr bool operator==(PartitionSet< p2 >) const
Tests whether two PartitionsSet are equal.
Definition: partitionset.hh:161
friend std::ostream & operator<<(std::ostream &os, const PartitionSet &)
Writes the PartitionSet to an output stream.
Definition: partitionset.hh:118
on boundary between overlap and ghost
Definition: gridenums.hh:32
All all
PartitionSet for all partitions.
Definition: partitionset.hh:244
Include standard header files.
Definition: agrid.hh:59
static constexpr PartitionIteratorType partitionIterator()
Returns the PartitionIteratorType that can be used to iterate over the partitions in the set...
Definition: partitionset.hh:141
PartitionSet<... > Border
Type of PartitionSet for the border partition.
Definition: partitionset.hh:195
PartitionSet<... > InteriorBorder
Type of PartitionSet for the interior and border partitions.
Definition: partitionset.hh:207
Front front
PartitionSet for the front partition.
Definition: partitionset.hh:229
PartitionSet<... > Interior
Type of PartitionSet for the interior partition.
Definition: partitionset.hh:192
PartitionSet<... > Ghost
Type of PartitionSet for the ghost partition.
Definition: partitionset.hh:204
InteriorBorderOverlap interiorBorderOverlap
PartitionSet for the interior, border and overlap partitions.
Definition: partitionset.hh:238
PartitionSet<... > Front
Type of PartitionSet for the front partition.
Definition: partitionset.hh:201
PartitionSet<... > InteriorBorderOverlap
Type of PartitionSet for the interior, border and overlap partitions.
Definition: partitionset.hh:210
A set of PartitionType values.
Definition: partitionset.hh:95
Interior interior
PartitionSet for the interior partition.
Definition: partitionset.hh:220
all interior entities
Definition: gridenums.hh:29
static constexpr bool contains(PartitionSet< contained_partitions >)
Tests whether the given PartitionSet is contained in this set.
Definition: partitionset.hh:154
Border border
PartitionSet for the border partition.
Definition: partitionset.hh:223
PartitionSet<(1<< p)> partitionSet()
Creates a PartitionSet for the given PartitionType.
Definition: partitionset.hh:180