dune-grid  2.2.0
alugrid/2d/datahandle.hh
Go to the documentation of this file.
1 #ifndef DUNE_ALU2DGRIDDATAHANDLE_HH
2 #define DUNE_ALU2DGRIDDATAHANDLE_HH
3 
4 //- system includes
5 #include <iostream>
6 
8 
9 //- local includes
10 #include "alu2dinclude.hh"
11 
12 using std::endl;
13 using std::cout;
14 using std::flush;
15 
16 namespace ALU2DSPACENAME
17 {
18 
20 //
21 // --AdaptRestrictProlong
22 //
24 template< class GridType, class AdaptDataHandle >
26 : public AdaptRestrictProlong2d ALU2DDIMWORLD( GridType::dimensionworld, GridType::elementType )
27 {
28  GridType & grid_;
30  typedef typename EntityType :: ImplementationType RealEntityType;
32 
33  EntityType & reFather_;
34  EntityType & reSon_;
35  RealEntityType & realFather_;
36  RealEntityType & realSon_;
37 
38  AdaptDataHandle &rp_;
39 
40  int maxlevel_;
41 
42 
43 public:
45  AdaptRestrictProlong2dImpl ( GridType &grid,
46  EntityType &f, RealEntityType &rf,
47  EntityType &s, RealEntityType &rs,
48  AdaptDataHandle &rp )
49  : grid_(grid)
50  , reFather_(f)
51  , reSon_(s)
52  , realFather_(rf)
53  , realSon_(rs)
54  , rp_(rp)
55  , maxlevel_(-1)
56  {
57  }
58 
60  {}
61 
63  int preCoarsening ( HElementType &father )
64  {
65  maxlevel_ = std::max( maxlevel_, father.level() );
66  //father.resetRefinedTag();
67  realFather_.setElement( father );
68  rp_.preCoarsening( reFather_ );
69 
70  return 0;
71  }
72 
74  int postRefinement ( HElementType &father )
75  {
76  maxlevel_ = std::max( maxlevel_, father.level()+1 );
77  //father.resetRefinedTag();
78  realFather_.setElement( father );
79  rp_.postRefinement( reFather_ );
80 
81  return 0;
82  }
83 
84  int maxLevel () const { return maxlevel_; }
85 };
86 
87 } // namespace ALU2DSPACENAME
88 
89 #endif // #ifndef DUNE_ALU2DGRIDDATAHANDLE_HH