Dune Core Modules (2.3.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
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
26 template< class Grid, class Impl >
27 class AdaptDataHandleInterface
28 {
29 typedef AdaptDataHandleInterface< Grid, Impl > This;
30
31 friend class AdaptDataHandle< Grid, Impl >;
32
33 public:
34 typedef typename Grid::template Codim< 0 >::Entity Entity;
35
36 private:
37 AdaptDataHandleInterface ()
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:
102 AdaptDataHandle ()
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
class for combining 2 index sets together for adaptation process
Definition: adaptcallback.hh:122
void restrictLocal(EntityType &father, EntityType &son, bool initialize) const
restrict data to father
Definition: adaptcallback.hh:133
void prolongLocal(EntityType &father, EntityType &son, bool initialize) const
prolong data to children
Definition: adaptcallback.hh:141
CombinedAdaptProlongRestrict(const A &a, const B &b)
constructor storing the two references
Definition: adaptcallback.hh:128
Dune namespace.
Definition: alignment.hh:14
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)