5#ifndef DUNE_GEOGRID_CORNERSTORAGE_HH 
    6#define DUNE_GEOGRID_CORNERSTORAGE_HH 
   10#include <dune/grid/geometrygrid/coordfunctioncaller.hh> 
   21    template< 
int mydim, 
class Gr
id, 
bool fake >
 
   25    template< 
int mydim, 
class Gr
id >
 
   26    class CoordVector< mydim, Grid, false >
 
   28      typedef typename std::remove_const< Grid >::type::Traits Traits;
 
   30      typedef typename Traits::ctype ctype;
 
   32      static const int dimension = Traits::dimension;
 
   33      static const int mydimension = mydim;
 
   34      static const int codimension = dimension - mydimension;
 
   35      static const int dimensionworld = Traits::dimensionworld;
 
   37      typedef FieldVector< ctype, dimensionworld > Coordinate;
 
   39      typedef typename Traits::HostGrid HostGrid;
 
   40      typedef typename Traits::CoordFunction CoordFunction;
 
   42      typedef typename HostGrid::template Codim< codimension >::Entity HostEntity;
 
   44      typedef GeoGrid :: CoordFunctionCaller< HostEntity, typename CoordFunction::Interface >
 
   48      CoordVector ( 
const HostEntity &hostEntity,
 
   49                    const CoordFunction &coordFunction )
 
   50        : coordFunctionCaller_( hostEntity, coordFunction )
 
   53      template< std::
size_t size >
 
   54      void calculate ( std::array< Coordinate, size > (&corners) )
 const 
   56        const std::size_t numCorners = coordFunctionCaller_.size();
 
   57        assert( 
size >= numCorners );
 
   58        for( std::size_t i = 0; i < numCorners; ++i )
 
   59          coordFunctionCaller_.evaluate( i, corners[ i ] );
 
   63      const CoordFunctionCaller coordFunctionCaller_;
 
   67    template< 
int mydim, 
class Gr
id >
 
   68    class CoordVector< mydim, Grid, true >
 
   70      typedef typename std::remove_const< Grid > :: type :: Traits Traits;
 
   72      typedef typename Traits::ctype ctype;
 
   74      static const int dimension = Traits::dimension;
 
   75      static const int mydimension = mydim;
 
   76      static const int codimension = dimension - mydimension;
 
   77      static const int dimensionworld = Traits::dimensionworld;
 
   79      typedef FieldVector< ctype, dimensionworld > Coordinate;
 
   81      typedef typename Traits::HostGrid HostGrid;
 
   82      typedef typename Traits::CoordFunction CoordFunction;
 
   84      typedef typename HostGrid::template Codim< 0 >::Entity HostElement;
 
   86      typedef GeoGrid::CoordFunctionCaller< HostElement, typename CoordFunction::Interface >
 
   90      CoordVector ( 
const HostElement &hostElement,
 
   91                    const unsigned int subEntity,
 
   92                    const CoordFunction &coordFunction )
 
   93        : coordFunctionCaller_( hostElement, coordFunction ),
 
   94          subEntity_( subEntity )
 
   97      template< std::
size_t size >
 
   98      void calculate ( std::array< Coordinate, size > (&corners) )
 const 
  101        auto refElement = referenceElement< ctype, dimension >( type );
 
  102        const std::size_t numCorners = refElement.size( subEntity_, codimension, dimension );
 
  103        assert( 
size >= numCorners );
 
  104        for( std::size_t i = 0; i < numCorners; ++i )
 
  106          const std::size_t j = refElement.subEntity( subEntity_, codimension, i, dimension );
 
  107          coordFunctionCaller_.evaluate( j, corners[ i ] );
 
  112      const CoordFunctionCaller coordFunctionCaller_;
 
  113      const unsigned int subEntity_;
 
  121    template< 
class Gr
id >
 
  122    class IntersectionCoordVector
 
  124      typedef typename std::remove_const< Grid >::type::Traits Traits;
 
  126      typedef typename Traits::ctype ctype;
 
  128      static const int dimension = Traits::dimension;
 
  129      static const int codimension = 1;
 
  130      static const int mydimension = dimension-codimension;
 
  131      static const int dimensionworld = Traits::dimensionworld;
 
  133      typedef FieldVector< ctype, dimensionworld > Coordinate;
 
  135      typedef typename Traits::HostGrid HostGrid;
 
  137      typedef typename Traits::template Codim< 0 >::GeometryImpl ElementGeometryImpl;
 
  138      typedef typename Traits::template Codim< codimension >::LocalGeometry HostLocalGeometry;
 
  141      IntersectionCoordVector ( 
const ElementGeometryImpl &elementGeometry,
 
  142                                const HostLocalGeometry &hostLocalGeometry )
 
  143        : elementGeometry_( elementGeometry ),
 
  144          hostLocalGeometry_( hostLocalGeometry )
 
  147      template< std::
size_t size >
 
  148      void calculate ( std::array< Coordinate, size > (&corners) )
 const 
  150        const std::size_t numCorners = hostLocalGeometry_.corners();
 
  151        assert( 
size >= numCorners );
 
  152        for( std::size_t i = 0; i < numCorners; ++i )
 
  153          corners[ i ] = elementGeometry_.global( hostLocalGeometry_.corner( i ) );
 
  156      template< 
unsigned int numCorners >
 
  157      void calculate ( Coordinate (&corners)[ numCorners ] )
 const 
  159        assert( numCorners == hostLocalGeometry_.corners() );
 
  163      const ElementGeometryImpl &elementGeometry_;
 
  164      HostLocalGeometry hostLocalGeometry_;
 
  172    template< 
int mydim, 
int cdim, 
class Gr
id >
 
  175      typedef typename std::remove_const< Grid >::type::Traits Traits;
 
  177      typedef typename Traits::ctype ctype;
 
  180      typedef std::array< Coordinate, (1 << mydim) > Coords;
 
  183      typedef typename Coords::const_iterator const_iterator;
 
  185      template< 
bool fake >
 
  186      explicit CornerStorage ( 
const CoordVector< mydim, Grid, fake > &coords )
 
  188        coords.calculate( coords_ );
 
  191      explicit CornerStorage ( 
const IntersectionCoordVector< Grid > &coords )
 
  193        coords.calculate( coords_ );
 
  196      const Coordinate &operator[] ( 
unsigned int i )
 const 
  201      const_iterator begin ()
 const { 
return coords_.begin(); }
 
  202      const_iterator end ()
 const { 
return coords_.end(); }
 
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
 
Dune namespace.
Definition: alignedallocator.hh:13
 
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75