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> >
50 template<
typename T,
int n>
60 template<
typename T,
int n>
67 template<
typename GV,
typename RF,
int n,
typename F>
70 GridFunctionTraits<GV,RF,n,Dune::FieldVector<RF,n> >,
71 LocalCallableToGridFunctionAdapter<GV,RF,n,F> >
106 template <
typename GV,
typename F>
113 template <
typename GV,
typename F>
115 ->
typename std::enable_if<
117 decltype(f(std::declval<
typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()))
122 decltype(f(std::declval<
typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()))
125 decltype(f(std::declval<
typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()))
130 typedef typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate X;
132 typedef decltype(f(x)) ReturnType;
136 return TheType(gv,f);
141 template <
typename GV,
typename F>
143 ->
typename std::enable_if<
146 std::declval<
typename GV::template Codim<0>::Entity>(),
147 std::declval<
typename GV::template Codim<0>::Entity::Geometry::LocalCoordinate>()
154 std::declval<
typename GV::template Codim<0>::Entity>(),
155 std::declval<
typename GV::template Codim<0>::Entity::Geometry::LocalCoordinate>()
160 std::declval<
typename GV::template Codim<0>::Entity>(),
161 std::declval<
typename GV::template Codim<0>::Entity::Geometry::LocalCoordinate>()
167 typedef typename GV::template Codim<0>::Entity E;
169 typedef typename E::Geometry::LocalCoordinate X;
171 typedef decltype(f(e,x)) ReturnType;
175 return TheType(gv,f);
187 template<
typename GV,
typename RF,
int n,
typename F,
typename P>
190 GridFunctionTraits<GV,RF,n,Dune::FieldVector<RF,n> >,
191 GlobalCallableToInstationaryGridFunctionAdapter<GV,RF,n,F,P> >
202 : gv(gv_), f(f_), p(p_)
225 template<
typename GV,
typename RF,
int n,
typename F,
typename P>
228 GridFunctionTraits<GV,RF,n,Dune::FieldVector<RF,n> >,
229 LocalCallableToInstationaryGridFunctionAdapter<GV,RF,n,F,P> >
272 template <
typename GV,
typename F>
280 template <
typename GV,
typename F,
typename PARAM>
282 ->
typename std::enable_if<
284 decltype(f(std::declval<
typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()))
289 decltype(f(std::declval<
typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()))
292 decltype(f(std::declval<
typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()))
298 typedef typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate X;
300 typedef decltype(f(x)) ReturnType;
304 return TheType(gv,f,param);
309 template <
typename GV,
typename F,
typename PARAM>
311 ->
typename std::enable_if<
314 std::declval<
typename GV::template Codim<0>::Entity>(),
315 std::declval<
typename GV::template Codim<0>::Entity::Geometry::LocalCoordinate>()
322 std::declval<
typename GV::template Codim<0>::Entity>(),
323 std::declval<
typename GV::template Codim<0>::Entity::Geometry::LocalCoordinate>()
328 std::declval<
typename GV::template Codim<0>::Entity>(),
329 std::declval<
typename GV::template Codim<0>::Entity::Geometry::LocalCoordinate>()
336 typedef typename GV::template Codim<0>::Entity E;
338 typedef typename E::Geometry::LocalCoordinate X;
340 typedef decltype(f(e,x)) ReturnType;
344 return TheType(gv,f,param);
367 const Dune::FieldVector<typename I::ctype, I::dimension-1> & coord
370 Dune::FieldVector<typename I::ctype, I::dimension>
xg = intersection.geometry().global(coord);
376 const Dune::FieldVector<typename I::ctype, I::dimension-1> & coord
379 return !isDirichlet( ig, coord );
399 bool isDirichlet(
const I &
ig,
const Dune::FieldVector<typename I::ctype, I::dimension-1> & coord
402 return(f(ig.intersection(),coord));
407 const Dune::FieldVector<typename I::ctype, I::dimension-1> & coord
410 return !isDirichlet( ig, coord );
427 template <
typename GV,
typename F>
428 BoundaryConditionAdapter makebBoundaryConditionFromCallable (
const GV& gv,
const F& f)
433 template<
typename GV,
typename F>
434 auto makeBoundaryConditionFromCallable (
const GV& gv,
const F& f)
435 ->
typename std::enable_if<
437 decltype(f(std::declval<
typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()))
447 template<
typename GV,
typename F>
448 auto makeBoundaryConditionFromCallable (
const GV& gv,
const F& f)
449 ->
typename std::enable_if<
452 std::declval<
typename GV::template Codim<0>::Entity>(),
453 std::declval<
typename GV::template Codim<0>::Entity::Geometry::LocalCoordinate>()
Dune::PDELab::GridFunctionTraits< GV, RF, n, Dune::FieldVector< RF, n > > Traits
Definition: callableadapter.hh:236
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:86
static const unsigned int value
Definition: gridfunctionspace/tags.hh:177
Definition: callableadapter.hh:46
bool isNeumann(const I &ig, const Dune::FieldVector< typename I::ctype, I::dimension-1 > &coord) const
Definition: callableadapter.hh:375
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:198
WrapperConformingToGridFunctionInterface makeGridFunctionFromCallable(const GV &gv, const F &f)
Create a GridFunction adapter from a callable.
Definition: callableadapter.hh:107
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:253
Adapter for callables f(e,x) expecting an entity e and a global coordinate x.
Definition: callableadapter.hh:68
Adapter for boundary cond from a callable taking global coordinates.
Definition: callableadapter.hh:355
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:80
GlobalCallableToBoundaryConditionAdapter(F f_)
construct from functor
Definition: callableadapter.hh:362
WrapperConformingToGridFunctionInterface makeInstationaryGridFunctionFromCallable(const GV &gv, const F &f)
Create a GridFunction from callable and parameter class with setTime method.
Definition: callableadapter.hh:273
const GV & getGridView()
get a reference to the grid view
Definition: callableadapter.hh:83
Definition: callableadapter.hh:56
LocalCallableToBoundaryConditionAdapter(const F &f_)
Definition: callableadapter.hh:394
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:242
Dune::PDELab::GridFunctionTraits< GV, RF, n, Dune::FieldVector< RF, n > > Traits
Definition: callableadapter.hh:77
LocalCallableToInstationaryGridFunctionAdapter(const GV &gv_, const F &f_, P &p_)
construct from grid view
Definition: callableadapter.hh:239
Adapter for boundary cond from a callable taking an entity and local coordinates. ...
Definition: callableadapter.hh:386
bool isDirichlet(const I &ig, const Dune::FieldVector< typename I::ctype, I::dimension-1 > &coord) const
Definition: callableadapter.hh:399
R RangeType
range type
Definition: function.hh:60
T Type
Definition: callableadapter.hh:57
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:188
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:209
const P & p
Definition: constraints.hh:147
XG & xg
Definition: interpolate.hh:67
void setTime(RF t)
Definition: callableadapter.hh:218
return a PDELab GridFunction (with setTime method) defined by a parameter class and a callable f(e...
Definition: callableadapter.hh:226
bool isNeumann(const I &ig, const Dune::FieldVector< typename I::ctype, I::dimension-1 > &coord) const
Definition: callableadapter.hh:406
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:245
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:366
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:206
const GV & getGridView()
get a reference to the grid view
Definition: callableadapter.hh:33
T Type
Definition: callableadapter.hh:62
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:201
Definition: constraintsparameters.hh:120