1 #ifndef DUNE_GEOGRID_CORNERSTORAGE_HH
2 #define DUNE_GEOGRID_CORNERSTORAGE_HH
15 template<
int mydim,
class Gr
id,
bool fake >
19 template<
int mydim,
class Gr
id >
22 typedef typename remove_const< Grid >::type::Traits Traits;
24 typedef typename Traits::ctype ctype;
26 static const int dimension = Traits::dimension;
27 static const int mydimension = mydim;
28 static const int codimension = dimension - mydimension;
29 static const int dimensionworld = Traits::dimensionworld;
31 typedef FieldVector< ctype, dimensionworld > Coordinate;
33 typedef typename Traits::HostGrid HostGrid;
34 typedef typename Traits::CoordFunction CoordFunction;
36 typedef typename HostGrid::template Codim< codimension >::Entity HostEntity;
43 const CoordFunction &coordFunction )
44 : coordFunctionCaller_( hostEntity, coordFunction )
47 template<
unsigned int numCorners >
48 void calculate ( Coordinate (&corners)[ numCorners ] )
const
50 assert( numCorners == coordFunctionCaller_.numCorners() );
51 for(
unsigned int i = 0; i < numCorners; ++i )
52 coordFunctionCaller_.evaluate( i, corners[ i ] );
60 template<
int mydim,
class Gr
id >
63 typedef typename remove_const< Grid > :: type :: Traits Traits;
65 typedef typename Traits::ctype ctype;
67 static const int dimension = Traits::dimension;
68 static const int mydimension = mydim;
69 static const int codimension = dimension - mydimension;
70 static const int dimensionworld = Traits::dimensionworld;
72 typedef FieldVector< ctype, dimensionworld > Coordinate;
74 typedef typename Traits::HostGrid HostGrid;
75 typedef typename Traits::CoordFunction CoordFunction;
77 typedef typename HostGrid::template Codim< 0 >::Entity HostElement;
84 const unsigned int subEntity,
85 const CoordFunction &coordFunction )
86 : coordFunctionCaller_( hostElement, coordFunction ),
87 subEntity_( subEntity )
90 template<
unsigned int numCorners >
91 void calculate ( Coordinate (&corners)[ numCorners ] )
const
94 const GenericReferenceElement< ctype, dimension > &refElement
95 = GenericReferenceElements< ctype, dimension >::general( type );
96 assert( numCorners == refElement.size( subEntity_, codimension, dimension ) );
98 for(
unsigned int i = 0; i < numCorners; ++i )
100 const unsigned int j = refElement.subEntity( subEntity_, codimension, i, dimension );
101 coordFunctionCaller_.evaluate( j, corners[ i ] );
107 const unsigned int subEntity_;
115 template<
class Gr
id >
118 typedef typename remove_const< Grid >::type::Traits Traits;
120 typedef typename Traits::ctype ctype;
122 static const int dimension = Traits::dimension;
123 static const int codimension = 1;
124 static const int mydimension = dimension-codimension;
125 static const int dimensionworld = Traits::dimensionworld;
127 typedef FieldVector< ctype, dimensionworld > Coordinate;
129 typedef typename Traits::HostGrid HostGrid;
131 typedef typename Traits::template Codim< 0 >::GeometryImpl ElementGeometryImpl;
132 typedef typename Traits::template Codim< codimension >::LocalGeometry HostLocalGeometry;
136 const HostLocalGeometry &hostLocalGeometry )
137 : elementGeometry_( elementGeometry ),
138 hostLocalGeometry_( hostLocalGeometry )
141 template<
unsigned int numCorners >
142 void calculate ( Coordinate (&corners)[ numCorners ] )
const
144 assert( numCorners == hostLocalGeometry_.corners() );
145 for(
unsigned int i = 0; i < numCorners; ++i )
146 corners[ i ] = elementGeometry_.global( hostLocalGeometry_.corner( i ) );
150 const ElementGeometryImpl &elementGeometry_;
151 HostLocalGeometry hostLocalGeometry_;
160 template<
class Topology,
class Gr
id >
163 typedef typename remove_const< Grid >::type::Traits Traits;
165 typedef typename Traits::ctype ctype;
167 static const int dimension = Traits::dimension;
168 static const int mydimension = Topology::dimension;
169 static const int codimension = dimension - mydimension;
170 static const int dimensionworld = Traits::dimensionworld;
172 typedef FieldVector< ctype, dimensionworld > Coordinate;
175 static const unsigned int size = Topology::numCorners;
177 template<
class SubTopology >
183 template<
bool fake >
187 coords.calculate( coords_ );
195 template<
class Mapping,
unsigned int codim >
197 CornerStorage (
const GenericGeometry::SubMappingCoords< Mapping, codim > &coords )
199 for(
unsigned int i = 0; i <
size; ++i )
200 coords_[ i ] = coords[ i ];
209 Coordinate coords_[
size ];
216 #endif // #ifndef DUNE_GEOGRID_CORNERSTORAGE_HH