1#ifndef DUNE_FEM_FUNCTION_LOCALFUNCTION_BINDABLE_HH
2#define DUNE_FEM_FUNCTION_LOCALFUNCTION_BINDABLE_HH
4#include <dune/fem/storage/entitygeometry.hh>
6#include <dune/fem/space/common/discretefunctionspace.hh>
7#include <dune/fem/function/common/discretefunction.hh>
8#include <dune/fem/common/coordinate.hh>
9#include <dune/fem/quadrature/quadrature.hh>
10#include <dune/fem/common/intersectionside.hh>
16 struct BindableFunction :
public HasLocalFunction {};
18 template <
class Gr
idPart,
class Range>
19 struct BindableGridFunction
20 :
public EntityGeometryStorage< typename GridPart::template Codim<0>::EntityType >,
21 public BindableFunction
23 typedef GridPart GridPartType;
24 typedef typename GridPart::template Codim<0>::EntityType EntityType;
26 typedef EntityGeometryStorage< EntityType > BaseType;
28 typedef typename GridPart::IntersectionType IntersectionType;
29 typedef typename EntityType::Geometry Geometry;
36 BindableGridFunction(
const GridPart &gridPart)
41 using BaseType :: bind;
42 using BaseType :: unbind;
43 using BaseType :: entity;
44 using BaseType :: geometry;
46 void bind(
const IntersectionType &intersection, IntersectionSide side)
49 const EntityType
entity = side==IntersectionSide::in? intersection.inside(): intersection.outside();
53 bool continuous()
const {
return true; }
54 template <
class Po
int>
55 DomainType global(
const Point &x)
const
57 return geometry().global( Dune::Fem::coordinate(x) );
61 template <
class Po
int>
62 void evaluate(
const Point& x, RangeType& ret )
const;
64 template <
class Quadrature,
class RangeArray>
65 void evaluate(
const Quadrature& quadrature, RangeArray& values )
const
67 const unsigned int nop = quadrature.nop();
69 for(
unsigned int qp=0; qp<nop; ++qp)
71 evaluate( quadrature[ qp ], values[ qp ]);
75 const GridPart& gridPart()
const {
return gridPart_; }
78 const GridPart &gridPart_;
81 template <
class Gr
idPart,
class Range>
82 struct BindableGridFunctionWithSpace :
public BindableGridFunction<GridPart,Range>
84 typedef BindableGridFunction<GridPart,Range> Base;
85 typedef GridPart GridPartType;
86 typedef typename GridPart::template Codim<0>::EntityType EntityType;
87 typedef typename EntityType::Geometry::GlobalCoordinate DomainType;
94 BindableGridFunctionWithSpace(
const GridPart &gridPart,
const std::string &name,
int order)
96 space_( gridPart, order ),
100 unsigned int order()
const
102 return space().order();
104 const std::string &name()
const
108 const DiscreteFunctionSpaceType &space ()
const
113 DiscreteFunctionSpaceType space_;
114 const std::string name_;
119 template <
class,
class,
class>
121 : std::false_type {};
122 template <
class GP,
class LF>
123 struct canBind<GP,LF,
124 std::
void_t< decltype( std::declval<LF>().
125 bind(std::declval<const typename GP::template Codim<0>::EntityType&>())) >>
127 template <
class GP,
class LF>
128 using canBind_t = canBind<GP,LF,void>;
131 template <
class GP,
class LF>
132 constexpr detail::canBind_t<GP,LF> checkGridPartValid() {
return {}; }
const Entity & entity() const
return entity
Definition: entitygeometry.hh:101
const Geometry & geometry() const
return geometry
Definition: entitygeometry.hh:111
void bind(const EntityType &entity)
set new entity object and geometry if enabled
Definition: entitygeometry.hh:135
Definition: explicitfieldvector.hh:75
FunctionSpaceTraits::RangeType RangeType
Type of range vector (using type of range field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:71
FunctionSpaceTraits::LinearMappingType JacobianRangeType
Intrinsic type used for the jacobian values has a Dune::FieldMatrix type interface.
Definition: functionspaceinterface.hh:75
FunctionSpaceTraits::RangeFieldType RangeFieldType
Intrinsic type used for values in the range field (usually a double)
Definition: functionspaceinterface.hh:63
A vector valued function space.
Definition: functionspace.hh:60
FieldVector< ctype, cdim > GlobalCoordinate
type of the global coordinates
Definition: geometry.hh:106
actual interface class for quadratures
typename Impl::voider< Types... >::type void_t
Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.
Definition: typetraits.hh:40
Dune namespace.
Definition: alignedallocator.hh:13