1#ifndef DUNE_FEM_GRIDPART_COMMON_GRIDVIEW2GRIDPART_HH 
    2#define DUNE_FEM_GRIDPART_COMMON_GRIDVIEW2GRIDPART_HH 
    9#include <dune/grid/common/gridenums.hh> 
   11#include <dune/fem/gridpart/common/gridpart.hh> 
   12#include <dune/fem/quadrature/caching/twistutility.hh> 
   13#include <dune/fem/space/common/dofmanager.hh> 
   24    template< 
class Gr
idView, 
class Implementation, 
bool storeCopy=true >
 
   25    class GridView2GridPart;
 
   34    template< 
class Gr
idView, 
class Implementation, 
bool storeCopy >
 
   35    struct GridView2GridPartTraits
 
   37      typedef Implementation GridPartType;
 
   39      typedef GridView GridViewType;
 
   42      typedef typename GridViewType::Grid GridType;
 
   43      typedef typename GridViewType::Communication CommunicationType;
 
   50        typedef typename GridViewType::template Codim< codim >::Entity EntityType;
 
   51        typedef typename GridType::template Codim< codim >::EntitySeed EntitySeedType;
 
   53        typedef typename GridViewType::template Codim< codim >::Geometry 
GeometryType;
 
   54        typedef typename GridViewType::template Codim< codim >::LocalGeometry LocalGeometryType;
 
   56        template< PartitionIteratorType pitype >
 
   59          typedef typename GridViewType::template Codim< codim >::template Partition< pitype >::Iterator IteratorType;
 
   63      typedef typename GridViewType::IntersectionIterator IntersectionIteratorType;
 
   65      typedef TwistUtility< GridType > TwistUtilityType;
 
   80    template< 
class Gr
idView, 
class Implementation, 
bool storeCopy >
 
   81    class GridView2GridPart
 
   82      : 
public GridPartInterface< GridView2GridPartTraits< GridView, Implementation, storeCopy > >
 
   84      typedef GridView2GridPart< GridView, Implementation, storeCopy > ThisType;
 
   85      typedef GridView2GridPartTraits< GridView, Implementation, storeCopy > TraitsType;
 
   86      typedef GridPartInterface< TraitsType > BaseType;
 
   93      typedef typename BaseType::GridViewType GridViewType;
 
   97        : 
public BaseType::template Codim< codim >
 
  110      typedef DofManager< GridType > DofManagerType;
 
  112      auto initGv( 
const GridView &gridView )
 
  114        if constexpr ( storeCopy )
 
  127      explicit GridView2GridPart ( 
const GridView &gridView )
 
  128        : gridView_( initGv( gridView ) ),
 
  129          indexSet_( &this->gridView().indexSet() )
 
  132      explicit GridView2GridPart ( GridView &&gridView )
 
  133        : gridView_( 
std::move( gridView ) ),
 
  134          indexSet_( &this->gridView().indexSet() )
 
  140      GridView2GridPart& operator= (
const GridView2GridPart& other ) = 
default;
 
  142      GridView2GridPart ( 
const ThisType &rhs )
 
  143        : gridView_( rhs.gridView_ ),
 
  144          indexSet_( &gridView().indexSet() )
 
  154      const GridType &grid ()
 const { 
return gridView().grid(); }
 
  155      GridType &grid () { 
return const_cast< GridType & 
>( gridView().grid() ); }
 
  158      bool isConforming()
 const 
  160        return gridView().isConforming();
 
  164      const IndexSetType &indexSet ()
 const { assert( indexSet_ ); 
return *indexSet_; }
 
  167      template< 
int codim >
 
  168      typename Codim< codim >::IteratorType begin ()
 const 
  170        return begin< codim, InteriorBorder_Partition >();
 
  174      template< 
int codim, PartitionIteratorType pitype >
 
  175      typename Codim< codim >::template Partition< pitype >::IteratorType begin ()
 const 
  177        return gridView().template begin< codim, pitype >();
 
  181      template< 
int codim >
 
  182      typename Codim< codim >::IteratorType end ()
 const 
  184        return end< codim, InteriorBorder_Partition >();
 
  188      template< 
int codim, PartitionIteratorType pitype >
 
  189      typename Codim< codim >::template Partition< pitype >::IteratorType end ()
 const 
  191        return gridView().template end< codim, pitype >();
 
  195      IntersectionIteratorType ibegin ( 
const typename Codim< 0 >::EntityType &entity )
 const 
  197        return gridView().ibegin( entity );
 
  201      IntersectionIteratorType iend ( 
const typename Codim< 0 >::EntityType &entity )
 const 
  203        return gridView().iend( entity );
 
  207      const CommunicationType &comm ()
 const { 
return gridView().comm(); }
 
  210      template< 
class DataHandle, 
class DataType >
 
  211      void communicate ( CommDataHandleIF< DataHandle, DataType > &dataHandle,
 
  214        gridView().communicate( dataHandle, interface, direction );
 
  218      [[deprecated(
"Use DofManager::sequence instead!")]]
 
  219      int sequence ()
 const { 
return -1; }
 
  222      template < 
class EntitySeed >
 
  223      typename Codim< EntitySeed::codimension >::EntityType
 
  224      entity ( 
const EntitySeed &seed )
 const 
  226        return grid().entity( seed );
 
  230      template <
class Entity>
 
  231      const Entity &convert( 
const Entity& entity )
 const 
  233        return convert< Entity::codimension >( entity );
 
  237      operator const GridView& () 
const { 
return gridView(); }
 
  240      const GridView& gridView()
 const 
  242        if constexpr ( storeCopy )
 
  256      template< 
int codim >
 
  257      const typename Codim< codim >::EntityType &
 
  258      convert( 
const typename Codim< codim >::EntityType &entity )
 const 
  263      std::conditional_t<storeCopy, GridView, const GridView* > gridView_;
 
  264      const IndexSetType* indexSet_;
 
  271    namespace GridPartCapabilities
 
  277      template< 
class Gr
idView, 
class Implementation, 
bool storeCopy >
 
  278      struct hasGrid< GridView2GridPart< GridView, Implementation, storeCopy > >
 
  280        static const bool v = 
true;
 
  283      template< 
class Gr
idView, 
class Implementation, 
bool storeCopy >
 
  284      struct hasSingleGeometryType< GridView2GridPart< GridView, Implementation, storeCopy > >
 
  287        static const unsigned int topologyId
 
  291      template< 
class Gr
idView, 
class Implementation, 
bool storeCopy >
 
  292      struct isCartesian< GridView2GridPart< GridView, Implementation, storeCopy > >
 
  297      template< 
class Gr
idView, 
class Implementation, 
bool storeCopy, 
int codim  >
 
  298      struct hasEntity< GridView2GridPart< GridView, Implementation, storeCopy >, codim >
 
  303      template< 
class Gr
idView, 
class Implementation, 
bool storeCopy, 
int codim >
 
  304      struct canCommunicate< GridView2GridPart< GridView, Implementation, storeCopy >, codim >
 
  309      template< 
class Gr
idView, 
class Implementation, 
bool storeCopy >
 
  310      struct isConforming< GridView2GridPart< GridView, Implementation, storeCopy > >
 
void communicate(CommDataHandleIF< DataHandleImp, DataType > &data, InterfaceType iftype, CommunicationDirection dir) const
corresponding communication method for grid part
Definition: gridpart.hh:292
 
const GridType & grid() const
Returns const reference to the underlying grid.
Definition: gridpart.hh:162
 
Traits::CommunicationType CommunicationType
Collective communication.
Definition: gridpart.hh:97
 
Traits::GridType GridType
type of Grid implementation
Definition: gridpart.hh:87
 
int boundaryId(const IntersectionType &intersection) const
return boundary if given an intersection
Definition: gridpart.hh:277
 
Traits::IntersectionIteratorType IntersectionIteratorType
type of IntersectionIterator
Definition: gridpart.hh:111
 
Traits::IndexSetType IndexSetType
Index set implementation.
Definition: gridpart.hh:92
 
A few common exception classes.
 
@ conforming
Output conforming data.
Definition: common.hh:73
 
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
 
static constexpr bool conforming
Export if this grid view is guaranteed conforming.
Definition: gridview.hh:128
 
Traits::IndexSet IndexSet
type of the index set
Definition: gridview.hh:86
 
Dune namespace.
Definition: alignedallocator.hh:13
 
specialize with 'true' for all codims that a grid can communicate data on (default=false)
Definition: capabilities.hh:97
 
Specialize with 'true' for all codims that a grid implements entities for. (default=false)
Definition: capabilities.hh:58
 
Specialize with 'true' for if the codimension 0 entity of the grid has only one possible geometry typ...
Definition: capabilities.hh:27
 
Specialize with 'true' if the grid is a Cartesian grid. Cartesian grids satisfy the following propert...
Definition: capabilities.hh:48