Commit d6d8581d authored by Steffen Müthing's avatar Steffen Müthing Committed by Carsten Gräser

[PartitionSet][Release] Provide typedefs for the types of the global PartitionSet objects

Having those available makes it much easier to use those PartitionSets
as template parameters because

- decltype(Dune::Partitions::interiorBorder> isn't as intuitive as
  Dune::Partitions::InteriorBorder

- the decltype unfortunately deduces a const type because the global
  objects are const, creating problems when trying to specialize.

Also, I think having those typedefs is just more consistent.

(cherry picked from commit a9b4c856)
Signed-off-by: Carsten Gräser's avatarCarsten Gräser <graeser@mi.fu-berlin.de>
parent 99533a8a
......@@ -181,51 +181,100 @@ namespace Dune {
#ifdef DOXYGEN
//! Type of PartitionSet for the interior partition.
typedef PartitionSet<...> Interior;
//! Type of PartitionSet for the border partition.
typedef PartitionSet<...> Border;
//! Type of PartitionSet for the overlap partition.
typedef PartitionSet<...> Overlap;
//! Type of PartitionSet for the front partition.
typedef PartitionSet<...> Front;
//! Type of PartitionSet for the ghost partition.
typedef PartitionSet<...> Ghost;
//! Type of PartitionSet for the interior and border partitions.
typedef PartitionSet<...> InteriorBorder;
//! Type of PartitionSet for the interior, border and overlap partitions.
typedef PartitionSet<...> InteriorBorderOverlap;
//! Type of PartitionSet for the interior, border, overlap and front partitions.
typedef PartitionSet<...> InteriorBorderOverlapFront;
//! Type of PartitionSet for all partitions.
typedef PartitionSet<...> All;
//! PartitionSet for the interior partition.
PartitionSet<...> interior;
Interior interior;
//! PartitionSet for the border partition.
PartitionSet<...> border;
Border border;
//! PartitionSet for the overlap partition.
PartitionSet<...> overlap;
Overlap overlap;
//! PartitionSet for the front partition.
PartitionSet<...> front;
Front front;
//! PartitionSet for the ghost partition.
PartitionSet<...> ghost;
Ghost ghost;
//! PartitionSet for the interior and border partitions.
PartitionSet<...> interiorBorder;
InteriorBorder interiorBorder;
//! PartitionSet for the interior, border and overlap partitions.
PartitionSet<...> interiorBorderOverlap;
InteriorBorderOverlap interiorBorderOverlap;
//! PartitionSet for the interior, border, overlap and front partitions.
PartitionSet<...> interiorBorderOverlapFront;
InteriorBorderOverlapFront interiorBorderOverlapFront;
//! PartitionSet for all partitions.
PartitionSet<...> all;
All all;
#else // DOXYGEN
// First declare the types and objects for individual partitions
typedef decltype(partitionSet<InteriorEntity>()) Interior;
typedef decltype(partitionSet<BorderEntity>()) Border;
typedef decltype(partitionSet<OverlapEntity>()) Overlap;
typedef decltype(partitionSet<FrontEntity>()) Front;
typedef decltype(partitionSet<GhostEntity>()) Ghost;
namespace {
// place global objects in anonymous namespace to ensure that visibility is
// restricted to the current translation unit, making it easier for the compiler
// to eliminate the actual objects and to avoid linking problems
const decltype(partitionSet<InteriorEntity>()) interior = {};
const decltype(partitionSet<BorderEntity>()) border = {};
const decltype(partitionSet<OverlapEntity>()) overlap = {};
const decltype(partitionSet<FrontEntity>()) front = {};
const decltype(partitionSet<GhostEntity>()) ghost = {};
const Interior interior = {};
const Border border = {};
const Overlap overlap = {};
const Front front = {};
const Ghost ghost = {};
}
// Now we can declare the partition sets that are a result of combining partitions
typedef decltype(interior + border) InteriorBorder;
typedef decltype(interior + border + overlap) InteriorBorderOverlap;
typedef decltype(interior + border + overlap + front) InteriorBorderOverlapFront;
typedef decltype(interior + border + overlap + front + ghost) All;
namespace {
// again, place the global objects in an anonymous namespace
const decltype(interior + border) interiorBorder = {};
const decltype(interior + border + overlap) interiorBorderOverlap = {};
const decltype(interior + border + overlap + front) interiorBorderOverlapFront = {};
const decltype(interior + border + overlap + front + ghost) all = {};
const InteriorBorder interiorBorder = {};
const InteriorBorderOverlap interiorBorderOverlap = {};
const InteriorBorderOverlapFront interiorBorderOverlapFront = {};
const All all = {};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment