dune-grid  2.3.1-rc1
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/forloop.hh>
9 
12 
13 namespace Dune
14 {
15 
16  // Capabilities
17  // ------------
18 
19  namespace Capabilities
20  {
21 
22  // Capabilities from dune-grid
23  // ---------------------------
24 
25  template< class HostGrid, class CoordFunction, class Allocator >
26  struct hasSingleGeometryType< GeometryGrid< HostGrid, CoordFunction, Allocator > >
27  {
30  };
31 
32 
33  template< class HostGrid, class CoordFunction, class Allocator, int codim >
34  struct hasEntity< GeometryGrid< HostGrid, CoordFunction, Allocator >, codim >
35  {
36  static const bool v = true;
37  };
38 
39 
40  template< class HostGrid, class CoordFunction, class Allocator >
41  struct isParallel< GeometryGrid< HostGrid, CoordFunction, Allocator > >
42  {
43  static const bool v = isParallel< HostGrid >::v;
44  };
45 
46 
47  template< class HostGrid, class CoordFunction, class Allocator, int codim >
48  struct canCommunicate< GeometryGrid< HostGrid, CoordFunction, Allocator >, codim >
49  {
51  };
52 
53 
54  template< class HostGrid, class CoordFunction, class Allocator >
55  struct hasBackupRestoreFacilities< GeometryGrid< HostGrid, CoordFunction, Allocator > >
56  {
58  };
59 
60  template< class HostGrid, class CoordFunction, class Allocator >
61  struct isLevelwiseConforming< GeometryGrid< HostGrid, CoordFunction, Allocator > >
62  {
64  };
65 
66  template< class HostGrid, class CoordFunction, class Allocator >
67  struct isLeafwiseConforming< GeometryGrid< HostGrid, CoordFunction, Allocator > >
68  {
70  };
71 
72  template< class HostGrid, class CoordFunction, class Allocator >
73  struct threadSafe< GeometryGrid< HostGrid, CoordFunction, Allocator > >
74  {
75  static const bool v = false;
76  };
77 
78  template< class HostGrid, class CoordFunction, class Allocator >
79  struct viewThreadSafe< GeometryGrid< HostGrid, CoordFunction, Allocator > >
80  {
81  static const bool v = false;
82  };
83 
84 
85 
86 
87  // hasHostEntity
88  // -------------
89 
90  template< class Grid, int codim >
91  struct hasHostEntity;
92 
93  template< class Grid, int codim >
94  struct hasHostEntity< const Grid, codim >
95  {
96  static const bool v = hasHostEntity< Grid, codim >::v;
97  };
98 
99  template< class HostGrid, class CoordFunction, class Allocator, int codim >
100  struct hasHostEntity< GeometryGrid< HostGrid, CoordFunction, Allocator >, codim >
101  {
102  static const bool v = hasEntity< HostGrid, codim >::v;
103  };
104 
105 
106 
107  // CodimCache
108  // ----------
109 
110  template< class Grid >
112  {
113  static const int dimension = Grid::dimension;
114 
115  template< int codim >
116  struct BuildCache;
117 
118  bool hasHostEntity_[ Grid::dimension + 1 ];
119 
120  CodimCache ()
121  {
122  Dune::ForLoop< BuildCache, 0, dimension >::apply( hasHostEntity_ );
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  template< class Grid >
140  template< int codim >
141  struct CodimCache< Grid >::BuildCache
142  {
143  static void apply ( bool (&hasHostEntity)[ dimension + 1 ] )
144  {
146  }
147  };
148 
149  } // namespace Capabilities
150 
151 } // namespace Dune
152 
153 #endif // #ifndef DUNE_GEOGRID_CAPABILITIES_HH
static const bool v
Definition: common/capabilities.hh:57
static const bool v
Definition: common/capabilities.hh:79
static const bool v
Definition: common/capabilities.hh:66
Specialize with 'true' if implementation guarantees conforming level grids. (default=false) ...
Definition: common/capabilities.hh:86
The dimension of the grid.
Definition: common/grid.hh:400
static bool hasHostEntity(int codim)
Definition: geometrygrid/capabilities.hh:132
Specialize with 'true' if implementation guarantees a conforming leaf grid. (default=false) ...
Definition: common/capabilities.hh:95
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:386
static const bool v
Definition: common/capabilities.hh:124
A set of traits classes to store static information about grid implementation.
Specialize with 'true' if implementation supports parallelism. (default=false)
Definition: common/capabilities.hh:64
static const bool v
Definition: common/capabilities.hh:26
static const bool v
Definition: common/capabilities.hh:151
static const bool v
Definition: common/capabilities.hh:88
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:55
static const bool v
Definition: common/capabilities.hh:106
Definition: geometrygrid/capabilities.hh:91
static const bool v
Definition: common/capabilities.hh:97
Specialize with 'true' if the grid implementation is thread safe. (default=false) ...
Definition: common/capabilities.hh:123
Specialize with 'true' for if the codimension 0 entity of the grid has only one possible geometry typ...
Definition: common/capabilities.hh:24
Specialize with 'true' if implementation provides backup and restore facilities. (default=false) ...
Definition: common/capabilities.hh:104
Definition: geometrygrid/capabilities.hh:111
grid wrapper replacing the geometriesGeometryGrid wraps another DUNE grid and replaces its geometry b...
Definition: geometrygrid/declaration.hh:10
Specialize with 'true' if the grid implementation is thread safe, while it is not modified...
Definition: common/capabilities.hh:150
specialize with 'true' for all codims that a grid can communicate data on (default=false) ...
Definition: common/capabilities.hh:77