3 #ifndef DUNE_GEOGRID_CORNERSTORAGE_HH
4 #define DUNE_GEOGRID_CORNERSTORAGE_HH
6 #include <dune/common/array.hh>
19 template<
int mydim,
class Gr
id,
bool fake >
23 template<
int mydim,
class Gr
id >
26 typedef typename remove_const< Grid >::type::Traits Traits;
28 typedef typename Traits::ctype ctype;
30 static const int dimension = Traits::dimension;
31 static const int mydimension = mydim;
32 static const int codimension = dimension - mydimension;
33 static const int dimensionworld = Traits::dimensionworld;
35 typedef FieldVector< ctype, dimensionworld > Coordinate;
37 typedef typename Traits::HostGrid HostGrid;
38 typedef typename Traits::CoordFunction CoordFunction;
40 typedef typename HostGrid::template Codim< codimension >::Entity HostEntity;
47 const CoordFunction &coordFunction )
48 : coordFunctionCaller_( hostEntity, coordFunction )
51 template< std::
size_t size >
52 void calculate ( array< Coordinate, size > (&corners) )
const
54 const std::size_t numCorners = coordFunctionCaller_.size();
55 assert( size >= numCorners );
56 for( std::size_t i = 0; i < numCorners; ++i )
57 coordFunctionCaller_.evaluate( i, corners[ i ] );
65 template<
int mydim,
class Gr
id >
68 typedef typename remove_const< Grid > :: type :: Traits Traits;
70 typedef typename Traits::ctype ctype;
72 static const int dimension = Traits::dimension;
73 static const int mydimension = mydim;
74 static const int codimension = dimension - mydimension;
75 static const int dimensionworld = Traits::dimensionworld;
77 typedef FieldVector< ctype, dimensionworld > Coordinate;
79 typedef typename Traits::HostGrid HostGrid;
80 typedef typename Traits::CoordFunction CoordFunction;
82 typedef typename HostGrid::template Codim< 0 >::Entity HostElement;
89 const unsigned int subEntity,
90 const CoordFunction &coordFunction )
91 : coordFunctionCaller_( hostElement, coordFunction ),
92 subEntity_( subEntity )
95 template< std::
size_t size >
96 void calculate ( array< Coordinate, size > (&corners) )
const
99 const ReferenceElement< ctype, dimension > &refElement
100 = ReferenceElements< ctype, dimension >::general( type );
101 const std::size_t numCorners = refElement.size( subEntity_, codimension, dimension );
102 assert( size >= numCorners );
103 for( std::size_t i = 0; i < numCorners; ++i )
105 const std::size_t j = refElement.subEntity( subEntity_, codimension, i, dimension );
106 coordFunctionCaller_.evaluate( j, corners[ i ] );
112 const unsigned int subEntity_;
120 template<
class Gr
id >
123 typedef typename remove_const< Grid >::type::Traits Traits;
125 typedef typename Traits::ctype ctype;
127 static const int dimension = Traits::dimension;
128 static const int codimension = 1;
129 static const int mydimension = dimension-codimension;
130 static const int dimensionworld = Traits::dimensionworld;
132 typedef FieldVector< ctype, dimensionworld > Coordinate;
134 typedef typename Traits::HostGrid HostGrid;
136 typedef typename Traits::template Codim< 0 >::GeometryImpl ElementGeometryImpl;
137 typedef typename Traits::template Codim< codimension >::LocalGeometry HostLocalGeometry;
141 const HostLocalGeometry &hostLocalGeometry )
142 : elementGeometry_( elementGeometry ),
143 hostLocalGeometry_( hostLocalGeometry )
146 template< std::
size_t size >
147 void calculate ( array< Coordinate, size > (&corners) )
const
149 const std::size_t numCorners = hostLocalGeometry_.corners();
150 assert( size >= numCorners );
151 for( std::size_t i = 0; i < numCorners; ++i )
152 corners[ i ] = elementGeometry_.global( hostLocalGeometry_.corner( i ) );
155 template<
unsigned int numCorners >
156 void calculate ( Coordinate (&corners)[ numCorners ] )
const
158 assert( numCorners == hostLocalGeometry_.corners() );
162 const ElementGeometryImpl &elementGeometry_;
163 HostLocalGeometry hostLocalGeometry_;
171 template<
int mydim,
int cdim,
class Gr
id >
174 typedef typename remove_const< Grid >::type::Traits Traits;
176 typedef typename Traits::ctype ctype;
177 typedef FieldVector< ctype, cdim > Coordinate;
179 typedef array< Coordinate, (1 << mydim) > Coords;
184 template<
bool fake >
187 coords.calculate( coords_ );
211 #endif // #ifndef DUNE_GEOGRID_CORNERSTORAGE_HH
void calculate(array< Coordinate, size >(&corners)) const
Definition: cornerstorage.hh:52
CornerStorage(const CoordVector< mydim, Grid, fake > &coords)
Definition: cornerstorage.hh:185
void calculate(array< Coordinate, size >(&corners)) const
Definition: cornerstorage.hh:96
const_iterator end() const
Definition: cornerstorage.hh:201
CoordVector(const HostElement &hostElement, const unsigned int subEntity, const CoordFunction &coordFunction)
Definition: cornerstorage.hh:88
Definition: coordfunctioncaller.hh:19
IntersectionCoordVector(const ElementGeometryImpl &elementGeometry, const HostLocalGeometry &hostLocalGeometry)
Definition: cornerstorage.hh:140
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
Definition: cornerstorage.hh:121
Coords::const_iterator const_iterator
Definition: cornerstorage.hh:182
CoordVector(const HostEntity &hostEntity, const CoordFunction &coordFunction)
Definition: cornerstorage.hh:46
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:388
const_iterator begin() const
Definition: cornerstorage.hh:200
const Coordinate & operator[](unsigned int i) const
Definition: cornerstorage.hh:195
CornerStorage(const IntersectionCoordVector< Grid > &coords)
Definition: cornerstorage.hh:190
void calculate(array< Coordinate, size >(&corners)) const
Definition: cornerstorage.hh:147
void calculate(Coordinate(&corners)[numCorners]) const
Definition: cornerstorage.hh:156
Definition: cornerstorage.hh:172
Definition: cornerstorage.hh:20