3#ifndef DUNE_GEOGRID_COORDFUNCTION_HH
4#define DUNE_GEOGRID_COORDFUNCTION_HH
9#include <dune/common/std/type_traits.hh>
17 template<
class ct,
unsigned int dimD,
unsigned int dimR,
class Impl >
18 class AnalyticalCoordFunction;
20 template<
class ct,
unsigned int dimR,
class Impl >
21 class DiscreteCoordFunction;
40 template<
class ct,
unsigned int dimD,
unsigned int dimR,
class Impl >
49 typedef Impl Implementation;
69 This &operator= (
const This & ) =
default;
70 This &operator= (
This && ) =
default;
73 template<
typename F,
typename DV>
74 using has_operator_parentheses =
decltype(std::declval<F>()(std::declval<DV>()));
103 "You need to implement either operator() or evaluate() in your coordinate function!");
104 asImp().evaluate( x, y );
111 const Implementation &asImp ()
const
113 return static_cast< const Implementation &
>( *this );
116 Implementation &asImp ()
118 return static_cast< Implementation &
>( *this );
129 template<
class ct,
unsigned int dimD,
unsigned int dimR,
class Impl >
145 This &operator= (
const This & ) =
default;
146 This &operator= (
This && ) =
default;
171 template<
class ct,
unsigned int dimR,
class Impl >
180 typedef Impl Implementation;
196 This &operator= (
const This & ) =
default;
197 This &operator= (
This && ) =
default;
208 template<
class HostEntity >
209 void evaluate (
const HostEntity &hostEntity,
unsigned int corner,
212 asImp().evaluate( hostEntity, corner, y );
224 const Implementation &asImp ()
const
226 return static_cast< const Implementation &
>( *this );
229 Implementation &asImp ()
231 return static_cast< Implementation &
>( *this );
243 template<
class ct,
unsigned int dimR,
class Impl >
258 This &operator= (
const This & ) =
default;
259 This &operator= (
This && ) =
default;
265 template<
class HostEntity >
266 void evaluate (
const HostEntity &hostEntity,
unsigned int corner,
278 template<
class CoordFunctionInterface >
279 struct isCoordFunctionInterface
281 static const bool value =
false;
284 template<
class ct,
unsigned int dimD,
unsigned int dimR,
class Impl >
285 struct isCoordFunctionInterface
286 < AnalyticalCoordFunctionInterface< ct, dimD, dimR, Impl > >
288 static const bool value =
true;
291 template<
class ct,
unsigned int dimR,
class Impl >
292 struct isCoordFunctionInterface
293 < DiscreteCoordFunctionInterface< ct, dimR, Impl > >
295 static const bool value =
true;
303 template<
class CoordFunctionInterface >
304 struct isDiscreteCoordFunctionInterface
306 static const bool value =
false;
309 template<
class ct,
unsigned int dimR,
class Impl >
310 struct isDiscreteCoordFunctionInterface
311 < DiscreteCoordFunctionInterface< ct, dimR, Impl > >
313 static const bool value =
true;
321 template<
class CoordFunctionInterface >
322 struct AdaptCoordFunction
324 static void adapt ( CoordFunctionInterface &coordFunction )
328 template<
class ct,
unsigned int dimR,
class Impl >
329 struct AdaptCoordFunction< DiscreteCoordFunctionInterface< ct, dimR, Impl > >
331 typedef DiscreteCoordFunctionInterface< ct, dimR, Impl > CoordFunctionInterface;
333 static void adapt ( CoordFunctionInterface &coordFunction )
335 coordFunction.adapt();
Interface class for using an analytical function to define the geometry of a Dune::GeometryGrid....
Definition: coordfunction.hh:42
FieldVector< ctype, dimRange > RangeVector
range vector for the evaluate method
Definition: coordfunction.hh:62
void evaluate(const DomainVector &x, RangeVector &y) const
evaluate method for global mapping
static const unsigned int dimRange
dimension of the range vector
Definition: coordfunction.hh:57
ct ctype
field type of the coordinate vector
Definition: coordfunction.hh:52
static const unsigned int dimDomain
dimension of the range vector (dimensionworld of host grid)
Definition: coordfunction.hh:55
FieldVector< ctype, dimDomain > DomainVector
domain vector for the evaluate method
Definition: coordfunction.hh:60
Derive an implementation of an analytical coordinate function from this class.
Definition: coordfunction.hh:132
Interface class for using a discrete function to define the geometry of a Dune::GeometryGrid....
Definition: coordfunction.hh:173
static const unsigned int dimRange
dimension of the range vector
Definition: coordfunction.hh:186
void evaluate(const HostEntity &hostEntity, unsigned int corner, RangeVector &y) const
evaluate method
Definition: coordfunction.hh:209
ct ctype
field type of the coordinate vector
Definition: coordfunction.hh:183
void adapt()
method called from grid.adapt() method to allow adaptation of the discrete coordinate function
Definition: coordfunction.hh:218
FieldVector< ctype, dimRange > RangeVector
range vector for the evaluate method
Definition: coordfunction.hh:189
Derive an implementation of a discrete coordinate function from this class.
Definition: coordfunction.hh:246
vector space out of a tensor product of fields.
Definition: fvector.hh:96
Implements a vector constructed from a given type representing a field and a compile-time given size.
typename detected_or< nonesuch, Op, Args... >::value_t is_detected
Detects whether Op<Args...> is valid.
Definition: type_traits.hh:340
Dune namespace.
Definition: alignedallocator.hh:14