4 #ifndef DUNE_PDELAB_FUNCTION_CALLABLEADAPTER_HH 5 #define DUNE_PDELAB_FUNCTION_CALLABLEADAPTER_HH 17 template<
typename GV,
typename RF,
int n,
typename F>
20 GridFunctionTraits<GV,RF,n,Dune::FieldVector<RF,n> >,
21 GlobalCallableToGridFunctionAdapter<GV,RF,n,F> >
51 template<
typename T,
int n>
61 template<
typename T,
int n>
68 template<
typename GV,
typename RF,
int n,
typename F>
71 GridFunctionTraits<GV,RF,n,Dune::FieldVector<RF,n> >,
72 LocalCallableToGridFunctionAdapter<GV,RF,n,F> >
108 template <
typename GV,
typename F>
115 template <
typename GV,
typename F>
117 ->
typename std::enable_if<
119 decltype(f(std::declval<
typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()))
124 decltype(f(std::declval<
typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()))
127 decltype(f(std::declval<
typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()))
132 typedef typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate X;
134 typedef decltype(f(x)) ReturnType;
138 return TheType(gv,f);
143 template <
typename GV,
typename F>
145 ->
typename std::enable_if<
148 std::declval<
typename GV::template Codim<0>::Entity>(),
149 std::declval<
typename GV::template Codim<0>::Entity::Geometry::LocalCoordinate>()
156 std::declval<
typename GV::template Codim<0>::Entity>(),
157 std::declval<
typename GV::template Codim<0>::Entity::Geometry::LocalCoordinate>()
162 std::declval<
typename GV::template Codim<0>::Entity>(),
163 std::declval<
typename GV::template Codim<0>::Entity::Geometry::LocalCoordinate>()
169 typedef typename GV::template Codim<0>::Entity E;
171 typedef typename E::Geometry::LocalCoordinate X;
173 typedef decltype(f(e,x)) ReturnType;
177 return TheType(gv,f);
189 template<
typename GV,
typename RF,
int n,
typename F,
typename P>
192 GridFunctionTraits<GV,RF,n,Dune::FieldVector<RF,n> >,
193 GlobalCallableToInstationaryGridFunctionAdapter<GV,RF,n,F,P> >
204 : gv(gv_), f(f_), p(p_)
228 template<
typename GV,
typename RF,
int n,
typename F,
typename P>
231 GridFunctionTraits<GV,RF,n,Dune::FieldVector<RF,n> >,
232 LocalCallableToInstationaryGridFunctionAdapter<GV,RF,n,F,P> >
276 template <
typename GV,
typename F>
284 template <
typename GV,
typename F,
typename PARAM>
286 ->
typename std::enable_if<
288 decltype(f(std::declval<
typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()))
293 decltype(f(std::declval<
typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()))
296 decltype(f(std::declval<
typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()))
302 typedef typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate X;
304 typedef decltype(f(x)) ReturnType;
308 return TheType(gv,f,param);
313 template <
typename GV,
typename F,
typename PARAM>
315 ->
typename std::enable_if<
318 std::declval<
typename GV::template Codim<0>::Entity>(),
319 std::declval<
typename GV::template Codim<0>::Entity::Geometry::LocalCoordinate>()
326 std::declval<
typename GV::template Codim<0>::Entity>(),
327 std::declval<
typename GV::template Codim<0>::Entity::Geometry::LocalCoordinate>()
332 std::declval<
typename GV::template Codim<0>::Entity>(),
333 std::declval<
typename GV::template Codim<0>::Entity::Geometry::LocalCoordinate>()
340 typedef typename GV::template Codim<0>::Entity E;
342 typedef typename E::Geometry::LocalCoordinate X;
344 typedef decltype(f(e,x)) ReturnType;
348 return TheType(gv,f,param);
371 const Dune::FieldVector<typename I::ctype, I::dimension-1> & coord
374 Dune::FieldVector<typename I::ctype, I::dimension>
xg = intersection.geometry().global(coord);
380 const Dune::FieldVector<typename I::ctype, I::dimension-1> & coord
383 return !isDirichlet( ig, coord );
403 bool isDirichlet(
const I &
ig,
const Dune::FieldVector<typename I::ctype, I::dimension-1> & coord
406 return(f(ig.intersection(),coord));
411 const Dune::FieldVector<typename I::ctype, I::dimension-1> & coord
414 return !isDirichlet( ig, coord );
431 template <
typename GV,
typename F>
432 BoundaryConditionAdapter makebBoundaryConditionFromCallable (
const GV& gv,
const F& f)
437 template<
typename GV,
typename F>
438 auto makeBoundaryConditionFromCallable (
const GV& gv,
const F& f)
439 ->
typename std::enable_if<
441 decltype(f(std::declval<
typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()))
451 template<
typename GV,
typename F>
452 auto makeBoundaryConditionFromCallable (
const GV& gv,
const F& f)
453 ->
typename std::enable_if<
456 std::declval<
typename GV::template Codim<0>::Entity>(),
457 std::declval<
typename GV::template Codim<0>::Entity::Geometry::LocalCoordinate>()
Dune::PDELab::GridFunctionTraits< GV, RF, n, Dune::FieldVector< RF, n > > Traits
Definition: callableadapter.hh:239
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &xl, typename Traits::RangeType &y) const
evaluate extended function on element
Definition: callableadapter.hh:87
static const unsigned int value
Definition: gridfunctionspace/tags.hh:177
Definition: callableadapter.hh:47
bool isNeumann(const I &ig, const Dune::FieldVector< typename I::ctype, I::dimension-1 > &coord) const
Definition: callableadapter.hh:379
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &xl, typename Traits::RangeType &y) const
evaluate extended function on element
Definition: callableadapter.hh:36
Dune::PDELab::GridFunctionTraits< GV, RF, n, Dune::FieldVector< RF, n > > Traits
Definition: callableadapter.hh:200
WrapperConformingToGridFunctionInterface makeGridFunctionFromCallable(const GV &gv, const F &f)
Create a GridFunction adapter from a callable.
Definition: callableadapter.hh:109
const IG & ig
Definition: constraints.hh:148
static const int dim
Definition: adaptivity.hh:83
Dune::PDELab::GridFunctionTraits< GV, RF, n, Dune::FieldVector< RF, n > > Traits
Definition: callableadapter.hh:27
void setTime(RF t)
Definition: callableadapter.hh:257
Adapter for callables f(e,x) expecting an entity e and a global coordinate x.
Definition: callableadapter.hh:69
Adapter for boundary cond from a callable taking global coordinates.
Definition: callableadapter.hh:359
Definition: adaptivity.hh:27
GV::Traits::template Codim< 0 >::Entity ElementType
codim 0 entity
Definition: function.hh:117
LocalCallableToGridFunctionAdapter(const GV &gv_, const F &f_)
construct from grid view
Definition: callableadapter.hh:81
GlobalCallableToBoundaryConditionAdapter(F f_)
construct from functor
Definition: callableadapter.hh:366
WrapperConformingToGridFunctionInterface makeInstationaryGridFunctionFromCallable(const GV &gv, const F &f)
Create a GridFunction from callable and parameter class with setTime method.
Definition: callableadapter.hh:277
const GV & getGridView()
get a reference to the grid view
Definition: callableadapter.hh:84
Definition: callableadapter.hh:57
LocalCallableToBoundaryConditionAdapter(const F &f_)
Definition: callableadapter.hh:398
const Entity & e
Definition: localfunctionspace.hh:111
Dune::FieldVector< GV::Grid::ctype, GV::dimension > DomainType
domain type in dim-size coordinates
Definition: function.hh:48
const GV & getGridView()
get a reference to the grid view
Definition: callableadapter.hh:245
Dune::PDELab::GridFunctionTraits< GV, RF, n, Dune::FieldVector< RF, n > > Traits
Definition: callableadapter.hh:78
LocalCallableToInstationaryGridFunctionAdapter(const GV &gv_, const F &f_, P &p_)
construct from grid view
Definition: callableadapter.hh:242
Adapter for boundary cond from a callable taking an entity and local coordinates. ...
Definition: callableadapter.hh:390
bool isDirichlet(const I &ig, const Dune::FieldVector< typename I::ctype, I::dimension-1 > &coord) const
Definition: callableadapter.hh:403
R RangeType
range type
Definition: function.hh:60
T Type
Definition: callableadapter.hh:58
Definition: constraintsparameters.hh:24
return a PDELab GridFunction (with setTime method) defined by a parameter class and a callable f(x) g...
Definition: callableadapter.hh:190
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &xl, typename Traits::RangeType &y) const
evaluate extended function on element
Definition: callableadapter.hh:211
const P & p
Definition: constraints.hh:147
XG & xg
Definition: interpolate.hh:67
void setTime(RF t)
Definition: callableadapter.hh:221
return a PDELab GridFunction (with setTime method) defined by a parameter class and a callable f(e...
Definition: callableadapter.hh:229
bool isNeumann(const I &ig, const Dune::FieldVector< typename I::ctype, I::dimension-1 > &coord) const
Definition: callableadapter.hh:410
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &xl, typename Traits::RangeType &y) const
evaluate extended function on element
Definition: callableadapter.hh:248
bool isDirichlet(const I &intersection, const Dune::FieldVector< typename I::ctype, I::dimension-1 > &coord) const
Test whether boundary is Dirichlet-constrained.
Definition: callableadapter.hh:370
Adapter for callables f(x) expecting a global coordinate x.
Definition: callableadapter.hh:18
GlobalCallableToGridFunctionAdapter(const GV &gv_, const F &f_)
construct from grid view
Definition: callableadapter.hh:30
leaf of a function tree
Definition: function.hh:576
const GV & getGridView()
get a reference to the grid view
Definition: callableadapter.hh:208
const GV & getGridView()
get a reference to the grid view
Definition: callableadapter.hh:33
T Type
Definition: callableadapter.hh:63
traits class holding the function signature, same as in local function
Definition: function.hh:175
GlobalCallableToInstationaryGridFunctionAdapter(const GV &gv_, const F &f_, P &p_)
construct from grid view
Definition: callableadapter.hh:203
Definition: constraintsparameters.hh:120