3 #ifndef DUNE_GEOGRID_COORDFUNCTION_HH 4 #define DUNE_GEOGRID_COORDFUNCTION_HH 8 #include <dune/common/fvector.hh> 9 #include <dune/common/std/type_traits.hh> 17 template<
class ct,
unsigned int dimD,
unsigned int dimR,
class Impl >
20 template<
class ct,
unsigned int dimR,
class Impl >
40 template<
class ct,
unsigned int dimD,
unsigned int dimR,
class Impl >
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>()));
81 void evaluate (
const DomainVector &x, RangeVector &y )
const;
87 Std::is_detected<has_operator_parentheses,Impl,DV>::value
89 evaluate (
const DV &x, RangeVector &y )
const 96 not Std::is_detected<has_operator_parentheses,Impl,DV>::value
98 evaluate (
const DV &x, RangeVector &y )
const 101 static_cast<void(This::*)(
const DomainVector&, RangeVector&) const
>(&
This::evaluate) !=
102 static_cast<void(Impl::*)(
const DomainVector&, RangeVector&) const
>(&Impl::evaluate) &&
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 );
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 >
186 static const unsigned int dimRange = dimR;
196 This &operator= (
const This & ) =
default;
197 This &operator= ( This && ) =
default;
205 template<
class HostEntity >
206 void evaluate (
const HostEntity &hostEntity,
unsigned int corner,
207 RangeVector &y )
const 209 asImp().evaluate( hostEntity, corner, y );
221 const Implementation &
asImp ()
const 223 return static_cast< const Implementation &
>( *this );
228 return static_cast< Implementation &
>( *this );
240 template<
class ct,
unsigned int dimR,
class Impl >
255 This &operator= (
const This & ) =
default;
256 This &operator= ( This && ) =
default;
262 template<
class HostEntity >
263 void evaluate (
const HostEntity &hostEntity,
unsigned int corner,
264 RangeVector &y )
const;
275 template<
class CoordFunctionInterface >
278 static const bool value =
false;
281 template<
class ct,
unsigned int dimD,
unsigned int dimR,
class Impl >
285 static const bool value =
true;
288 template<
class ct,
unsigned int dimR,
class Impl >
290 < DiscreteCoordFunctionInterface< ct, dimR, Impl > >
292 static const bool value =
true;
300 template<
class CoordFunctionInterface >
303 static const bool value =
false;
306 template<
class ct,
unsigned int dimR,
class Impl >
308 < DiscreteCoordFunctionInterface< ct, dimR, Impl > >
310 static const bool value =
true;
318 template<
class CoordFunctionInterface >
321 static void adapt ( CoordFunctionInterface &coordFunction )
325 template<
class ct,
unsigned int dimR,
class Impl >
330 static void adapt ( CoordFunctionInterface &coordFunction )
332 coordFunction.
adapt();
340 #endif // #ifndef DUNE_GEOGRID_COORDFUNCTION_HH void adapt()
Definition: coordfunction.hh:258
void evaluate(const HostEntity &hostEntity, unsigned int corner, RangeVector &y) const
evaluate method
Definition: coordfunction.hh:206
Definition: coordfunction.hh:301
Impl Implementation
Definition: coordfunction.hh:180
static const unsigned int dimRange
dimension of the range vector
Definition: coordfunction.hh:57
static void adapt(CoordFunctionInterface &coordFunction)
Definition: coordfunction.hh:321
void adapt()
method called from grid.adapt() method to allow adaptation of the discrete coordinate function ...
Definition: coordfunction.hh:215
Impl Implementation
Definition: coordfunction.hh:49
FieldVector< ctype, dimDomain > DomainVector
domain vector for the evaluate method
Definition: coordfunction.hh:60
Definition: coordfunction.hh:276
Base ::RangeVector RangeVector
Definition: coordfunction.hh:138
Derive an implementation of a discrete coordinate function from this class.
Definition: coordfunction.hh:21
Implementation & asImp()
Definition: coordfunction.hh:116
Definition: coordfunction.hh:319
const Implementation & asImp() const
Definition: coordfunction.hh:221
Interface class for using a discrete function to define the geometry of a Dune::GeometryGrid. An implementation should be derived from Dune::DiscreteCoordinateFunction and the evaluate method taking an entity of the host grid together with the number of a vertex returns the coordinate in of that corner. The user must ensure continuity of this mapping. In addition an adapt method is provided which is called whenever adapt() is called on the Dune::GeometryGrid.
Definition: coordfunction.hh:172
Derive an implementation of an analytical coordinate function from this class.
Definition: coordfunction.hh:18
ct ctype
field type of the coordinate vector
Definition: coordfunction.hh:183
Implementation & asImp()
Definition: coordfunction.hh:226
void evaluate(const DomainVector &x, RangeVector &y) const
evaluate method for global mapping
const Implementation & asImp() const
Definition: coordfunction.hh:111
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
Base ::RangeVector RangeVector
Definition: coordfunction.hh:248
FieldVector< ctype, dimRange > RangeVector
range vector for the evaluate method
Definition: coordfunction.hh:189
This Interface
Definition: coordfunction.hh:48
This Interface
Definition: coordfunction.hh:179
Interface class for using an analytical function to define the geometry of a Dune::GeometryGrid. An implementation should be derived from Dune::AnalyticalCoordFunction and the evaluate method mapping has to be supplied.
Definition: coordfunction.hh:41
FieldVector< ctype, dimRange > RangeVector
range vector for the evaluate method
Definition: coordfunction.hh:62
Base ::DomainVector DomainVector
Definition: coordfunction.hh:137
Include standard header files.
Definition: agrid.hh:58