1#ifndef DUNE_FEM_GRIDPART_GEOGRIDPART_CORNERSTORAGE_HH
2#define DUNE_FEM_GRIDPART_GEOGRIDPART_CORNERSTORAGE_HH
7#include <dune/grid/geometrygrid/hostcorners.hh>
8#include <dune/grid/geometrygrid/coordfunction.hh>
20 class IsDiscreteFunction;
22 template<
class,
class,
int,
class >
23 class LagrangeDiscreteFunctionSpace;
30 template<
int codim,
class CoordFunction,
class DFSpace =
typename CoordFunction::DiscreteFunctionSpaceType >
33 template<
int codim,
class CoordFunction,
class FunctionSpace,
class Gr
idPart,
class Storage >
37 static_assert( (std::is_same< DFSpace, typename CoordFunction::DiscreteFunctionSpaceType >::value),
"Invalid use of template argument DFSpace." );
42 typedef typename CoordFunctionType::GridPartType::template Codim< codim >::EntityType
HostEntityType;
43 typedef typename CoordFunctionType::RangeType
RangeType;
45 static const int dimRange = CoordFunctionType::FunctionSpaceType::dimRange;
46 static const int dimension = HostEntityType::dimension;
47 static const int mydimension = HostEntityType::mydimension;
51 : coordFunction_( coordFunction ),
52 hostEntity_( hostEntity )
57 const int index = coordFunction_.gridPart().indexSet().subIndex( hostEntity_, i, dimension );
58 assert( (index >= 0) && (index < (
int)(coordFunction_.space().blockMapper().size())) );
60 for(
int k = 0; k < dimRange; ++k )
61 y[ k ] = coordFunction_.dofVector()[ index ][ k ];
66 return hostEntity_.type();
71 return ReferenceElements< typename CoordFunctionType::GridPartType::GridType::ctype, mydimension >::general( type() ).size( mydimension );
75 const CoordFunctionType &coordFunction_;
76 const HostEntityType &hostEntity_;
84 template< int codim, class CoordFunction, bool discrete = std::is_convertible< CoordFunction, IsDiscreteFunction >::value >
87 template<
int codim,
class CoordFunction >
93 typedef typename CoordFunctionType::GridPartType::template Codim< codim >::EntityType
HostEntityType;
94 typedef typename CoordFunctionType::RangeType
RangeType;
98 : coordFunction_( coordFunction ),
99 hostCorners_( hostEntity )
104 coordFunction_.evaluate( hostCorners_[ i ], y );
109 return hostCorners_.type();
114 return hostCorners_.size();
118 const CoordFunction &coordFunction_;
119 GeoGrid::HostCorners< HostEntityType > hostCorners_;
122 template<
int codim,
class CoordFunction >
134 :
BaseType( coordFunction, hostEntity )
143 template<
int mydim,
class Gr
idFamily >
146 typedef typename std::remove_const< GridFamily >::type::Traits Traits;
148 typedef typename std::remove_const< GridFamily >::type::ctype ctype;
150 static const int dimension = std::remove_const< GridFamily >::type::dimension;
151 static const int mydimension = mydim;
152 static const int codimension = dimension - mydimension;
153 static const int dimensionworld = std::remove_const< GridFamily >::type::dimensionworld;
155 typedef FieldVector< ctype, dimensionworld > Coordinate;
157 typedef typename Traits::HostGridPartType HostGridPartType;
158 typedef typename Traits::CoordFunctionType CoordFunctionType;
160 typedef typename HostGridPartType::template Codim< codimension >::EntityType HostEntityType;
166 const HostEntityType &hostEntity )
167 : coordFunctionCaller_( coordFunction, hostEntity )
170 template< std::
size_t size >
171 void calculate ( std::array< Coordinate, size > &corners )
const
173 const std::size_t numCorners = coordFunctionCaller_.numCorners();
174 for( std::size_t i = 0; i < numCorners; ++i )
175 coordFunctionCaller_.evaluate( i, corners[ i ] );
179 const CoordFunctionCallerType coordFunctionCaller_;
187 template<
int mydim,
class Gr
idFamily,
class LocalFunction >
190 typedef typename std::remove_const< GridFamily >::type::Traits Traits;
192 typedef typename std::remove_const< GridFamily >::type::ctype ctype;
194 static const int dimension = std::remove_const< GridFamily >::type::dimension;
195 static const int mydimension = mydim;
196 static const int codimension = dimension - mydimension;
197 static const int dimensionworld = std::remove_const< GridFamily >::type::dimensionworld;
199 typedef FieldVector< ctype, dimensionworld > Coordinate;
205 : localCoordFunction_( localCoordFunction )
208 template< std::
size_t size >
209 void calculate ( std::array< Coordinate, size > &corners )
const
211 assert( (localCoordFunction_.
numDofs() % dimensionworld) == 0 );
212 const std::size_t numCorners = localCoordFunction_.
numDofs() / dimensionworld;
213 assert( size >= numCorners );
214 for( std::size_t i = 0; i < numCorners; ++i )
216 for(
int k = 0; k < dimensionworld; ++k )
217 corners[ i ][ k ] = localCoordFunction_[ i*dimensionworld + k ];
232 template<
class Gr
idFamily >
235 typedef typename std::remove_const< GridFamily >::type::Traits Traits;
237 typedef typename std::remove_const< GridFamily >::type::ctype ctype;
239 static const int dimension = std::remove_const< GridFamily >::type::dimension;
240 static const int codimension = 1;
241 static const int mydimension = dimension-codimension;
242 static const int dimensionworld = std::remove_const< GridFamily >::type::dimensionworld;
244 typedef FieldVector< ctype, dimensionworld > Coordinate;
246 typedef typename Traits::template Codim< 0 >::Geometry ElementGeometryType;
247 typedef typename Traits::template Codim< codimension >::LocalGeometry HostLocalGeometryType;
249 typedef typename ElementGeometryType::Implementation ElementGeometryImplType;
253 const HostLocalGeometryType &hostLocalGeometry )
254 : elementGeometry_( elementGeometry ),
255 hostLocalGeometry_( hostLocalGeometry )
258 template< std::
size_t size >
259 void calculate ( std::array< Coordinate, size > &corners )
const
261 const std::size_t numCorners = hostLocalGeometry_.corners();
262 assert( size >= numCorners );
263 for( std::size_t i = 0; i < numCorners; ++i )
264 corners[ i ] = elementGeometry_.global( hostLocalGeometry_.corner( i ) );
268 const ElementGeometryImplType &elementGeometry_;
269 HostLocalGeometryType hostLocalGeometry_;
277 template<
int mydim,
int cdim,
class Gr
idFamily >
280 typedef typename std::remove_const< GridFamily >::type::ctype ctype;
282 typedef FieldVector< ctype, cdim > Coordinate;
284 typedef std::array< Coordinate, (1 << mydim) > Coords;
294 template<
class LCFTraits >
Definition: bindguard.hh:11
interface for local functions
Definition: localfunction.hh:77
int numDofs() const
obtain the number of local DoFs
Definition: localfunction.hh:351
static const int dimRange
dimension of the range
Definition: localfunction.hh:119
Lagrange discrete function space.
Definition: lagrange/space.hh:131
Definition: cornerstorage.hh:31
void evaluate(unsigned int i, RangeType &y) const
Definition: cornerstorage.hh:55
GeoDiscreteCoordFunctionCaller(const CoordFunction &coordFunction, const HostEntityType &hostEntity)
Definition: cornerstorage.hh:49
CoordFunction CoordFunctionType
Definition: cornerstorage.hh:40
CoordFunctionType::GridPartType::template Codim< codim >::EntityType HostEntityType
Definition: cornerstorage.hh:42
GeometryType type() const
Definition: cornerstorage.hh:64
CoordFunctionType::RangeType RangeType
Definition: cornerstorage.hh:43
std::size_t numCorners() const
Definition: cornerstorage.hh:69
Definition: cornerstorage.hh:85
GeometryType type() const
Definition: cornerstorage.hh:107
GeoCoordFunctionCaller(const CoordFunction &coordFunction, const HostEntityType &hostEntity)
Definition: cornerstorage.hh:96
std::size_t numCorners() const
Definition: cornerstorage.hh:112
CoordFunctionType::RangeType RangeType
Definition: cornerstorage.hh:94
CoordFunctionType::GridPartType::template Codim< codim >::EntityType HostEntityType
Definition: cornerstorage.hh:93
CoordFunction CoordFunctionType
Definition: cornerstorage.hh:91
void evaluate(unsigned int i, RangeType &y) const
Definition: cornerstorage.hh:102
BaseType::HostEntityType HostEntityType
Definition: cornerstorage.hh:130
GeoCoordFunctionCaller(const CoordFunctionType &coordFunction, const HostEntityType &hostEntity)
Definition: cornerstorage.hh:132
BaseType::CoordFunctionType CoordFunctionType
Definition: cornerstorage.hh:129
Definition: cornerstorage.hh:145
void calculate(std::array< Coordinate, size > &corners) const
Definition: cornerstorage.hh:171
GeoCoordVector(const CoordFunctionType &coordFunction, const HostEntityType &hostEntity)
Definition: cornerstorage.hh:165
Definition: cornerstorage.hh:189
LocalFunction LocalCoordFunctionType
Definition: cornerstorage.hh:202
GeoLocalCoordVector(const LocalCoordFunctionType &localCoordFunction)
Definition: cornerstorage.hh:204
void calculate(std::array< Coordinate, size > &corners) const
Definition: cornerstorage.hh:209
Definition: cornerstorage.hh:234
void calculate(std::array< Coordinate, size > &corners) const
Definition: cornerstorage.hh:259
GeoIntersectionCoordVector(const ElementGeometryImplType &elementGeometry, const HostLocalGeometryType &hostLocalGeometry)
Definition: cornerstorage.hh:252
Definition: cornerstorage.hh:279
GeoCornerStorage(const GeoCoordVector< mydim, GridFamily > &coords)
Definition: cornerstorage.hh:289
Coords::const_iterator const_iterator
Definition: cornerstorage.hh:287
const Coordinate & operator[](unsigned int i) const
Definition: cornerstorage.hh:305
GeoCornerStorage(const GeoIntersectionCoordVector< GridFamily > &coords)
Definition: cornerstorage.hh:300
const_iterator end() const
Definition: cornerstorage.hh:311
GeoCornerStorage(const GeoLocalCoordVector< mydim, GridFamily, LCFTraits > &coords)
Definition: cornerstorage.hh:295
const_iterator begin() const
Definition: cornerstorage.hh:310
A vector valued function space.
Definition: functionspace.hh:60