DUNE-FEM (unstable)

policies.hh
1#ifndef DUNE_FEM_GRIDPART_COMMON_POLICIES_HH
2#define DUNE_FEM_GRIDPART_COMMON_POLICIES_HH
3
4#warning "This header should not be needed anymore. Remove it from the include list!"
5
6
7#include <type_traits>
8#include <utility>
9
10#include <dune/grid/common/gridview.hh>
11
12#include <dune/fem/gridpart/common/gridpart2gridview.hh>
13
14namespace Dune
15{
16
17 namespace Fem
18 {
19
20 // Internal forward declaration
21 // ----------------------------
22
23 template< class Traits >
24 class GridPartPolicies;
25
26
27
28#ifndef DOXYGEN
29
30 namespace __GridPartPolicies
31 {
32
33 // hasGridView
34 // -----------
35
36 template< class Traits >
37 std::true_type __hasGridView ( const Traits &, const typename Traits::GridViewType * = nullptr );
38
39 std::false_type __hasGridView ( ... );
40
41 template< class Traits >
42 struct hasGridView
43 {
44 static const bool v = decltype( __hasGridView( std::declval< Traits >() ) )::value;
45 };
46
47
48
49 // HasGridView
50 // -----------
51
52 template< class Traits, bool hasGridView = hasGridView< Traits >::v >
53 class HasGridView;
54
55 template< class Traits >
56 class HasGridView< Traits, true >
57 {
58 public:
59 typedef typename Traits::GridViewType GridViewType;
60 };
61
62 template< class Traits >
63 class HasGridView< Traits, false >
64 {
65 typedef typename Traits::GridPartType GridPartType;
66
67 public:
69
70 protected:
71 HasGridView () = default;
72
73 public:
74 operator GridPart2GridViewImpl< GridPartType > () const
75 {
76 return GridPart2GridViewImpl< GridPartType >( impl() );
77 }
78
79 private:
80 const GridPartType &impl () const
81 {
82 return static_cast< const GridPartType & >( *this );
83 }
84 };
85
86 } // namespace __GridPartPolicies
87
88#endif // #ifndef DOXYGEN
89
90
91
92 // GridPartPolicies
93 // ----------------
94
95 template< class Traits >
96 class GridPartPolicies
97 : public __GridPartPolicies::HasGridView< Traits >
98 {};
99
100 } // namespace Fem
101
102} // namespace Dune
103
104#endif // #ifndef DUNE_FEM_GRIDPART_COMMON_POLICIES_HH
Grid view abstract base class.
Definition: gridview.hh:66
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 27, 22:29, 2024)