dune-grid  2.11
adaptcallback.hh
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 // vi: set et ts=4 sw=2 sts=2:
5 #ifndef DUNE_GRID_COMMON_ADAPTCALLBACK_HH
6 #define DUNE_GRID_COMMON_ADAPTCALLBACK_HH
7 
14 namespace Dune
15 {
16 
17  // Internal Forward Declarations
18  // -----------------------------
19 
20  template< class Grid, class Impl >
22 
23 
24 
25  // AdaptDataHandleInterface
26  // ------------------------
27 
31  template< class Grid, class Impl >
33  {
35 
36  friend class AdaptDataHandle< Grid, Impl >;
37 
38  public:
39  typedef typename Grid::template Codim< 0 >::Entity Entity;
40 
41  private:
43  {}
44 
45  AdaptDataHandleInterface ( const This & );
46  This &operator= ( const This & );
47 
48  public:
54  void preCoarsening ( const Entity &father )
55  {
56  asImp().preCoarsening( father );
57  }
58 
64  void postRefinement ( const Entity &father )
65  {
66  asImp().postRefinement( father );
67  }
68 
69  void restrictLocal( const Entity &father, const Entity& son, bool initialize )
70  {
71  asImp().restrictLocal( father, son, initialize );
72  }
73 
74  void prolongLocal( const Entity &father, const Entity& son, bool initialize )
75  {
76  asImp().prolongLocal( father, son, initialize );
77  }
78 
79  protected:
80  const Impl &asImp () const { return static_cast< const Impl & >( *this ); }
81  Impl &asImp () { return static_cast< Impl & >( *this ); }
82  };
83 
84 
85 
86  // AdaptDataHandle
87  // ---------------
88 
89  template< class Grid, class Impl >
90  class AdaptDataHandle
91  : public AdaptDataHandleInterface< Grid, Impl >
92  {
93  typedef AdaptDataHandle< Grid, Impl > This;
94  typedef AdaptDataHandleInterface< Grid, Impl > Base;
95 
96  public:
97  typedef typename Base::Entity Entity;
98 
99  protected:
101  {}
102 
103  private:
104  AdaptDataHandle ( const This & );
105  This &operator= ( const This & );
106 
107  void preCoarsening ( const Entity &father );
108  void postRefinement ( const Entity &father );
109  };
110 
111 
112  // CombinedAdaptProlongRestrict
113  // ----------------------------
114 
116  template <class A, class B >
118  {
120  A& _a;
121  B& _b;
122  public:
124  CombinedAdaptProlongRestrict ( A& a, B& b ) : _a ( a ) , _b ( b )
125  {}
126 
128  template <class Entity>
129  void restrictLocal ( const Entity &father, const Entity &son, bool initialize )
130  {
131  _a.restrictLocal(father,son,initialize);
132  _b.restrictLocal(father,son,initialize);
133  }
134 
136  template <class Entity>
137  void prolongLocal ( const Entity &father, const Entity &son, bool initialize )
138  {
139  _a.prolongLocal(father,son,initialize);
140  _b.prolongLocal(father,son,initialize);
141  }
142  };
143 
144 } // end namespace Dune
145 
146 #endif
Interface class for the Grid&#39;s adapt method where the parameter is a AdaptDataHandleInterface.
Definition: adaptcallback.hh:32
concept Entity
Model of a grid entity.
Definition: concepts/entity.hh:119
void restrictLocal(const Entity &father, const Entity &son, bool initialize)
Definition: adaptcallback.hh:69
void restrictLocal(const Entity &father, const Entity &son, bool initialize)
restrict data to father
Definition: adaptcallback.hh:129
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:375
void prolongLocal(const Entity &father, const Entity &son, bool initialize)
prolong data to children
Definition: adaptcallback.hh:137
const Impl & asImp() const
Definition: adaptcallback.hh:80
void postRefinement(const Entity &father)
call back for activity to take place on newly created elements below the father element.
Definition: adaptcallback.hh:64
Grid::template Codim< 0 >::Entity Entity
Definition: adaptcallback.hh:39
Base::Entity Entity
Definition: adaptcallback.hh:97
AdaptDataHandle()
Definition: adaptcallback.hh:100
void prolongLocal(const Entity &father, const Entity &son, bool initialize)
Definition: adaptcallback.hh:74
Impl & asImp()
Definition: adaptcallback.hh:81
CombinedAdaptProlongRestrict(A &a, B &b)
constructor storing the two references
Definition: adaptcallback.hh:124
Include standard header files.
Definition: agrid.hh:59
Definition: adaptcallback.hh:21
Wrapper class for entities.
Definition: common/entity.hh:65
class for combining 2 index sets together for adaptation process
Definition: adaptcallback.hh:117
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:54