dune-grid  2.6-git
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 
8 #include <dune/common/hybridutilities.hh>
9 #include <dune/common/std/utility.hh>
10 
13 
14 namespace 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  {
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, int codim >
42  struct hasEntityIterator< GeometryGrid< HostGrid, CoordFunction, Allocator >, codim >
43  {
44  static const bool v = true;
45  };
46 
47 
48  template< class HostGrid, class CoordFunction, class Allocator, int codim >
49  struct canCommunicate< GeometryGrid< HostGrid, CoordFunction, Allocator >, codim >
50  {
52  };
53 
54 
55  template< class HostGrid, class CoordFunction, class Allocator >
56  struct hasBackupRestoreFacilities< GeometryGrid< HostGrid, CoordFunction, Allocator > >
57  {
59  };
60 
61  template< class HostGrid, class CoordFunction, class Allocator >
62  struct isLevelwiseConforming< GeometryGrid< HostGrid, CoordFunction, Allocator > >
63  {
65  };
66 
67  template< class HostGrid, class CoordFunction, class Allocator >
68  struct isLeafwiseConforming< GeometryGrid< HostGrid, CoordFunction, Allocator > >
69  {
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 >
113  {
114  static const int dimension = Grid::dimension;
115 
116  bool hasHostEntity_[ Grid::dimension + 1 ];
117 
118  CodimCache ()
119  {
120  Hybrid::forEach( Std::make_index_sequence< dimension+1 >{},
121  [ & ]( auto i ){ hasHostEntity_[ i ] = Capabilities::hasHostEntity< Grid, i >::v; } );
122  }
123 
124  static CodimCache &instance ()
125  {
126  static CodimCache singleton;
127  return singleton;
128  }
129 
130  public:
131  static bool hasHostEntity ( int codim )
132  {
133  assert( (codim >= 0) && (codim <= dimension) );
134  return instance().hasHostEntity_[ codim ];
135  }
136  };
137 
138  } // namespace Capabilities
139 
140 } // namespace Dune
141 
142 #endif // #ifndef DUNE_GEOGRID_CAPABILITIES_HH
Specialize with &#39;true&#39; if implementation guarantees conforming level grids. (default=false) ...
Definition: common/capabilities.hh:103
Definition: geometrygrid/capabilities.hh:112
Definition: geometrygrid/capabilities.hh:92
specialize with &#39;true&#39; for all codims that a grid provides an iterator for (default=false) ...
Definition: common/capabilities.hh:71
Grid abstract base classThis class is the base class for all grid implementations. Although no virtual functions are used we call it abstract since its methods do not contain an implementation but forward to the methods of the derived class via the Barton-Nackman trick.
Definition: common/grid.hh:373
Specialize with &#39;true&#39; for if the codimension 0 entity of the grid has only one possible geometry typ...
Definition: common/capabilities.hh:24
grid wrapper replacing the geometriesGeometryGrid wraps another DUNE grid and replaces its geometry b...
Definition: declaration.hh:10
Specialize with &#39;true&#39; if implementation provides backup and restore facilities. (default=false) ...
Definition: common/capabilities.hh:121
specialize with &#39;true&#39; for all codims that a grid can communicate data on (default=false) ...
Definition: common/capabilities.hh:94
Specialize with &#39;true&#39; for all codims that a grid implements entities for. (default=false) ...
Definition: common/capabilities.hh:55
Specialize with &#39;true&#39; if the grid implementation is thread safe, while it is not modified...
Definition: common/capabilities.hh:167
Specialize with &#39;true&#39; if implementation guarantees a conforming leaf grid. (default=false) ...
Definition: common/capabilities.hh:112
The dimension of the grid.
Definition: common/grid.hh:387
A set of traits classes to store static information about grid implementation.
Specialize with &#39;true&#39; if the grid implementation is thread safe. (default=false) ...
Definition: common/capabilities.hh:140
static const unsigned int topologyId
Definition: common/capabilities.hh:29
static const bool v
Definition: common/capabilities.hh:26
static bool hasHostEntity(int codim)
Definition: geometrygrid/capabilities.hh:131
Include standard header files.
Definition: agrid.hh:58