dune-grid  2.3.1-rc1
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 
26  template< class Grid, class Impl >
28  {
30 
31  friend class AdaptDataHandle< Grid, Impl >;
32 
33  public:
34  typedef typename Grid::template Codim< 0 >::Entity Entity;
35 
36  private:
38  {}
39 
40  AdaptDataHandleInterface ( const This & );
41  This &operator= ( const This & );
42 
43  public:
44  void preAdapt ( const unsigned int estimateAdditionalElements )
45  {
46  asImp().preAdapt( estimateAdditionalElements );
47  }
48 
49  void postAdapt ()
50  {
51  asImp().postAdapt();
52  }
53 
54  void preCoarsening ( const Entity &father ) const
55  {
56  asImp().preCoarsening( father );
57  }
58 
59  void postRefinement ( const Entity &father ) const
60  {
61  asImp().postRefinement( father );
62  }
63 
64  void restrictLocal( const Entity &father, const Entity& son, bool initialize ) const
65  {
66  asImp().restrictLocal( father, son, initialize );
67  }
68 
69  void prolongLocal( const Entity &father, const Entity& son, bool initialize ) const
70  {
71  asImp().prolongLocal( father, son, initialize );
72  }
73 
74  protected:
75  const Impl &asImp () const
76  {
77  return static_cast< const Impl & >( *this );
78  }
79 
80  Impl &asImp ()
81  {
82  return static_cast< Impl & >( *this );
83  }
84  };
85 
86 
87 
88  // AdaptDataHandle
89  // ---------------
90 
91  template< class Grid, class Impl >
92  class AdaptDataHandle
93  : public AdaptDataHandleInterface< Grid, Impl >
94  {
95  typedef AdaptDataHandle< Grid, Impl > This;
96  typedef AdaptDataHandleInterface< Grid, Impl > Base;
97 
98  public:
99  typedef typename Base::Entity Entity;
100 
101  protected:
103  {}
104 
105  private:
106  AdaptDataHandle ( const This & );
107  This &operator= ( const This & );
108 
109  void preAdapt ( const unsigned int estimateAdditionalElements );
110  void postAdapt ();
111  void preCoarsening ( const Entity &father ) const;
112  void postRefinement ( const Entity &father ) const;
113  };
114 
115 
116  // CombinedAdaptProlongRestrict
117  // ----------------------------
118 
120  template <class A, class B >
122  {
124  const A & _a;
125  const B & _b;
126  public:
128  CombinedAdaptProlongRestrict ( const A & a, const B & b ) : _a ( a ) , _b ( b )
129  {}
130 
132  template <class EntityType>
133  void restrictLocal ( EntityType &father, EntityType &son, bool initialize ) const
134  {
135  _a.restrictLocal(father,son,initialize);
136  _b.restrictLocal(father,son,initialize);
137  }
138 
140  template <class EntityType>
141  void prolongLocal ( EntityType &father, EntityType &son, bool initialize ) const
142  {
143  _a.prolongLocal(father,son,initialize);
144  _b.prolongLocal(father,son,initialize);
145  }
146  };
147 
148 } // end namespace Dune
149 
150 #endif
Grid::template Codim< 0 >::Entity Entity
Definition: adaptcallback.hh:34
friend class AdaptDataHandle< Grid, Impl >
Definition: adaptcallback.hh:31
void prolongLocal(const Entity &father, const Entity &son, bool initialize) const
Definition: adaptcallback.hh:69
Wrapper class for entities.
Definition: common/entity.hh:56
void restrictLocal(const Entity &father, const Entity &son, bool initialize) const
Definition: adaptcallback.hh:64
void restrictLocal(EntityType &father, EntityType &son, bool initialize) const
restrict data to father
Definition: adaptcallback.hh:133
void preAdapt(const unsigned int estimateAdditionalElements)
Definition: adaptcallback.hh:44
void postRefinement(const Entity &father) const
Definition: adaptcallback.hh:59
void postAdapt()
Definition: adaptcallback.hh:49
Definition: adaptcallback.hh:27
AdaptDataHandle()
Definition: adaptcallback.hh:102
class for combining 2 index sets together for adaptation process
Definition: adaptcallback.hh:121
Definition: adaptcallback.hh:19
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:386
void prolongLocal(EntityType &father, EntityType &son, bool initialize) const
prolong data to children
Definition: adaptcallback.hh:141
Base::Entity Entity
Definition: adaptcallback.hh:99
const Impl & asImp() const
Definition: adaptcallback.hh:75
void preCoarsening(const Entity &father) const
Definition: adaptcallback.hh:54
CombinedAdaptProlongRestrict(const A &a, const B &b)
constructor storing the two references
Definition: adaptcallback.hh:128
Impl & asImp()
Definition: adaptcallback.hh:80