dune-fem 2.12-git
Loading...
Searching...
No Matches
extendedentity.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_FEM_GRIDPART_COMMON_ENTITY_HH
4#define DUNE_FEM_GRIDPART_COMMON_ENTITY_HH
5
6#include <dune/grid/common/entity.hh>
7
8namespace Dune
9{
10
21 template<int cd, int dim, class GridImp, template<int,int,class> class EntityImp>
22 class ExtendedEntity : public Dune::Entity< cd, dim, GridImp, EntityImp >
23 {
25 public:
26 using BaseType::BaseType;
27
28 protected:
29 template<typename T>
30 struct ToVoid
31 {
32 typedef void type;
33 };
34
35 template <typename T, typename dummy = void>
37
38 template <typename T>
39 struct checkHostEntity<T, typename ToVoid<typename T::HostEntityType>::type > : std::true_type{};
40
41
42 template <class Impl, bool>
43 struct HE {
44 typedef Impl HostEntity;
46 };
47
48 template <class Impl>
49 struct HE< Impl, true >
50 {
51 private:
52 // type of grid entity
53 typedef typename Impl::HostGridPartType::GridType::template Codim<cd>::Entity __GEType;
54 public:
55 typedef typename Impl::HostEntityType HostEntity;
56 typedef typename
58 BaseType, __GEType> :: type GridEntity;
59 };
60
61 public:
66
68 operator const HostEntityType& () const
69 {
70 if constexpr ( hasHostEntity )
71 return this->impl().hostEntity();
72 else
73 return this->impl();
74 }
75
77 operator const GridEntityType& () const
78 {
79 if constexpr ( std::is_same< BaseType, GridEntityType > :: value )
80 return *this;
81 else
82 {
83 return gridEntity(*this);
84 }
85 }
86 };
87
88} // end namespace Dune
89#endif
EntityImp< cd, dim, GridImp > Implementation
Wrapper class for wrapped entities added a cast operator to the host entity.
Definition extendedentity.hh:23
BaseType::Implementation ImplementationType
Definition extendedentity.hh:62
static constexpr bool hasHostEntity
Definition extendedentity.hh:63
HE< ImplementationType, hasHostEntity >::GridEntity GridEntityType
Definition extendedentity.hh:65
HE< ImplementationType, hasHostEntity >::HostEntity HostEntityType
Definition extendedentity.hh:64
Definition extendedentity.hh:31
void type
Definition extendedentity.hh:32
Definition extendedentity.hh:36
Definition extendedentity.hh:43
BaseType GridEntity
Definition extendedentity.hh:45
Impl HostEntity
Definition extendedentity.hh:44