1#ifndef DUNE_FEM_FUNCTION_LOCALFUNCTION_LOCALFUNCTION_HH
2#define DUNE_FEM_FUNCTION_LOCALFUNCTION_LOCALFUNCTION_HH
8#include <dune/common/deprecated.hh>
9#include <dune/common/fvector.hh>
16 template<
class BasisFunctionSet,
class LocalDofVector >
24 template<
class BasisFunctionSet,
class LocalDofVector >
25 struct DenseMatVecTraits< Fem::LocalFunction< BasisFunctionSet, LocalDofVector > >
30 typedef typename LocalDofVector::size_type
size_type;
38 template<
class BasisFunctionSet,
class LocalDofVector >
39 struct FieldTraits< Fem::LocalFunction< BasisFunctionSet, LocalDofVector > >
41 typedef typename FieldTraits< typename LocalDofVector::value_type >::field_type
field_type;
42 typedef typename FieldTraits< typename LocalDofVector::value_type >::real_type
real_type;
74 template<
class BasisFunctionSet,
class LocalDofVector >
76 :
public Dune::DenseVector< LocalFunction< BasisFunctionSet, LocalDofVector > >
79 typedef Dune::DenseVector< ThisType > BaseType;
89 typedef typename LocalDofVectorType::value_type
DofType;
92 typedef typename LocalDofVectorType::size_type
SizeType;
179 using BaseType :: operator +=;
180 using BaseType :: operator -=;
181 using BaseType :: operator *=;
182 using BaseType :: operator /=;
232 template<
class Po
intType >
250 template<
class Po
intType >
255 template<
class Po
intType >
274 template<
class Po
intType >
310 template<
class Po
intType >
324 template<
class Po
intType >
338 template<
class Po
intType >
364 template<
class QuadratureType,
class ... Vectors >
367 static_assert(
sizeof...( Vectors ) > 0,
"evaluateQuadrature needs to be called with at least one vector." );
374 template<
class QuadratureType,
class RangeVectorType,
class JacobianRangeVectorType >
376 const RangeVectorType& rangeVector,
377 const JacobianRangeVectorType& jacobianVector )
383 template<
class QuadratureType,
class ... Vectors >
386 static_assert(
sizeof...( Vectors ) > 0,
"evaluateQuadrature needs to be called with at least one vector." );
388 std::make_tuple( (
evaluateQuadrature( quad, vec,
typename std::decay<
decltype( vec[ 0 ] ) >::type() ), 1 )
394 template<
class QuadratureType,
class ... Vectors >
397 static_assert(
sizeof...( Vectors ) > 0,
"evaluateQuadrature needs to be called with at least one vector." );
399 std::make_tuple( (
evaluateQuadrature( quad, vec,
typename std::decay<
decltype( vec[ 0 ] ) >::type() ), 1 )
404 template<
class QuadratureType,
class ... Vectors >
408 static_assert(
sizeof...( Vectors ) > 0,
"evaluateQuadrature needs to be called with at least one vector." );
410 std::make_tuple( (
evaluateQuadrature( quad, vec,
typename std::decay<
decltype( vec[ 0 ] ) >::type() ), 1 )
439 DUNE_THROW(NotImplemented,
"LocalFunction::init( entity ) must be overloaded on derived class!");
452 DUNE_THROW(NotImplemented,
"LocalFunction::bind( entity ) must be overloaded on derived class!");
485 template<
class QuadratureType,
class VectorType >
494 template<
class QuadratureType,
class VectorType >
503 template<
class QuadratureType,
class VectorType >
Definition: bindguard.hh:11
Definition: explicitfieldvector.hh:75
interface for local functions
Definition: localfunction.hh:77
const LocalDofVectorType & localDofVector() const
return const reference to local Dof Vector
Definition: localfunction.hh:415
void evaluate(const PointType &x, RangeType &ret) const
evaluate the local function
Definition: localfunction.hh:311
LocalFunction(ThisType &&other)
move constructor
Definition: localfunction.hh:154
BasisFunctionSetType basisFunctionSet_
Definition: localfunction.hh:509
void init(const EntityType &entity)
initialize the local function for an entity
Definition: localfunction.hh:437
void evaluateQuadrature(const QuadratureType &quad, VectorType &result, const JacobianRangeType &) const
Definition: localfunction.hh:495
FunctionSpaceType::DomainType DomainType
type of domain vectors, i.e., type of coordinates
Definition: localfunction.hh:105
void bind(const EntityType &entity)
initialize the local function for an entity
Definition: localfunction.hh:450
void evaluateQuadrature(const QuadratureType &quad, Vectors &... vec) const
evaluate all basisfunctions for all quadrature points and store the results in the result vector
Definition: localfunction.hh:384
static const int dimDomain
dimension of the domain
Definition: localfunction.hh:117
void hessianQuadrature(const QuadratureType &quad, Vectors &... vec) const
evaluate all hessians of all basis functions for all quadrature points and store the results in the r...
Definition: localfunction.hh:405
int numDofs() const
obtain the number of local DoFs
Definition: localfunction.hh:351
BasisFunctionSet BasisFunctionSetType
type of basis function set
Definition: localfunction.hh:83
void hessian(const PointType &x, HessianRangeType &ret) const
evaluate Hessian of the local function
Definition: localfunction.hh:339
const EntityType & entity() const
obtain the entity, this local function lives on
Definition: localfunction.hh:302
LocalDofVectorType::value_type DofType
type of DoF use with the discrete function
Definition: localfunction.hh:89
EntityType::Geometry::LocalCoordinate LocalCoordinateType
type of local coordinates
Definition: localfunction.hh:114
void init(const BasisFunctionSetType &basisFunctionSet)
initialize the local function for an basisFunctionSet
Definition: localfunction.hh:476
void axpy(const PointType &x, const RangeType &factor1, const JacobianRangeType &factor2)
axpy operation for local function
Definition: localfunction.hh:275
FunctionSpaceType::RangeType RangeType
type of range vectors, i.e., type of function values
Definition: localfunction.hh:107
LocalFunction(const BasisFunctionSetType &basisFunctionSet, LocalDofVector &&localDofVector)
half move ctor
Definition: localfunction.hh:146
FunctionSpaceType::DomainFieldType DomainFieldType
field type of the domain
Definition: localfunction.hh:101
LocalFunction(const BasisFunctionSetType &basisFunctionSet, const LocalDofVector &localDofVector)
copy given agruments
Definition: localfunction.hh:135
FunctionSpaceType::HessianRangeType HessianRangeType
type of the Hessian
Definition: localfunction.hh:111
void axpy(const PointType &x, const RangeType &factor)
axpy operation for local function
Definition: localfunction.hh:233
bool valid() const
Returns true if local function if bind or init was previously called.
Definition: localfunction.hh:423
BasisFunctionSetType::FunctionSpaceType FunctionSpaceType
type of functionspace
Definition: localfunction.hh:98
void axpyQuadrature(const QuadratureType &quad, const RangeVectorType &rangeVector, const JacobianRangeVectorType &jacobianVector)
evaluate all basisfunctions for all quadrature points, multiply with the given factor and add the res...
Definition: localfunction.hh:375
void jacobian(const PointType &x, JacobianRangeType &ret) const
evaluate Jacobian of the local function
Definition: localfunction.hh:325
LocalFunction(const ThisType &other)
copy constructor
Definition: localfunction.hh:160
FunctionSpaceType::JacobianRangeType JacobianRangeType
type of the Jacobian, i.e., type of evaluated Jacobian matrix
Definition: localfunction.hh:109
static const int dimRange
dimension of the range
Definition: localfunction.hh:119
void unbind()
clears the local function by removing the basisFunctionSet
Definition: localfunction.hh:458
void evaluateQuadrature(const QuadratureType &quad, VectorType &result, const RangeType &) const
Definition: localfunction.hh:486
void axpyQuadrature(const QuadratureType &quad, const Vectors &... values)
evaluate all basisfunctions for all quadrature points, multiply with the given factor and add the res...
Definition: localfunction.hh:365
const DofType & operator[](SizeType num) const
access to local dofs (read-only)
Definition: localfunction.hh:170
FunctionSpaceType::RangeFieldType RangeFieldType
field type of the range
Definition: localfunction.hh:103
int order() const
obtain the order of this local function
Definition: localfunction.hh:290
void evaluateQuadrature(const QuadratureType &quad, VectorType &result, const HessianRangeType &) const
Definition: localfunction.hh:504
void axpy(const PointType &x, const JacobianRangeType &factor)
axpy operation for local function
Definition: localfunction.hh:251
LocalDofVectorType localDofVector_
Definition: localfunction.hh:510
LocalFunction(const BasisFunctionSetType &basisFunctionSet)
ctor taking a basisFunctionSet, calling default ctor for LocalDofVectorType, and resize
Definition: localfunction.hh:125
LocalDofVectorType::size_type SizeType
type of index
Definition: localfunction.hh:92
void clear()
set all DoFs to zero
Definition: localfunction.hh:195
void axpy(const PointType &x, const HessianRangeType &factor)
Definition: localfunction.hh:256
BasisFunctionSetType::EntityType EntityType
type of the entity, the local function lives on is given by the space
Definition: localfunction.hh:95
LocalFunction(LocalDofVectorType &&localDofVector)
half move ctor
Definition: localfunction.hh:143
LocalDofVectorType & localDofVector()
return mutable reference to local Dof Vector
Definition: localfunction.hh:418
LocalFunction()
default constructor, calls default ctor of BasisFunctionSetType and LocalDofVectorType
Definition: localfunction.hh:122
LocalFunction(const LocalDofVectorType &localDofVector)
ctor taking a localDofVector, calling default ctor for BasisFunctionSetType
Definition: localfunction.hh:132
void assign(const LocalFunction< BasisFunctionSet, T > &other)
assign all DoFs of this local function
Definition: localfunction.hh:189
const BasisFunctionSetType & basisFunctionSet() const
obtain the basis function set for this local function
Definition: localfunction.hh:296
LocalDofVector LocalDofVectorType
type of local Dof Vector
Definition: localfunction.hh:86
SizeType size() const
obtain the number of local DoFs
Definition: localfunction.hh:360
void jacobianQuadrature(const QuadratureType &quad, Vectors &... vec) const
evaluate all Jacobians for all basis functions for all quadrature points and store the results in the...
Definition: localfunction.hh:395
LocalDofVector::value_type value_type
Definition: localfunction.hh:28
LocalDofVector::size_type size_type
Definition: localfunction.hh:30
Fem::LocalFunction< BasisFunctionSet, LocalDofVector > derived_type
Definition: localfunction.hh:27
FieldTraits< typenameLocalDofVector::value_type >::field_type field_type
Definition: localfunction.hh:41
FieldTraits< typenameLocalDofVector::value_type >::real_type real_type
Definition: localfunction.hh:42
Interface class for basis function sets.
Definition: basisfunctionset/basisfunctionset.hh:31
const EntityType & entity() const
return entity
void axpy(const Quadrature &quad, const Vector &values, DofVector &dofs) const
evaluate all basis function and multiply with given values and add to dofs
std::size_t size() const
return size of basis function set
Entity EntityType
entity type
Definition: basisfunctionset/basisfunctionset.hh:34
int order() const
return order of basis function set
bool valid() const
return true if entity was set
void hessianAll(const Point &x, const DofVector &dofs, HessianRangeType &hessian) const
void jacobianAll(const QuadratureType &quad, const DofVector &dofs, JacobianArray &jacobians) const
evaluate the jacobian of all basis functions and store the result in the jacobians array
void evaluateAll(const Quadrature &quad, const DofVector &dofs, RangeArray &ranges) const
evaluate all basis functions and store the result in the ranges array
A vector valued function space.
Definition: functionspace.hh:60
FunctionSpaceTraits::DomainFieldType DomainFieldType
Intrinsic type used for values in the domain field (usually a double)
Definition: functionspaceinterface.hh:60
FunctionSpaceTraits::RangeType RangeType
Type of range vector (using type of range field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:71
@ dimDomain
dimension of domain vector space
Definition: functionspaceinterface.hh:46
@ dimRange
dimension of range vector space
Definition: functionspaceinterface.hh:48
FunctionSpaceTraits::LinearMappingType JacobianRangeType
Intrinsic type used for the jacobian values has a Dune::FieldMatrix type interface.
Definition: functionspaceinterface.hh:75
FunctionSpaceTraits::DomainType DomainType
Type of domain vector (using type of domain field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:67
FunctionSpaceTraits::RangeFieldType RangeFieldType
Intrinsic type used for values in the range field (usually a double)
Definition: functionspaceinterface.hh:63