dune-fem  2.8-git
intersectionside.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_COMMON_INTERSECTIONSIDE_HH
2 #define DUNE_FEM_COMMON_INTERSECTIONSIDE_HH
3 
4 #include <dune/common/typelist.hh>
5 
6 namespace Dune
7 {
8  namespace Fem
9  {
10  enum class IntersectionSide : std::size_t { in = 0u, out = 1u };
11  template<class GF, class Intersection>
12  constexpr auto hasIntersectionBind(const MetaType<Intersection> &) ->
13  decltype(std::declval<GF&>().bind(
14  std::declval<const Intersection&>(), IntersectionSide::in
15  ), std::true_type{})
16  {
17  return {};
18  }
19  template <class GF>
20  constexpr auto hasIntersectionBind(...) -> std::false_type
21  {
22  return {};
23  }
24  template<class GF, class Intersection>
25  void defaultIntersectionBind(GF &gf, const Intersection &intersection, IntersectionSide side)
26  {
27  if constexpr (hasIntersectionBind<GF>(MetaType<Intersection>()))
28  gf.bind(intersection,side);
29  else
30  gf.bind( side==IntersectionSide::in? intersection.inside(): intersection.outside() );
31  }
32  }
33 }
34 
35 #endif // DUNE_FEM_COMMON_INTERSECTIONSIDE_HH
Definition: bindguard.hh:11
constexpr auto hasIntersectionBind(const MetaType< Intersection > &) -> decltype(std::declval< GF & >().bind(std::declval< const Intersection & >(), IntersectionSide::in), std::true_type{})
Definition: intersectionside.hh:12
void defaultIntersectionBind(GF &gf, const Intersection &intersection, IntersectionSide side)
Definition: intersectionside.hh:25
IntersectionSide
Definition: intersectionside.hh:10