dune-pdelab  2.5-dev
intersectiontype.hh
Go to the documentation of this file.
1 #ifndef DUNE_PDELAB_COMMON_INTERSECTIONTYPE_HH
2 #define DUNE_PDELAB_COMMON_INTERSECTIONTYPE_HH
3 
4 #include <utility>
5 #include <tuple>
6 
7 #include <dune/common/version.hh>
8 #include <dune/grid/common/partitionset.hh>
9 
10 namespace Dune {
11  namespace PDELab {
12 
14  enum class IntersectionType
15  {
16 
17  processor = 0,
18  skeleton = 1,
19  boundary = 2,
20  periodic = 3
21 
22  };
23 
25 
36  template<typename EntitySet, typename Intersection>
37  std::tuple<IntersectionType,typename EntitySet::Element> classifyIntersection(const EntitySet& entity_set, const Intersection& is)
38  {
39  auto type = static_cast<IntersectionType>(1* is.neighbor() + 2*is.boundary());
41 #if DUNE_VERSION_NEWER_REV(DUNE_GRID,2,4,1)
42  if (entity_set.partitions() == Partitions::all)
43 #else
44  if (entity_set.partitions().partitionIterator() == Partitions::all.partitionIterator())
45 #endif
46  return std::make_tuple(type,is.outside());
47  else
48  {
49  auto outside_entity = is.outside();
50  if (entity_set.partitions().contains(outside_entity.partitionType()))
51  return std::make_tuple(type,outside_entity);
52  else
53  return std::make_tuple(IntersectionType::processor,std::move(outside_entity));
54  }
55  else
56  return std::make_tuple(type,decltype(is.outside()){});
57  }
58 
59 
60  } // namespace PDELab
61 } // namespace Dune
62 
63 #endif // DUNE_PDELAB_COMMON_INTERSECTIONTYPE_HH
Dune::PDELab::IntersectionType
IntersectionType
Enum describing the type of an intersection.
Definition: intersectiontype.hh:14
Dune
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
Dune::PDELab::IntersectionType::processor
@ processor
processor boundary intersection (neighbor() == false && boundary() == false) or outside entity not in...
Dune::PDELab::IntersectionType::skeleton
@ skeleton
skeleton intersection (neighbor() == true && boundary() == false)
Dune::PDELab::IntersectionType::periodic
@ periodic
periodic boundary intersection (neighbor() == true && boundary() == true)
Dune::PDELab::IntersectionType::boundary
@ boundary
domain boundary intersection (neighbor() == false && boundary() == true)
Dune::PDELab::classifyIntersection
std::tuple< IntersectionType, typename EntitySet::Element > classifyIntersection(const EntitySet &entity_set, const Intersection &is)
Classifies the type of an intersection wrt to the passed EntitySet.
Definition: intersectiontype.hh:37