dune-grid  2.2.1
albertagrid/datahandle.hh
Go to the documentation of this file.
1 #ifndef DUNE_ALBERTAGRIDDATAHANDLE_HH
2 #define DUNE_ALBERTAGRIDDATAHANDLE_HH
3 
4 #include <iostream>
5 
7 
12 
13 #if HAVE_ALBERTA
14 
15 namespace Dune
16 {
17 
18  namespace Alberta
19  {
20 
21  template< class Grid, class RestrictProlongOperator >
23  {
24  static const int dimension = Grid::dimension;
25 
26  typedef typename Grid::template Codim< 0 >::Entity Entity;
28  typedef typename EntityObject::ImplementationType EntityImp;
29 
32 
33  Grid &grid_;
34  RestrictProlongOperator &rpOp_;
35  EntityObject father_;
36 
37  public:
38  AdaptRestrictProlongHandler ( Grid &grid, RestrictProlongOperator &rpOp )
39  : grid_( grid ),
40  rpOp_( rpOp ),
41  father_( EntityImp( grid_ ) )
42  {}
43 
44  void restrictLocal ( const Patch &patch, int i )
45  {
46  ElementInfo fatherInfo = patch.elementInfo( i, grid_.levelProvider() );
47  Grid::getRealImplementation( father_ ).setElement( fatherInfo, 0 );
48  rpOp_.preCoarsening( (const Entity &)father_ );
49  }
50 
51  void prolongLocal ( const Patch &patch, int i )
52  {
53  ElementInfo fatherInfo = patch.elementInfo( i, grid_.levelProvider() );
54  Grid::getRealImplementation( father_ ).setElement( fatherInfo, 0 );
55  rpOp_.postRefinement( (const Entity &)father_ );
56  }
57  };
58 
59  }
60 
61 }
62 
63 #endif // #if HAVE_ALBERTA
64 
65 #endif