dune-grid 2.8.0
Loading...
Searching...
No Matches
geometrygrid/capabilities.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_GEOGRID_CAPABILITIES_HH
4#define DUNE_GEOGRID_CAPABILITIES_HH
5
6#include <cassert>
7#include <type_traits>
8#include <utility>
9
10#include <dune/common/hybridutilities.hh>
11
14
15namespace Dune
16{
17
18 // Capabilities
19 // ------------
20
21 namespace Capabilities
22 {
23
24 // Capabilities from dune-grid
25 // ---------------------------
26
27 template< class HostGrid, class CoordFunction, class Allocator >
28 struct hasSingleGeometryType< GeometryGrid< HostGrid, CoordFunction, Allocator > >
29 {
32 };
33
34
35 template< class HostGrid, class CoordFunction, class Allocator, int codim >
36 struct hasEntity< GeometryGrid< HostGrid, CoordFunction, Allocator >, codim >
37 {
38 static const bool v = true;
39 };
40
41
42 template< class HostGrid, class CoordFunction, class Allocator, int codim >
43 struct hasEntityIterator< GeometryGrid< HostGrid, CoordFunction, Allocator >, codim >
44 {
46 };
47
48
49 template< class HostGrid, class CoordFunction, class Allocator, int codim >
50 struct canCommunicate< GeometryGrid< HostGrid, CoordFunction, Allocator >, codim >
51 {
53 };
54
55
56 template< class HostGrid, class CoordFunction, class Allocator >
57 struct hasBackupRestoreFacilities< GeometryGrid< HostGrid, CoordFunction, Allocator > >
58 {
59 static const bool v = hasBackupRestoreFacilities< HostGrid >::v && std::is_default_constructible< CoordFunction >::value;
60 };
61
62 template< class HostGrid, class CoordFunction, class Allocator >
63 struct isLevelwiseConforming< GeometryGrid< HostGrid, CoordFunction, Allocator > >
64 {
66 };
67
68 template< class HostGrid, class CoordFunction, class Allocator >
69 struct isLeafwiseConforming< GeometryGrid< HostGrid, CoordFunction, Allocator > >
70 {
72 };
73
74 template< class HostGrid, class CoordFunction, class Allocator >
75 struct threadSafe< GeometryGrid< HostGrid, CoordFunction, Allocator > >
76 {
77 static const bool v = false;
78 };
79
80 template< class HostGrid, class CoordFunction, class Allocator >
81 struct viewThreadSafe< GeometryGrid< HostGrid, CoordFunction, Allocator > >
82 {
83 static const bool v = false;
84 };
85
86
87
88
89 // hasHostEntity
90 // -------------
91
92 template< class Grid, int codim >
94
95 template< class Grid, int codim >
96 struct hasHostEntity< const Grid, codim >
97 {
98 static const bool v = hasHostEntity< Grid, codim >::v;
99 };
100
101 template< class HostGrid, class CoordFunction, class Allocator, int codim >
102 struct hasHostEntity< GeometryGrid< HostGrid, CoordFunction, Allocator >, codim >
103 {
104 static const bool v = hasEntity< HostGrid, codim >::v;
105 };
106
107
108
109 // CodimCache
110 // ----------
111
112 template< class Grid >
114 {
115 static const int dimension = Grid::dimension;
116
117 bool hasHostEntity_[ Grid::dimension + 1 ];
118
119 CodimCache ()
120 {
121 Hybrid::forEach( std::make_index_sequence< dimension+1 >{},
122 [ & ]( auto i ){ hasHostEntity_[ i ] = Capabilities::hasHostEntity< Grid, i >::v; } );
123 }
124
125 static CodimCache &instance ()
126 {
127 static CodimCache singleton;
128 return singleton;
129 }
130
131 public:
132 static bool hasHostEntity ( int codim )
133 {
134 assert( (codim >= 0) && (codim <= dimension) );
135 return instance().hasHostEntity_[ codim ];
136 }
137 };
138
139 } // namespace Capabilities
140
141} // namespace Dune
142
143#endif // #ifndef DUNE_GEOGRID_CAPABILITIES_HH
Include standard header files.
Definition: agrid.hh:58
Specialize with 'true' for if the codimension 0 entity of the grid has only one possible geometry typ...
Definition: common/capabilities.hh:25
static const bool v
Definition: common/capabilities.hh:26
static const unsigned int topologyId
Definition: common/capabilities.hh:29
Specialize with 'true' for all codims that a grid implements entities for. (default=false)
Definition: common/capabilities.hh:56
static const bool v
Definition: common/capabilities.hh:57
specialize with 'true' for all codims that a grid provides an iterator for (default=hasEntity<codim>:...
Definition: common/capabilities.hh:72
static const bool v
Definition: common/capabilities.hh:73
specialize with 'true' for all codims that a grid can communicate data on (default=false)
Definition: common/capabilities.hh:95
static const bool v
Definition: common/capabilities.hh:96
Specialize with 'true' if implementation guarantees conforming level grids. (default=false)
Definition: common/capabilities.hh:104
static const bool v
Definition: common/capabilities.hh:105
Specialize with 'true' if implementation guarantees a conforming leaf grid. (default=false)
Definition: common/capabilities.hh:113
static const bool v
Definition: common/capabilities.hh:114
Specialize with 'true' if implementation provides backup and restore facilities. (default=false)
Definition: common/capabilities.hh:122
static const bool v
Definition: common/capabilities.hh:123
Specialize with 'true' if the grid implementation is thread safe. (default=false)
Definition: common/capabilities.hh:140
static const bool v
Definition: common/capabilities.hh:141
Specialize with 'true' if the grid implementation is thread safe, while it is not modified....
Definition: common/capabilities.hh:167
static const bool v
Definition: common/capabilities.hh:168
Grid abstract base class.
Definition: common/grid.hh:372
@ dimension
The dimension of the grid.
Definition: common/grid.hh:386
Definition: geometrygrid/capabilities.hh:93
Definition: geometrygrid/capabilities.hh:114
static bool hasHostEntity(int codim)
Definition: geometrygrid/capabilities.hh:132
grid wrapper replacing the geometries
Definition: geometrygrid/grid.hh:84
A set of traits classes to store static information about grid implementation.