Dune Core Modules (2.5.0)

entityseed.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_ENTITYSEED_HH
4#define DUNE_GEOGRID_ENTITYSEED_HH
5
7
9#include <dune/grid/geometrygrid/capabilities.hh>
10
11namespace Dune
12{
13
14 namespace GeoGrid
15 {
16
17 // Internal Forward Declarations
18 // -----------------------------
19
20 template< int codim, class Grid, bool fake = !(Capabilities::hasHostEntity< Grid, codim >::v) >
21 class EntitySeed;
22
23
24
25 // EntitySeed (real)
26 // -----------------
27
28 template< int codim, class Grd >
29 class EntitySeed< codim, Grd, false >
30 {
31 typedef typename std::remove_const< Grd >::type::Traits Traits;
32
33 public:
34 static const int codimension = codim;
35 static const int dimension = Traits::dimension;
36 static const int mydimension = dimension - codimension;
37 static const int dimensionworld = Traits::dimensionworld;
38
39 static const bool fake = false;
40
41 typedef typename Traits::Grid Grid;
42 typedef typename Traits::template Codim< codim >::Entity Entity;
43
44 typedef typename Traits::HostGrid HostGrid;
45 typedef typename HostGrid::template Codim< codim >::EntitySeed HostEntitySeed;
46
48 EntitySeed ( )
49 {}
50
51 explicit EntitySeed ( const HostEntitySeed &hostEntitySeed )
52 : hostEntitySeed_( hostEntitySeed )
53 {}
54
56 bool isValid() const
57 {
58 return hostEntitySeed_.isValid();
59 }
60
61 const HostEntitySeed &hostEntitySeed () const { return hostEntitySeed_; }
62
63 private:
64 HostEntitySeed hostEntitySeed_;
65 };
66
67
68
69 // EntitySeed (fake)
70 // -----------------
71
72 template< int codim, class Grd >
73 class EntitySeed< codim, Grd, true >
74 {
75 typedef typename std::remove_const< Grd >::type::Traits Traits;
76
77 public:
78 static const int codimension = codim;
79 static const int dimension = Traits::dimension;
80 static const int mydimension = dimension - codimension;
81 static const int dimensionworld = Traits::dimensionworld;
82
83 static const bool fake = true;
84
85 typedef typename Traits::Grid Grid;
86 typedef typename Traits::template Codim< codim >::Entity Entity;
87
88 typedef typename Traits::HostGrid HostGrid;
89 typedef typename HostGrid::template Codim< 0 >::EntitySeed HostElementSeed;
90
92 EntitySeed ( )
93 {}
94
95 explicit EntitySeed ( const HostElementSeed &hostElementSeed, unsigned int subEntity )
96 : hostElementSeed_( hostElementSeed ),
97 subEntity_( subEntity )
98 {}
99
101 bool isValid() const
102 {
103 return hostElementSeed_.isValid();
104 }
105
106 const HostElementSeed &hostElementSeed () const { return hostElementSeed_; }
107 unsigned int subEntity () const { return subEntity_; }
108
109 private:
110 HostElementSeed hostElementSeed_;
111 unsigned int subEntity_;
112 };
113
114 } // namespace GeoGrid
115
116} // namespace Dune
117
118#endif // #ifndef DUNE_GEOGRID_ENTITYSEED_HH
Interface class EntitySeed.
Dune namespace.
Definition: alignment.hh:11
Traits for type conversions and type information.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 23, 23:29, 2024)