1#ifndef DUNE_FEM_ADAPTCALLBACKHANDLE_HH 
    2#define DUNE_FEM_ADAPTCALLBACKHANDLE_HH 
    4#include <dune/grid/common/gridenums.hh> 
   22    template< 
class Gr
id, 
class DofManager, 
class RestrictPro
longOperator >
 
   23    class RestrictProlongWrapper
 
   24    : 
public AdaptDataHandle
 
   25      < Grid, RestrictProlongWrapper< Grid, DofManager, RestrictProlongOperator > >
 
   27      typedef RestrictProlongWrapper< Grid, DofManager, RestrictProlongOperator > This;
 
   28      typedef AdaptDataHandle< Grid, This > Base;
 
   31      DofManager &dofManager_;
 
   32      RestrictProlongOperator &rpOp_;
 
   35      mutable bool wasChanged_ ;
 
   36      bool initializeCalled_;
 
   40      typedef typename Base::Entity Entity;
 
   42      RestrictProlongWrapper ( DofManager &dofManager, RestrictProlongOperator &rpOp )
 
   43      : dofManager_( dofManager ),
 
   46        initializeCalled_( false ),
 
   47        finalizeCalled_( false )
 
   51      RestrictProlongWrapper ( 
const RestrictProlongWrapper& org )
 
   52      : dofManager_( org.dofManager_ ),
 
   54        wasChanged_( org.wasChanged_ ),
 
   55        initializeCalled_( org.initializeCalled_ ),
 
   56        finalizeCalled_( org.finalizeCalled_ )
 
   59      bool isValidEntity( 
const Entity& entity )
 const 
   70      void preAdapt ( 
const unsigned int estimatedAdditionalElements ) { initialize (); }
 
   71      void postAdapt () { finalize(); }
 
   74      void initialize ( 
unsigned int estimatedAdditionalElements = 0 )
 
   77        if( initializeCalled_ ) return ;
 
   85        dofManager_.reserveMemory( estimatedAdditionalElements );
 
   88        initializeCalled_ = 
true;
 
   90        finalizeCalled_ = false ;
 
   98        if( finalizeCalled_ ) return ;
 
  101        if( dofManager_.notifyGlobalChange( wasChanged_ ) )
 
  105          dofManager_.compress();
 
  115        finalizeCalled_ = true ;
 
  118        initializeCalled_ = false ;
 
  122      void preCoarsening ( 
const Entity &father )
 const 
  124        if( isValidEntity( father ) )
 
  126          typedef typename Entity::HierarchicIterator HIterator;
 
  128          bool initialize = 
true;
 
  129          const int childLevel = father.level() + 1;
 
  130          const HIterator end = father.hend( childLevel );
 
  131          for( HIterator it = father.hbegin( childLevel ); it != end; ++it )
 
  133            restrictLocal( father, *it, initialize );
 
  136          rpOp_.restrictFinalize( father );
 
  140      void restrictLocal ( 
const Entity &father, 
const Entity &son, 
bool initialize )
 const 
  142        if( isValidEntity( father ) )
 
  144          dofManager_.indexSetRestrictProlong().restrictLocal( father, son, initialize );
 
  145          rpOp_.restrictLocal( father, son, initialize );
 
  150      void postRefinement ( 
const Entity &father )
 const 
  152        if( isValidEntity( father ) )
 
  154          typedef typename Entity::HierarchicIterator HIterator;
 
  156          bool initialize = 
true;
 
  157          const int childLevel = father.level() + 1;
 
  158          const HIterator end = father.hend( childLevel );
 
  159          for( HIterator it = father.hbegin( childLevel ); it != end; ++it )
 
  161            prolongLocal( father, *it, initialize );
 
  167      void prolongLocal ( 
const Entity &father, 
const Entity &son, 
bool initialize )
 const 
  169        if( isValidEntity( father ) )
 
  171          dofManager_.indexSetRestrictProlong().prolongLocal( father, son, initialize );
 
  172          rpOp_.prolongLocal( father, son, initialize );
 
interfaces and wrappers needed for the callback adaptation provided by AlbertaGrid and dune-ALUGrid
 
Dune namespace.
Definition: alignedallocator.hh:13