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/storage/entitygeometry.hh>
14#include <dune/fem/space/common/functionspace.hh>
25 template<
class Entity,
class Range >
26 struct FiniteVolumeBasisFunctionSet
27 :
public EntityGeometryStorage< Entity >
30 typedef EntityGeometryStorage< Entity > BaseType;
38 typedef FunctionSpace<
typename Entity::Geometry::ctype,
typename Range::value_type,
39 Entity::Geometry::coorddimension, Range::dimension
58 FiniteVolumeBasisFunctionSet () {}
60 explicit FiniteVolumeBasisFunctionSet (
const EntityType &entity )
76 static constexpr int order () {
return 0; }
79 static constexpr std::size_t
size () {
return RangeType::dimension; }
82 template<
class Quadrature,
class Vector,
class DofVector >
83 void axpy (
const Quadrature &quadrature,
const Vector &values, DofVector &dofs )
const
85 const unsigned int nop = quadrature.nop();
86 for(
unsigned int qp = 0; qp < nop; ++qp )
87 axpyImpl( values[ qp ], dofs );
91 template<
class Quadrature,
class VectorA,
class VectorB,
class DofVector >
92 void axpy (
const Quadrature &quadrature,
const VectorA &valuesA,
const VectorB &valuesB, DofVector &dofs )
const
94 const unsigned int nop = quadrature.nop();
95 for(
unsigned int qp = 0; qp < nop; ++qp )
97 axpyImpl( valuesA[ qp ], dofs );
98 axpyImpl( valuesB[ qp ], dofs );
103 template<
class Po
int,
class DofVector >
104 void axpy (
const Point &x,
const RangeType &valueFactor, DofVector &dofs )
const
106 axpyImpl( valueFactor, dofs );
111 template<
class DofVector >
112 void axpyImpl (
const RangeType &valueFactor, DofVector &dofs )
const
114 for(
int i = 0; i < RangeType::dimension; ++i )
115 dofs[ i ] += valueFactor[ i ];
119 template<
class DofVector >
120 void axpyImpl (
const JacobianRangeType &jacobianFactor, DofVector &dofs )
const
125 template<
class Po
int,
class DofVector >
126 void axpy (
const Point &x,
const JacobianRangeType &jacobianFactor, DofVector &dofs )
const
130 template<
class Po
int,
class DofVector >
131 void axpy (
const Point &x,
const RangeType &valueFactor,
const JacobianRangeType &jacobianFactor,
132 DofVector &dofs )
const
134 axpy( x, valueFactor, dofs );
138 template<
class Quadrature,
class DofVector,
class RangeArray >
139 void evaluateAll (
const Quadrature &quadrature,
const DofVector &dofs, RangeArray &ranges )
const
141 const unsigned int nop = quadrature.nop();
142 for(
unsigned int qp = 0; qp < nop; ++qp )
143 evaluateAll( quadrature[ qp ], dofs, ranges[ qp ] );
147 template<
class Po
int,
class DofVector >
148 void evaluateAll (
const Point &x,
const DofVector &dofs, RangeType &value )
const
150 for(
int i = 0; i < RangeType::dimension; ++i )
151 value[ i ] = dofs[ i ];
155 template<
class Po
int,
class RangeArray >
156 void evaluateAll (
const Point &x, RangeArray &values )
const
158 for(
int i = 0; i < RangeType::dimension; ++i )
160 values[ i ] = RangeType( 0 );
161 values[ i ][ i ] =
typename RangeType::field_type( 1 );
166 template<
class QuadratureType,
class DofVector,
class JacobianArray >
167 void jacobianAll (
const QuadratureType &quadrature,
const DofVector &dofs, JacobianArray &jacobians )
const
169 const unsigned int nop = quadrature.nop();
170 for(
unsigned int qp = 0; qp < nop; ++qp )
171 jacobianAll( quadrature[ qp ], dofs, jacobians[ qp ] );
175 template<
class Po
int,
class DofVector >
176 void jacobianAll (
const Point &x,
const DofVector &dofs, JacobianRangeType &jacobian )
const
178 jacobian = JacobianRangeType( 0 );
182 template<
class Po
int,
class JacobianRangeArray >
183 void jacobianAll (
const Point &x, JacobianRangeArray &jacobians )
const
185 for(
int i = 0; i < RangeType::dimension; ++i )
186 jacobians[ i ] = JacobianRangeType( 0 );
190 template<
class QuadratureType,
class DofVector,
class HessianArray >
191 void hessianAll (
const QuadratureType &quadrature,
const DofVector &dofs, HessianArray &hessians )
const
193 assert( hessians.size() >= quadrature.nop() );
194 const unsigned int nop = quadrature.nop();
195 for(
unsigned int qp = 0; qp < nop; ++qp )
196 hessians[qp] = HessianRangeType(
typename HessianRangeType::value_type( 0 ) );
200 template<
class Po
int,
class DofVector >
201 void hessianAll (
const Point &x,
const DofVector &dofs, HessianRangeType &hessian )
const
203 hessian = HessianRangeType(
typename HessianRangeType::value_type( 0 ) );
207 template<
class Po
int,
class HessianRangeArray >
208 void hessianAll (
const Point &x, HessianRangeArray &hessians )
const
210 for(
int i = 0; i < RangeType::dimension; ++i )
211 hessians[ i ] = HessianRangeType(
typename HessianRangeType::value_type( 0 ) );
Dune::GeometryType type() const
return geometry type
Definition: entitygeometry.hh:126
const Entity & entity() const
return entity
Definition: entitygeometry.hh:101
const Geometry & geometry() const
return geometry
Definition: entitygeometry.hh:111
const ReferenceElementType & referenceElement() const
return reference element
Definition: entitygeometry.hh:129
bool valid() const
return true if entity pointer is set
Definition: entitygeometry.hh:108
Entity EntityType
entity type
Definition: entitygeometry.hh:39
EntityType::Geometry Geometry
type of geometry
Definition: entitygeometry.hh:42
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
actual interface class for quadratures
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.