1#ifndef DUNE_FEM_SPACE_FINITEVOLUME_BASISFUNCTIONSET_HH
2#define DUNE_FEM_SPACE_FINITEVOLUME_BASISFUNCTIONSET_HH
10#include <dune/geometry/referenceelements.hh>
13#include <dune/fem/space/common/functionspace.hh>
24 template<
class Entity,
class Range >
25 struct FiniteVolumeBasisFunctionSet
28 typedef Entity EntityType;
31 typedef FunctionSpace<
typename Entity::Geometry::ctype,
typename Range::value_type,
32 Entity::Geometry::coorddimension, Range::dimension
51 FiniteVolumeBasisFunctionSet () : entity_( nullptr ) {}
53 explicit FiniteVolumeBasisFunctionSet (
const EntityType &entity )
64 static constexpr int order () {
return 0; }
67 static constexpr std::size_t
size () {
return RangeType::dimension; }
70 template<
class Quadrature,
class Vector,
class DofVector >
71 void axpy (
const Quadrature &quadrature,
const Vector &values, DofVector &dofs )
const
73 const unsigned int nop = quadrature.nop();
74 for(
unsigned int qp = 0; qp < nop; ++qp )
75 axpyImpl( values[ qp ], dofs );
79 template<
class Quadrature,
class VectorA,
class VectorB,
class DofVector >
80 void axpy (
const Quadrature &quadrature,
const VectorA &valuesA,
const VectorB &valuesB, DofVector &dofs )
const
82 const unsigned int nop = quadrature.nop();
83 for(
unsigned int qp = 0; qp < nop; ++qp )
85 axpyImpl( valuesA[ qp ], dofs );
86 axpyImpl( valuesB[ qp ], dofs );
91 template<
class Po
int,
class DofVector >
92 void axpy (
const Point &x,
const RangeType &valueFactor, DofVector &dofs )
const
94 axpyImpl( valueFactor, dofs );
99 template<
class DofVector >
100 void axpyImpl (
const RangeType &valueFactor, DofVector &dofs )
const
102 for(
int i = 0; i < RangeType::dimension; ++i )
103 dofs[ i ] += valueFactor[ i ];
107 template<
class DofVector >
108 void axpyImpl (
const JacobianRangeType &jacobianFactor, DofVector &dofs )
const
113 template<
class Po
int,
class DofVector >
114 void axpy (
const Point &x,
const JacobianRangeType &jacobianFactor, DofVector &dofs )
const
118 template<
class Po
int,
class DofVector >
119 void axpy (
const Point &x,
const RangeType &valueFactor,
const JacobianRangeType &jacobianFactor,
120 DofVector &dofs )
const
122 axpy( x, valueFactor, dofs );
126 template<
class Quadrature,
class DofVector,
class RangeArray >
127 void evaluateAll (
const Quadrature &quadrature,
const DofVector &dofs, RangeArray &ranges )
const
129 const unsigned int nop = quadrature.nop();
130 for(
unsigned int qp = 0; qp < nop; ++qp )
131 evaluateAll( quadrature[ qp ], dofs, ranges[ qp ] );
135 template<
class Po
int,
class DofVector >
136 void evaluateAll (
const Point &x,
const DofVector &dofs, RangeType &value )
const
138 for(
int i = 0; i < RangeType::dimension; ++i )
139 value[ i ] = dofs[ i ];
143 template<
class Po
int,
class RangeArray >
144 void evaluateAll (
const Point &x, RangeArray &values )
const
146 for(
int i = 0; i < RangeType::dimension; ++i )
148 values[ i ] = RangeType( 0 );
149 values[ i ][ i ] =
typename RangeType::field_type( 1 );
154 template<
class QuadratureType,
class DofVector,
class JacobianArray >
155 void jacobianAll (
const QuadratureType &quadrature,
const DofVector &dofs, JacobianArray &jacobians )
const
157 const unsigned int nop = quadrature.nop();
158 for(
unsigned int qp = 0; qp < nop; ++qp )
159 jacobianAll( quadrature[ qp ], dofs, jacobians[ qp ] );
163 template<
class Po
int,
class DofVector >
164 void jacobianAll (
const Point &x,
const DofVector &dofs, JacobianRangeType &jacobian )
const
166 jacobian = JacobianRangeType( 0 );
170 template<
class Po
int,
class JacobianRangeArray >
171 void jacobianAll (
const Point &x, JacobianRangeArray &jacobians )
const
173 for(
int i = 0; i < RangeType::dimension; ++i )
174 jacobians[ i ] = JacobianRangeType( 0 );
178 template<
class QuadratureType,
class DofVector,
class HessianArray >
179 void hessianAll (
const QuadratureType &quadrature,
const DofVector &dofs, HessianArray &hessians )
const
181 assert( hessians.size() >= quadrature.nop() );
182 const unsigned int nop = quadrature.nop();
183 for(
unsigned int qp = 0; qp < nop; ++qp )
184 hessians[qp] = HessianRangeType(
typename HessianRangeType::value_type( 0 ) );
188 template<
class Po
int,
class DofVector >
189 void hessianAll (
const Point &x,
const DofVector &dofs, HessianRangeType &hessian )
const
191 hessian = HessianRangeType(
typename HessianRangeType::value_type( 0 ) );
195 template<
class Po
int,
class HessianRangeArray >
196 void hessianAll (
const Point &x, HessianRangeArray &hessians )
const
198 for(
int i = 0; i < RangeType::dimension; ++i )
199 hessians[ i ] = HessianRangeType(
typename HessianRangeType::value_type( 0 ) );
203 const EntityType &entity ()
const
211 -> decltype(
Dune::ReferenceElements< typename EntityType::Geometry::ctype, EntityType::Geometry::coorddimension >::general(
std::declval< const
Dune::GeometryType & >() ) )
220 bool valid ()
const {
return bool(entity_); }
223 const EntityType *entity_;
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::DomainType DomainType
Type of domain vector (using type of domain field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:67
A vector valued function space.
Definition: functionspace.hh:60
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
unspecified value type referenceElement(T &&... t)
Returns a reference element for the objects t....
Dune namespace.
Definition: alignedallocator.hh:13
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
static const ReferenceElement & general(const GeometryType &type)
get general reference elements
Definition: referenceelements.hh:156
A unique label for each type of element that can occur in a grid.