Dune Core Modules (2.8.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_GRID_COMMON_ADAPTCALLBACK_HH
4#define DUNE_GRID_COMMON_ADAPTCALLBACK_HH
5
12namespace Dune
13{
14
15 // Internal Forward Declarations
16 // -----------------------------
17
18 template< class Grid, class Impl >
19 class AdaptDataHandle;
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
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:
98 AdaptDataHandle ()
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
Interface class for the Grid's adapt method where the parameter is a AdaptDataHandleInterface.
Definition: adaptcallback.hh:31
void postRefinement(const Entity &father)
call back for activity to take place on newly created elements below the father element.
Definition: adaptcallback.hh:62
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
class for combining 2 index sets together for adaptation process
Definition: adaptcallback.hh:116
CombinedAdaptProlongRestrict(A &a, B &b)
constructor storing the two references
Definition: adaptcallback.hh:122
void restrictLocal(const Entity &father, const Entity &son, bool initialize)
restrict data to father
Definition: adaptcallback.hh:127
void prolongLocal(const Entity &father, const Entity &son, bool initialize)
prolong data to children
Definition: adaptcallback.hh:135
Wrapper class for entities.
Definition: entity.hh:64
Grid abstract base class.
Definition: grid.hh:372
Dune namespace.
Definition: alignedallocator.hh:11
Static tag representing a codimension.
Definition: dimension.hh:22
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)