dune-grid  2.4.1
adaptcallback.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_ADAPTCALLBACK_HH
4 #define DUNE_ADAPTCALLBACK_HH
5 
12 namespace Dune
13 {
14 
15  // Internal Forward Declarations
16  // -----------------------------
17 
18  template< class Grid, class Impl >
20 
21 
22 
23  // AdaptDataHandleInterface
24  // ------------------------
25 
29  template< class Grid, class Impl >
31  {
33 
34  friend class AdaptDataHandle< Grid, Impl >;
35 
36  public:
37  typedef typename Grid::template Codim< 0 >::Entity Entity;
38 
39  private:
41  {}
42 
43  AdaptDataHandleInterface ( const This & );
44  This &operator= ( const This & );
45 
46  public:
52  void preCoarsening ( const Entity &father )
53  {
54  asImp().preCoarsening( father );
55  }
56 
62  void postRefinement ( const Entity &father )
63  {
64  asImp().postRefinement( father );
65  }
66 
67  void restrictLocal( const Entity &father, const Entity& son, bool initialize )
68  {
69  asImp().restrictLocal( father, son, initialize );
70  }
71 
72  void prolongLocal( const Entity &father, const Entity& son, bool initialize )
73  {
74  asImp().prolongLocal( father, son, initialize );
75  }
76 
77  protected:
78  const Impl &asImp () const { return static_cast< const Impl & >( *this ); }
79  Impl &asImp () { return static_cast< Impl & >( *this ); }
80  };
81 
82 
83 
84  // AdaptDataHandle
85  // ---------------
86 
87  template< class Grid, class Impl >
88  class AdaptDataHandle
89  : public AdaptDataHandleInterface< Grid, Impl >
90  {
91  typedef AdaptDataHandle< Grid, Impl > This;
92  typedef AdaptDataHandleInterface< Grid, Impl > Base;
93 
94  public:
95  typedef typename Base::Entity Entity;
96 
97  protected:
99  {}
100 
101  private:
102  AdaptDataHandle ( const This & );
103  This &operator= ( const This & );
104 
105  void preCoarsening ( const Entity &father );
106  void postRefinement ( const Entity &father );
107  };
108 
109 
110  // CombinedAdaptProlongRestrict
111  // ----------------------------
112 
114  template <class A, class B >
116  {
118  A& _a;
119  B& _b;
120  public:
122  CombinedAdaptProlongRestrict ( A& a, B& b ) : _a ( a ) , _b ( b )
123  {}
124 
126  template <class Entity>
127  void restrictLocal ( const Entity &father, const Entity &son, bool initialize )
128  {
129  _a.restrictLocal(father,son,initialize);
130  _b.restrictLocal(father,son,initialize);
131  }
132 
134  template <class Entity>
135  void prolongLocal ( const Entity &father, const Entity &son, bool initialize )
136  {
137  _a.prolongLocal(father,son,initialize);
138  _b.prolongLocal(father,son,initialize);
139  }
140  };
141 
142 } // end namespace Dune
143 
144 #endif
AdaptDataHandle()
Definition: adaptcallback.hh:98
void postRefinement(const Entity &father)
call back for activity to take place on newly created elements below the father element.
Definition: adaptcallback.hh:62
friend class AdaptDataHandle< Grid, Impl >
Definition: adaptcallback.hh:34
Grid::template Codim< 0 >::Entity Entity
Definition: adaptcallback.hh:37
void restrictLocal(const Entity &father, const Entity &son, bool initialize)
Definition: adaptcallback.hh:67
void prolongLocal(const Entity &father, const Entity &son, bool initialize)
Definition: adaptcallback.hh:72
Wrapper class for entities.
Definition: common/entity.hh:61
CombinedAdaptProlongRestrict(A &a, B &b)
constructor storing the two references
Definition: adaptcallback.hh:122
Definition: adaptcallback.hh:19
Base::Entity Entity
Definition: adaptcallback.hh:95
Grid abstract base classThis class is the base class for all grid implementations. Although no virtual functions are used we call it abstract since its methods do not contain an implementation but forward to the methods of the derived class via the Barton-Nackman trick.
Definition: common/grid.hh:388
const Impl & asImp() const
Definition: adaptcallback.hh:78
Impl & asImp()
Definition: adaptcallback.hh:79
class for combining 2 index sets together for adaptation process
Definition: adaptcallback.hh:115
void prolongLocal(const Entity &father, const Entity &son, bool initialize)
prolong data to children
Definition: adaptcallback.hh:135
Include standard header files.
Definition: agrid.hh:59
void restrictLocal(const Entity &father, const Entity &son, bool initialize)
restrict data to father
Definition: adaptcallback.hh:127
void preCoarsening(const Entity &father)
call back for activity to take place on father and all decendants before the decendants are removed ...
Definition: adaptcallback.hh:52
Interface class for the Grid's adapt method where the parameter is a AdaptDataHandleInterface.
Definition: adaptcallback.hh:30