Dune Core Modules (2.4.2)

coordfunction.hh
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_GEOGRID_COORDFUNCTION_HH
4#define DUNE_GEOGRID_COORDFUNCTION_HH
5
7
8namespace Dune
9{
10
11 // Internal Forward Declarations
12 // -----------------------------
13
14 template< class ct, unsigned int dimD, unsigned int dimR, class Impl >
15 class AnalyticalCoordFunction;
16
17 template< class ct, unsigned int dimR, class Impl >
18 class DiscreteCoordFunction;
19
20
21
22 // AnalyticalCoordFunctionInterface
23 // --------------------------------
24
37 template< class ct, unsigned int dimD, unsigned int dimR, class Impl >
39 {
41
42 friend class AnalyticalCoordFunction< ct, dimD, dimR, Impl >;
43
44 public:
45 typedef This Interface;
46 typedef Impl Implementation;
47
49 typedef ct ctype;
50
52 static const unsigned int dimDomain = dimD;
54 static const unsigned int dimRange = dimR;
55
60
61 private:
63 {}
64
65 AnalyticalCoordFunctionInterface ( const This & );
66 This &operator= ( const This & );
67
68 public:
70 void evaluate ( const DomainVector &x, RangeVector &y ) const
71 {
72 return asImp().evaluate( x, y );
73 }
74
75 protected:
76 const Implementation &asImp () const
77 {
78 return static_cast< const Implementation & >( *this );
79 }
80
81 Implementation &asImp ()
82 {
83 return static_cast< Implementation & >( *this );
84 }
85 };
86
87
88
89 // AnalyticalCoordFunction
90 // -----------------------
94 template< class ct, unsigned int dimD, unsigned int dimR, class Impl >
96 : public AnalyticalCoordFunctionInterface< ct, dimD, dimR, Impl >
97 {
100
101 public:
102 typedef typename Base :: DomainVector DomainVector;
103 typedef typename Base :: RangeVector RangeVector;
104
105 protected:
107 {}
108
109 private:
110 AnalyticalCoordFunction ( const This & );
111 This &operator= ( const This & );
112
113 void evaluate ( const DomainVector &x, RangeVector &y ) const;
114 };
115
116
117
118 // DiscreteCoordFunctionInterface
119 // ------------------------------
120
135 template< class ct, unsigned int dimR, class Impl >
137 {
139
140 friend class DiscreteCoordFunction< ct, dimR, Impl >;
141
142 public:
143 typedef This Interface;
144 typedef Impl Implementation;
145
147 typedef ct ctype;
148
150 static const unsigned int dimRange = dimR;
151
154
155 private:
157 {}
158
159 DiscreteCoordFunctionInterface ( const This & );
160
161 This &operator= ( const This & );
162
163 public:
169 template< class HostEntity >
170 void evaluate ( const HostEntity &hostEntity, unsigned int corner,
171 RangeVector &y ) const
172 {
173 asImp().evaluate( hostEntity, corner, y );
174 }
175
179 void adapt ()
180 {
181 asImp().adapt();
182 }
183
184 protected:
185 const Implementation &asImp () const
186 {
187 return static_cast< const Implementation & >( *this );
188 }
189
190 Implementation &asImp ()
191 {
192 return static_cast< Implementation & >( *this );
193 }
194 };
195
196
197
198 // DiscreteCoordFunction
199 // ---------------------
200 //
204 template< class ct, unsigned int dimR, class Impl >
206 : public DiscreteCoordFunctionInterface< ct, dimR, Impl >
207 {
210
211 public:
212 typedef typename Base :: RangeVector RangeVector;
213
214 protected:
216 {}
217
218 void adapt ()
219 {}
220
221 private:
222 DiscreteCoordFunction ( const This & );
223 This &operator= ( const This & );
224
225 template< class HostEntity >
226 void evaluate ( const HostEntity &hostEntity, unsigned int corner,
227 RangeVector &y ) const;
228 };
229
230
231
232 namespace GeoGrid
233 {
234
235 // isCoordFunctionInterface
236 // ------------------------
237
238 template< class CoordFunctionInterface >
239 struct isCoordFunctionInterface
240 {
241 static const bool value = false;
242 };
243
244 template< class ct, unsigned int dimD, unsigned int dimR, class Impl >
245 struct isCoordFunctionInterface
246 < AnalyticalCoordFunctionInterface< ct, dimD, dimR, Impl > >
247 {
248 static const bool value = true;
249 };
250
251 template< class ct, unsigned int dimR, class Impl >
252 struct isCoordFunctionInterface
253 < DiscreteCoordFunctionInterface< ct, dimR, Impl > >
254 {
255 static const bool value = true;
256 };
257
258
259
260 // isDiscreteCoordFunctionInterface
261 // --------------------------------
262
263 template< class CoordFunctionInterface >
264 struct isDiscreteCoordFunctionInterface
265 {
266 static const bool value = false;
267 };
268
269 template< class ct, unsigned int dimR, class Impl >
270 struct isDiscreteCoordFunctionInterface
271 < DiscreteCoordFunctionInterface< ct, dimR, Impl > >
272 {
273 static const bool value = true;
274 };
275
276
277
278 // AdaptCoordFunction
279 // ------------------
280
281 template< class CoordFunctionInterface >
282 struct AdaptCoordFunction
283 {
284 static void adapt ( CoordFunctionInterface &coordFunction )
285 {}
286 };
287
288 template< class ct, unsigned int dimR, class Impl >
289 struct AdaptCoordFunction< DiscreteCoordFunctionInterface< ct, dimR, Impl > >
290 {
291 typedef DiscreteCoordFunctionInterface< ct, dimR, Impl > CoordFunctionInterface;
292
293 static void adapt ( CoordFunctionInterface &coordFunction )
294 {
295 coordFunction.adapt();
296 }
297 };
298
299 } // namespace GeoGrid
300
301} // namespace Dune
302
303#endif // #ifndef DUNE_GEOGRID_COORDFUNCTION_HH
Interface class for using an analytical function to define the geometry of a Dune::GeometryGrid....
Definition: coordfunction.hh:39
FieldVector< ctype, dimRange > RangeVector
range vector for the evaluate method
Definition: coordfunction.hh:59
void evaluate(const DomainVector &x, RangeVector &y) const
evaluate method for global mapping
Definition: coordfunction.hh:70
static const unsigned int dimRange
dimension of the range vector
Definition: coordfunction.hh:54
ct ctype
field type of the coordinate vector
Definition: coordfunction.hh:49
static const unsigned int dimDomain
dimension of the range vector (dimensionworld of host grid)
Definition: coordfunction.hh:52
FieldVector< ctype, dimDomain > DomainVector
domain vector for the evaluate method
Definition: coordfunction.hh:57
Derive an implementation of an analytical coordinate function from this class.
Definition: coordfunction.hh:97
Interface class for using a discrete function to define the geometry of a Dune::GeometryGrid....
Definition: coordfunction.hh:137
static const unsigned int dimRange
dimension of the range vector
Definition: coordfunction.hh:150
void evaluate(const HostEntity &hostEntity, unsigned int corner, RangeVector &y) const
evaluate method
Definition: coordfunction.hh:170
ct ctype
field type of the coordinate vector
Definition: coordfunction.hh:147
void adapt()
method called from grid.adapt() method to allow adaptation of the discrete coordinate function
Definition: coordfunction.hh:179
FieldVector< ctype, dimRange > RangeVector
range vector for the evaluate method
Definition: coordfunction.hh:153
Derive an implementation of a discrete coordinate function from this class.
Definition: coordfunction.hh:207
vector space out of a tensor product of fields.
Definition: fvector.hh:94
Implements a vector constructed from a given type representing a field and a compile-time given size.
Dune namespace.
Definition: alignment.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)