5#ifndef DUNE_ALBERTA_NODEPROJECTION_HH 
    6#define DUNE_ALBERTA_NODEPROJECTION_HH 
   10#include <dune/grid/common/boundaryprojection.hh> 
   12#include <dune/grid/albertagrid/misc.hh> 
   26    template< 
class Proj, 
class Impl >
 
   27    class ProjectionFactory;
 
   35    class DuneBoundaryProjection
 
   37      typedef DuneBoundaryProjection< dim > This;
 
   40      static const int dimension = dim;
 
   42      typedef Alberta::ElementInfo< dimension > ElementInfo;
 
   43      typedef FieldVector< Real, dimWorld > GlobalCoordinate;
 
   46      typedef std::shared_ptr< const Projection > ProjectionPtr;
 
   48      explicit DuneBoundaryProjection ( 
const ProjectionPtr &projection )
 
   49        : projection_( projection )
 
   53      void operator() ( 
const ElementInfo & , 
const LocalVector ,
 
   54                        GlobalVector global )
 const 
   57        for( 
int i = 0; i < dimWorld; ++i )
 
   59        GlobalCoordinate y = projection() ( x );
 
   60        for( 
int i = 0; i < dimWorld; ++i )
 
   64      const Projection &projection ()
 const 
   70      ProjectionPtr projection_;
 
   78    template< 
class Proj, 
class Impl >
 
   79    class ProjectionFactoryInterface
 
   81      typedef ProjectionFactoryInterface< Proj, Impl > This;
 
   83      friend class ProjectionFactory< Proj, Impl >;
 
   86      typedef Proj Projection;
 
   88      static const int dimension = Projection::dimension;
 
   90      typedef Alberta::ElementInfo< dimension > ElementInfo;
 
   93      ProjectionFactoryInterface ()
 
   96      ProjectionFactoryInterface ( 
const This &other );
 
   97      This &operator= ( 
const This &other );
 
  100      bool hasProjection ( 
const ElementInfo &elementInfo, 
const int face )
 const 
  102        return asImpl().hasProjection( elementInfo, face );
 
  105      bool hasProjection ( 
const ElementInfo &elementInfo )
 const 
  107        return asImpl().hasProjection( elementInfo );
 
  110      Projection projection ( 
const ElementInfo &elementInfo, 
const int face )
 const 
  112        return asImpl().projection( elementInfo, face );
 
  115      Projection projection ( 
const ElementInfo &elementInfo )
 const 
  117        return asImpl().projection( elementInfo );
 
  121      const Impl &asImpl ()
 const 
  123        return static_cast< const Impl & 
>( *this );
 
  132    template< 
class Proj, 
class Impl >
 
  133    class ProjectionFactory
 
  134      : 
public ProjectionFactoryInterface< Proj, Impl >
 
  136      typedef ProjectionFactory< Proj, Impl > This;
 
  137      typedef ProjectionFactoryInterface< Proj, Impl > Base;
 
  140      typedef typename Base::Projection Projection;
 
  141      typedef typename Base::ElementInfo ElementInfo;
 
  148      bool hasProjection ( 
const ElementInfo &elementInfo, 
const int face ) 
const;
 
  149      bool hasProjection ( 
const ElementInfo &elementInfo ) 
const;
 
  151      Projection projection ( 
const ElementInfo &elementInfo, 
const int face ) 
const;
 
  152      Projection projection ( 
const ElementInfo &elementInfo ) 
const;
 
  161    class DuneGlobalBoundaryProjectionFactory
 
  162      : 
public ProjectionFactory< DuneBoundaryProjection< dim >, DuneGlobalBoundaryProjectionFactory< dim > >
 
  164      typedef DuneGlobalBoundaryProjectionFactory< dim > This;
 
  165      typedef ProjectionFactory< DuneBoundaryProjection< dim >, This > Base;
 
  168      typedef typename Base::Projection Projection;
 
  169      typedef typename Base::ElementInfo ElementInfo;
 
  171      typedef typename Projection::ProjectionPtr DuneProjectionPtr;
 
  173      DuneGlobalBoundaryProjectionFactory ( 
const DuneProjectionPtr &projection )
 
  174        : projection_( projection )
 
  177      bool hasProjection ( 
const ElementInfo &elementInfo, 
const int face )
 const 
  182      bool hasProjection ( 
const ElementInfo &elementInfo )
 const 
  187      Projection projection ( 
const ElementInfo &elementInfo, 
const int face )
 const 
  192      Projection projection ( 
const ElementInfo &elementInfo )
 const 
  198      const Projection projection_;
 
  206    struct BasicNodeProjection
 
  207      : 
public ALBERTA NODE_PROJECTION
 
  209      explicit BasicNodeProjection ( 
unsigned int boundaryIndex )
 
  210        : boundaryIndex_( boundaryIndex )
 
  215      virtual ~BasicNodeProjection ()
 
  218      unsigned int boundaryIndex ()
 const 
  220        return boundaryIndex_;
 
  224      unsigned int boundaryIndex_;
 
  232    template< 
int dim, 
class Projection >
 
  234      : 
public BasicNodeProjection
 
  236      typedef NodeProjection< dim, Projection > This;
 
  237      typedef BasicNodeProjection Base;
 
  240      static const int dimension = dim;
 
  242      typedef Alberta::ElementInfo< dimension > ElementInfo;
 
  245      Projection projection_;
 
  248      NodeProjection ( 
unsigned int boundaryIndex, 
const Projection &projection )
 
  249        : Base( boundaryIndex ),
 
  250          projection_( projection )
 
  258      static void apply ( GlobalVector global, 
const EL_INFO *info, 
const LocalVector local )
 
  260        const ElementInfo elementInfo = ElementInfo::createFake( *info );
 
  262        assert( (info->fill_flag & FillFlags< dimension >::projection) != 0 );
 
  263        const This *nodeProjection = 
static_cast< const This * 
>( info->active_projection );
 
  265        assert( nodeProjection != NULL );
 
  266        nodeProjection->projection_( elementInfo, local, global );
 
provides a wrapper for ALBERTA's el_info structure
 
Dune namespace.
Definition: alignedallocator.hh:13
 
Interface class for vertex projection at the boundary.
Definition: boundaryprojection.hh:32