Dune Core Modules (2.4.1)

capabilities.hh
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_GEOGRID_CAPABILITIES_HH
4#define DUNE_GEOGRID_CAPABILITIES_HH
5
6#include <cassert>
7
10
12#include <dune/grid/geometrygrid/declaration.hh>
13
14namespace Dune
15{
16
17 // Capabilities
18 // ------------
19
20 namespace Capabilities
21 {
22
23 // Capabilities from dune-grid
24 // ---------------------------
25
26 template< class HostGrid, class CoordFunction, class Allocator >
27 struct hasSingleGeometryType< GeometryGrid< HostGrid, CoordFunction, Allocator > >
28 {
29 static const bool v = hasSingleGeometryType< HostGrid > :: v;
30 static const unsigned int topologyId = hasSingleGeometryType< HostGrid > :: topologyId;
31 };
32
33
34 template< class HostGrid, class CoordFunction, class Allocator, int codim >
35 struct hasEntity< GeometryGrid< HostGrid, CoordFunction, Allocator >, codim >
36 {
37 static const bool v = true;
38 };
39
40
41 template< class HostGrid, class CoordFunction, class Allocator >
42 struct DUNE_DEPRECATED_MSG("Capabilities::isParallel will be removed after dune-grid-2.4.") isParallel< GeometryGrid< HostGrid, CoordFunction, Allocator > >
43 {
44 static const bool DUNE_DEPRECATED_MSG("Capabilities::isParallel will be removed after dune-grid-2.4.") v = isParallel< HostGrid >::v;
45 };
46
47
48 template< class HostGrid, class CoordFunction, class Allocator, int codim >
49 struct canCommunicate< GeometryGrid< HostGrid, CoordFunction, Allocator >, codim >
50 {
51 static const bool v = canCommunicate< HostGrid, codim >::v;
52 };
53
54
55 template< class HostGrid, class CoordFunction, class Allocator >
56 struct hasBackupRestoreFacilities< GeometryGrid< HostGrid, CoordFunction, Allocator > >
57 {
58 static const bool v = hasBackupRestoreFacilities< HostGrid >::v;
59 };
60
61 template< class HostGrid, class CoordFunction, class Allocator >
62 struct isLevelwiseConforming< GeometryGrid< HostGrid, CoordFunction, Allocator > >
63 {
64 static const bool v = isLevelwiseConforming< HostGrid >::v;
65 };
66
67 template< class HostGrid, class CoordFunction, class Allocator >
68 struct isLeafwiseConforming< GeometryGrid< HostGrid, CoordFunction, Allocator > >
69 {
70 static const bool v = isLeafwiseConforming< HostGrid >::v;
71 };
72
73 template< class HostGrid, class CoordFunction, class Allocator >
74 struct threadSafe< GeometryGrid< HostGrid, CoordFunction, Allocator > >
75 {
76 static const bool v = false;
77 };
78
79 template< class HostGrid, class CoordFunction, class Allocator >
80 struct viewThreadSafe< GeometryGrid< HostGrid, CoordFunction, Allocator > >
81 {
82 static const bool v = false;
83 };
84
85
86
87
88 // hasHostEntity
89 // -------------
90
91 template< class Grid, int codim >
92 struct hasHostEntity;
93
94 template< class Grid, int codim >
95 struct hasHostEntity< const Grid, codim >
96 {
97 static const bool v = hasHostEntity< Grid, codim >::v;
98 };
99
100 template< class HostGrid, class CoordFunction, class Allocator, int codim >
101 struct hasHostEntity< GeometryGrid< HostGrid, CoordFunction, Allocator >, codim >
102 {
103 static const bool v = hasEntity< HostGrid, codim >::v;
104 };
105
106
107
108 // CodimCache
109 // ----------
110
111 template< class Grid >
112 class CodimCache
113 {
114 static const int dimension = Grid::dimension;
115
116 template< int codim >
117 struct BuildCache;
118
119 bool hasHostEntity_[ Grid::dimension + 1 ];
120
121 CodimCache ()
122 {
124 }
125
126 static CodimCache &instance ()
127 {
128 static CodimCache singleton;
129 return singleton;
130 }
131
132 public:
133 static bool hasHostEntity ( int codim )
134 {
135 assert( (codim >= 0) && (codim <= dimension) );
136 return instance().hasHostEntity_[ codim ];
137 }
138 };
139
140 template< class Grid >
141 template< int codim >
142 struct CodimCache< Grid >::BuildCache
143 {
144 static void apply ( bool (&hasHostEntity)[ dimension + 1 ] )
145 {
146 hasHostEntity[ codim ] = Capabilities::hasHostEntity< Grid, codim >::v;
147 }
148 };
149
150 } // namespace Capabilities
151
152} // namespace Dune
153
154#endif // #ifndef DUNE_GEOGRID_CAPABILITIES_HH
A static loop using TMP.
Definition: forloop.hh:110
@ dimension
The dimension of the grid.
Definition: grid.hh:402
A set of traits classes to store static information about grid implementation.
Definition of the DUNE_DEPRECATED macro for the case that config.h is not available.
A static for loop for template meta-programming.
struct DUNE_DEPRECATED_MSG("Capabilities::isParallel will be removed after dune-grid-2.4.") isParallel< ALU3dGrid< elType
YaspGrid is parallel.
Dune namespace.
Definition: alignment.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)