3 #ifndef DUNE_GRID_COMMON_PARTITIONSET_HH
4 #define DUNE_GRID_COMMON_PARTITIONSET_HH
6 #include <dune/common/typetraits.hh>
7 #include <dune/common/std/constexpr.hh>
20 template<
unsigned int partitions>
21 struct derive_partition_iterator_type
24 static_assert(AlwaysFalse<std::integral_constant<unsigned int,partitions> >::value,
25 "There is no partition iterator for this combination of entity partitions");
32 struct derive_partition_iterator_type<
35 :
public std::integral_constant<PartitionIteratorType,Interior_Partition>
39 struct derive_partition_iterator_type<
43 :
public std::integral_constant<PartitionIteratorType,InteriorBorder_Partition>
47 struct derive_partition_iterator_type<
52 :
public std::integral_constant<PartitionIteratorType,Overlap_Partition>
56 struct derive_partition_iterator_type<
62 :
public std::integral_constant<PartitionIteratorType,OverlapFront_Partition>
66 struct derive_partition_iterator_type<
73 :
public std::integral_constant<PartitionIteratorType,All_Partition>
77 struct derive_partition_iterator_type<
80 :
public std::integral_constant<PartitionIteratorType,Ghost_Partition>
95 template<
unsigned int partitions>
99 static const unsigned int value = partitions;
103 template<
unsigned int p>
111 template<
unsigned int p>
121 unsigned int set = partitions;
122 os <<
"partition set {";
124 for (
unsigned int p = 0; set; set &= ~(1 << p++))
126 if (!(set & (1 << p)))
131 os << static_cast<PartitionType>(p);
137 #if HAVE_CONSTEXPR || DOXYGEN
147 return derive_partition_iterator_type<partitions>::value;
150 #endif // HAVE_CONSTEXPR
155 return partitions & (1 << pt);
159 template<
unsigned int contained_partitions>
162 return (partitions & contained_partitions) == contained_partitions;
172 template<PartitionType p>
179 namespace Partitions {
243 typedef decltype(partitionSet<InteriorEntity>())
Interior;
256 const Border border = {};
257 const Overlap overlap = {};
258 const Front front = {};
259 const Ghost ghost = {};
268 typedef decltype(interior + border + overlap + front + ghost)
All;
274 const InteriorBorder interiorBorder = {};
275 const InteriorBorderOverlap interiorBorderOverlap = {};
276 const InteriorBorderOverlapFront interiorBorderOverlapFront = {};
291 #endif // DUNE_GRID_COMMON_PARTITIONSET_HH
PartitionSet<...> InteriorBorderOverlap
Type of PartitionSet for the interior, border and overlap partitions.
Definition: partitionset.hh:203
PartitionSet<...> Front
Type of PartitionSet for the front partition.
Definition: partitionset.hh:194
PartitionSet<...> Overlap
Type of PartitionSet for the overlap partition.
Definition: partitionset.hh:191
PartitionSet<...> InteriorBorder
Type of PartitionSet for the interior and border partitions.
Definition: partitionset.hh:200
on boundary between overlap and ghost
Definition: gridenums.hh:32
PartitionSet<...> InteriorBorderOverlapFront
Type of PartitionSet for the interior, border, overlap and front partitions.
Definition: partitionset.hh:206
A set of PartitionType values.
Definition: partitionset.hh:96
Interior interior
PartitionSet for the interior partition.
Definition: partitionset.hh:213
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:113
Include standard header files.
Definition: agrid.hh:59
InteriorBorderOverlapFront interiorBorderOverlapFront
PartitionSet for the interior, border, overlap and front partitions.
Definition: partitionset.hh:234
Ghost ghost
PartitionSet for the ghost partition.
Definition: partitionset.hh:225
PartitionIteratorType
Parameter to be used for the parallel level- and leaf iterators.
Definition: gridenums.hh:134
all interior entities
Definition: gridenums.hh:29
Front front
PartitionSet for the front partition.
Definition: partitionset.hh:222
ghost entities
Definition: gridenums.hh:33
PartitionSet<...> All
Type of PartitionSet for all partitions.
Definition: partitionset.hh:209
on boundary between interior and overlap
Definition: gridenums.hh:30
InteriorBorder interiorBorder
PartitionSet for the interior and border partitions.
Definition: partitionset.hh:228
static DUNE_CONSTEXPR bool contains(PartitionSet< contained_partitions >)
Tests whether the given PartitionSet is contained in this set.
Definition: partitionset.hh:160
PartitionSet<...> Ghost
Type of PartitionSet for the ghost partition.
Definition: partitionset.hh:197
Overlap overlap
PartitionSet for the overlap partition.
Definition: partitionset.hh:219
static DUNE_CONSTEXPR bool contains(PartitionType pt)
Tests whether the given PartitionType is contained in this set.
Definition: partitionset.hh:153
PartitionSet<...> Border
Type of PartitionSet for the border partition.
Definition: partitionset.hh:188
Border border
PartitionSet for the border partition.
Definition: partitionset.hh:216
PartitionSet<...> Interior
Type of PartitionSet for the interior partition.
Definition: partitionset.hh:185
PartitionSet<(1<< p)> partitionSet()
Creates a PartitionSet for the given PartitionType.
Definition: partitionset.hh:173
PartitionType
Attributes used in the generic overlap model.
Definition: gridenums.hh:28
All all
PartitionSet for all partitions.
Definition: partitionset.hh:237
InteriorBorderOverlap interiorBorderOverlap
PartitionSet for the interior, border and overlap partitions.
Definition: partitionset.hh:231
all entities lying in the overlap zone
Definition: gridenums.hh:31
friend std::ostream & operator<<(std::ostream &os, const PartitionSet &)
Writes the PartitionSet to an output stream.
Definition: partitionset.hh:119
static constexpr PartitionIteratorType partitionIterator()
Returns the PartitionIteratorType that can be used to iterate over the partitions in the set...
Definition: partitionset.hh:145