dune-grid  3.0-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/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, int codim >
41  struct canCommunicate< GeometryGrid< HostGrid, CoordFunction, Allocator >, codim >
42  {
44  };
45 
46 
47  template< class HostGrid, class CoordFunction, class Allocator >
48  struct hasBackupRestoreFacilities< GeometryGrid< HostGrid, CoordFunction, Allocator > >
49  {
51  };
52 
53  template< class HostGrid, class CoordFunction, class Allocator >
54  struct isLevelwiseConforming< GeometryGrid< HostGrid, CoordFunction, Allocator > >
55  {
57  };
58 
59  template< class HostGrid, class CoordFunction, class Allocator >
60  struct isLeafwiseConforming< GeometryGrid< HostGrid, CoordFunction, Allocator > >
61  {
63  };
64 
65  template< class HostGrid, class CoordFunction, class Allocator >
66  struct threadSafe< GeometryGrid< HostGrid, CoordFunction, Allocator > >
67  {
68  static const bool v = false;
69  };
70 
71  template< class HostGrid, class CoordFunction, class Allocator >
72  struct viewThreadSafe< GeometryGrid< HostGrid, CoordFunction, Allocator > >
73  {
74  static const bool v = false;
75  };
76 
77 
78 
79 
80  // hasHostEntity
81  // -------------
82 
83  template< class Grid, int codim >
84  struct hasHostEntity;
85 
86  template< class Grid, int codim >
87  struct hasHostEntity< const Grid, codim >
88  {
89  static const bool v = hasHostEntity< Grid, codim >::v;
90  };
91 
92  template< class HostGrid, class CoordFunction, class Allocator, int codim >
93  struct hasHostEntity< GeometryGrid< HostGrid, CoordFunction, Allocator >, codim >
94  {
95  static const bool v = hasEntity< HostGrid, codim >::v;
96  };
97 
98 
99 
100  // CodimCache
101  // ----------
102 
103  template< class Grid >
105  {
106  static const int dimension = Grid::dimension;
107 
108  template< int codim >
109  struct BuildCache;
110 
111  bool hasHostEntity_[ Grid::dimension + 1 ];
112 
113  CodimCache ()
114  {
115  Dune::ForLoop< BuildCache, 0, dimension >::apply( hasHostEntity_ );
116  }
117 
118  static CodimCache &instance ()
119  {
120  static CodimCache singleton;
121  return singleton;
122  }
123 
124  public:
125  static bool hasHostEntity ( int codim )
126  {
127  assert( (codim >= 0) && (codim <= dimension) );
128  return instance().hasHostEntity_[ codim ];
129  }
130  };
131 
132  template< class Grid >
133  template< int codim >
134  struct CodimCache< Grid >::BuildCache
135  {
136  static void apply ( bool (&hasHostEntity)[ dimension + 1 ] )
137  {
139  }
140  };
141 
142  } // namespace Capabilities
143 
144 } // namespace Dune
145 
146 #endif // #ifndef DUNE_GEOGRID_CAPABILITIES_HH
Dune::Capabilities::hasSingleGeometryType::topologyId
static const unsigned int topologyId
Definition: common/capabilities.hh:29
Dune::Capabilities::canCommunicate
specialize with 'true' for all codims that a grid can communicate data on (default=false)
Definition: common/capabilities.hh:68
Dune
Include standard header files.
Definition: agrid.hh:59
declaration.hh
Dune::Capabilities::threadSafe
Specialize with 'true' if the grid implementation is thread safe. (default=false)
Definition: common/capabilities.hh:114
Dune::Capabilities::canCommunicate::v
static const bool v
Definition: common/capabilities.hh:70
Dune::Capabilities::isLeafwiseConforming
Specialize with 'true' if implementation guarantees a conforming leaf grid. (default=false)
Definition: common/capabilities.hh:86
Dune::Capabilities::hasBackupRestoreFacilities::v
static const bool v
Definition: common/capabilities.hh:97
Dune::Capabilities::hasEntity
Specialize with 'true' for all codims that a grid implements entities for. (default=false)
Definition: common/capabilities.hh:55
Dune::Capabilities::hasBackupRestoreFacilities
Specialize with 'true' if implementation provides backup and restore facilities. (default=false)
Definition: common/capabilities.hh:95
Dune::Capabilities::CodimCache::hasHostEntity
static bool hasHostEntity(int codim)
Definition: geometrygrid/capabilities.hh:125
Dune::Capabilities::isLeafwiseConforming::v
static const bool v
Definition: common/capabilities.hh:88
Dune::Capabilities::hasSingleGeometryType
Specialize with 'true' for if the codimension 0 entity of the grid has only one possible geometry typ...
Definition: common/capabilities.hh:24
Dune::Capabilities::isLevelwiseConforming
Specialize with 'true' if implementation guarantees conforming level grids. (default=false)
Definition: common/capabilities.hh:77
Dune::Capabilities::hasSingleGeometryType::v
static const bool v
Definition: common/capabilities.hh:26
Dune::Capabilities::viewThreadSafe::v
static const bool v
Definition: common/capabilities.hh:142
Dune::Grid
Grid abstract base class.
Definition: common/grid.hh:373
capabilities.hh
A set of traits classes to store static information about grid implementation.
Dune::Capabilities::hasEntity::v
static const bool v
Definition: common/capabilities.hh:57
Dune::Grid::dimension
The dimension of the grid.
Definition: common/grid.hh:387
Dune::Capabilities::isLevelwiseConforming::v
static const bool v
Definition: common/capabilities.hh:79
Dune::Capabilities::threadSafe::v
static const bool v
Definition: common/capabilities.hh:115
Dune::Capabilities::CodimCache
Definition: geometrygrid/capabilities.hh:104
Dune::GeometryGrid
grid wrapper replacing the geometries
Definition: declaration.hh:10
Dune::Capabilities::hasHostEntity
Definition: geometrygrid/capabilities.hh:84
Dune::Capabilities::viewThreadSafe
Specialize with 'true' if the grid implementation is thread safe, while it is not modified....
Definition: common/capabilities.hh:141