dune-grid  2.7.0
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
Dune::AdaptDataHandleInterface::asImp
const Impl & asImp() const
Definition: adaptcallback.hh:78
Dune::CombinedAdaptProlongRestrict::restrictLocal
void restrictLocal(const Entity &father, const Entity &son, bool initialize)
restrict data to father
Definition: adaptcallback.hh:127
Dune::AdaptDataHandleInterface::Entity
Grid::template Codim< 0 >::Entity Entity
Definition: adaptcallback.hh:37
Dune::AdaptDataHandleInterface::asImp
Impl & asImp()
Definition: adaptcallback.hh:79
Dune::CombinedAdaptProlongRestrict
class for combining 2 index sets together for adaptation process
Definition: adaptcallback.hh:115
Dune::AdaptDataHandleInterface::preCoarsening
void preCoarsening(const Entity &father)
call back for activity to take place on father and all descendants before the descendants are removed
Definition: adaptcallback.hh:52
Dune::AdaptDataHandle
Definition: adaptcallback.hh:19
Dune::AdaptDataHandleInterface::prolongLocal
void prolongLocal(const Entity &father, const Entity &son, bool initialize)
Definition: adaptcallback.hh:72
Dune::CombinedAdaptProlongRestrict::CombinedAdaptProlongRestrict
CombinedAdaptProlongRestrict(A &a, B &b)
constructor storing the two references
Definition: adaptcallback.hh:122
Dune::AdaptDataHandleInterface::postRefinement
void postRefinement(const Entity &father)
call back for activity to take place on newly created elements below the father element.
Definition: adaptcallback.hh:62
Dune::AdaptDataHandle::AdaptDataHandle
AdaptDataHandle()
Definition: adaptcallback.hh:98
Dune::AdaptDataHandleInterface
Interface class for the Grid's adapt method where the parameter is a AdaptDataHandleInterface.
Definition: adaptcallback.hh:30
Dune::AdaptDataHandleInterface::restrictLocal
void restrictLocal(const Entity &father, const Entity &son, bool initialize)
Definition: adaptcallback.hh:67
Dune::Grid
Grid abstract base class.
Definition: common/grid.hh:373
Dune::CombinedAdaptProlongRestrict::prolongLocal
void prolongLocal(const Entity &father, const Entity &son, bool initialize)
prolong data to children
Definition: adaptcallback.hh:135
Dune
Include standard header files.
Definition: agrid.hh:58
Dune::AdaptDataHandle::Entity
Base::Entity Entity
Definition: adaptcallback.hh:95
Dune::Entity
Wrapper class for entities.
Definition: common/entity.hh:63