1#ifndef DUNE_FEM_SPACE_PADAPTIVE_RESTRICTPROLONG_HH 
    2#define DUNE_FEM_SPACE_PADAPTIVE_RESTRICTPROLONG_HH 
    4#include <dune/geometry/referenceelements.hh> 
    6#include <dune/fem/function/localfunction/localfunction.hh> 
    7#include <dune/fem/space/lagrange/lagrangepoints.hh> 
   19    template< 
class G, 
class LagrangePo
intSetProv
ider >
 
   20    struct PLagrangeLocalRestrictProlong
 
   26      typedef FieldVector< ctype, dimension > DomainVector;
 
   28      typedef typename Grid::template Codim< 0 >::Entity Entity;
 
   30      typedef typename LagrangePointSetProvider :: LagrangePointSetType  LagrangePointSet;
 
   33      typedef typename Entity::LocalGeometry LocalGeometry;
 
   35      typedef typename LagrangePointSet::template Codim< 0 >::SubEntityIteratorType
 
   39      PLagrangeLocalRestrictProlong ( 
const LagrangePointSetProvider &lpsProvider )
 
   40      : lpsProvider_( lpsProvider )
 
   43      template< 
class DomainField >
 
   44      void setFatherChildWeight ( 
const DomainField &weight ) {}
 
   46      template< 
class LFFather, 
class LFSon, 
class LocalGeometry >
 
   47      void restrictLocal ( LFFather &lfFather, 
const LFSon &lfSon,
 
   48                           const LocalGeometry &geometryInFather, 
bool initialize )
 const 
   50        static const int dimRange = LFSon::dimRange;
 
   52        const Entity &father = lfFather.entity();
 
   53        const Entity &son = lfSon.entity();
 
   55        auto refSon = referenceElement< ctype, dimension >( son.type() );
 
   57        const LagrangePointSet &pointSet = lagrangePointSet( father );
 
   59        const EntityDofIterator send = pointSet.template endSubEntity< 0 >( 0 );
 
   60        for( EntityDofIterator sit = pointSet.template beginSubEntity< 0 >( 0 ); sit != send; ++sit )
 
   62          const unsigned int dof = *sit;
 
   63          const DomainVector &pointInFather = pointSet.point( dof );
 
   64          const DomainVector pointInSon = geometryInFather.local( pointInFather );
 
   65          if( refSon.checkInside( pointInSon ) )
 
   67            typename LFSon::RangeType phi;
 
   68            lfSon.evaluate( pointInSon, phi );
 
   69            for( 
int coordinate = 0; coordinate < dimRange; ++coordinate )
 
   70              lfFather[ dimRange * dof + coordinate ] = phi[ coordinate ];
 
   74      template< 
class LFFather >
 
   75      void restrictFinalize ( LFFather &lfFather )
 const 
   79      template< 
class LFFather, 
class LFSon, 
class LocalGeometry >
 
   80      void prolongLocal ( 
const LFFather &lfFather, LFSon &lfSon,
 
   81                          const LocalGeometry &geometryInFather, 
bool initialize )
 const 
   83        static const int dimRange = LFFather::dimRange;
 
   85        const Entity &son = lfSon.entity();
 
   87        const LagrangePointSet &pointSet = lagrangePointSet( son );
 
   89        const EntityDofIterator send = pointSet.template endSubEntity< 0 >( 0 );
 
   90        for( EntityDofIterator sit = pointSet.template beginSubEntity< 0 >( 0 ); sit != send; ++sit )
 
   92          const unsigned int dof = *sit;
 
   93          const DomainVector &pointInSon = pointSet.point( dof );
 
   94          const DomainVector pointInFather = geometryInFather.global( pointInSon );
 
   96          typename LFFather::RangeType phi;
 
   97          lfFather.evaluate( pointInFather, phi );
 
   98          for( 
int coordinate = 0; coordinate < dimRange; ++coordinate )
 
  100            const int idx = dimRange * dof + coordinate  ;
 
  101            lfSon[ idx ] = phi[ coordinate ];
 
  106      template< 
class ArgLocal, 
class DestLocal >
 
  107      void localInterpolation ( 
const ArgLocal &argLocal,
 
  108                                DestLocal &destLocal )
 const 
  110        static const int dimRange = DestLocal::dimRange;
 
  112        const Entity &entity = destLocal.entity();
 
  114        const LagrangePointSet &pointSet = lagrangePointSet( entity );
 
  116        const EntityDofIterator send = pointSet.template endSubEntity< 0 >( 0 );
 
  117        for( EntityDofIterator sit = pointSet.template beginSubEntity< 0 >( 0 ); sit != send; ++sit )
 
  119          const unsigned int dof = *sit;
 
  120          const DomainVector &localPoint = pointSet.point( dof );
 
  122          typename ArgLocal::RangeType phi;
 
  123          argLocal.evaluate( localPoint, phi );
 
  124          for( 
int coordinate = 0; coordinate < dimRange; ++coordinate )
 
  126            const int idx = dimRange * dof + coordinate  ;
 
  127            destLocal[ idx ] = phi[ coordinate ];
 
  132      bool needCommunication ()
 const { 
return false; }
 
  134      const LagrangePointSet &lagrangePointSet ( 
const Entity &entity )
 const 
  136        return lpsProvider_.lagrangePointSet( entity );
 
  140      const LagrangePointSetProvider& lpsProvider_;
 
static constexpr int dimension
The dimension of the grid.
Definition: grid.hh:387
 
ct ctype
Define type used for coordinates in grid module.
Definition: grid.hh:518
 
Dune namespace.
Definition: alignedallocator.hh:13