dune-fem 2.12-git
Loading...
Searching...
No Matches
finitevolume/basisfunctionset.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_SPACE_FINITEVOLUME_BASISFUNCTIONSET_HH
2#define DUNE_FEM_SPACE_FINITEVOLUME_BASISFUNCTIONSET_HH
3
4#include <cassert>
5#include <cstddef>
6
7#include <type_traits>
8#include <utility>
9
11#include <dune/geometry/type.hh>
12
15
16namespace Dune
17{
18
19 namespace Fem
20 {
21
22 // FiniteVolumeBasisFunctionSet
23 // ----------------------------
24
25 template< class Entity, class Range >
27 : public EntityGeometryStorage< Entity >
28 {
29 protected:
31
32 public:
35 typedef typename BaseType::Geometry Geometry;
36
38 typedef FunctionSpace< typename Entity::Geometry::ctype, typename Range::value_type,
39 Entity::Geometry::coorddimension, Range::dimension
41
50
52 typedef std::decay_t< decltype( Dune::ReferenceElements< typename EntityType::Geometry::ctype, EntityType::Geometry::coorddimension >::general( std::declval< const Dune::GeometryType & >() ) ) > ReferenceElementType;
53
59
63
69 using BaseType::entity;
70 using BaseType::valid;
73 using BaseType::type;
74
76 static constexpr int order () { return 0; }
77
79 static constexpr std::size_t size () { return RangeType::dimension; }
80
82 template< class Quadrature, class Vector, class DofVector >
83 void axpy ( const Quadrature &quadrature, const Vector &values, DofVector &dofs ) const
84 {
85 const unsigned int nop = quadrature.nop();
86 for( unsigned int qp = 0; qp < nop; ++qp )
87 axpyImpl( values[ qp ], dofs );
88 }
89
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
93 {
94 const unsigned int nop = quadrature.nop();
95 for( unsigned int qp = 0; qp < nop; ++qp )
96 {
97 axpyImpl( valuesA[ qp ], dofs );
98 axpyImpl( valuesB[ qp ], dofs );
99 }
100 }
101
103 template< class Point, class DofVector >
104 void axpy ( const Point &x, const RangeType &valueFactor, DofVector &dofs ) const
105 {
106 axpyImpl( valueFactor, dofs );
107 }
108
109 protected:
111 template< class DofVector >
112 void axpyImpl ( const RangeType &valueFactor, DofVector &dofs ) const
113 {
114 for( int i = 0; i < RangeType::dimension; ++i )
115 dofs[ i ] += valueFactor[ i ];
116 }
117
119 template< class DofVector >
120 void axpyImpl ( const JacobianRangeType &jacobianFactor, DofVector &dofs ) const
121 {}
122
123 public:
125 template< class Point, class DofVector >
126 void axpy ( const Point &x, const JacobianRangeType &jacobianFactor, DofVector &dofs ) const
127 {}
128
130 template< class Point, class DofVector >
131 void axpy ( const Point &x, const RangeType &valueFactor, const JacobianRangeType &jacobianFactor,
132 DofVector &dofs ) const
133 {
134 axpy( x, valueFactor, dofs );
135 }
136
138 template< class Quadrature, class DofVector, class RangeArray >
139 void evaluateAll ( const Quadrature &quadrature, const DofVector &dofs, RangeArray &ranges ) const
140 {
141 const unsigned int nop = quadrature.nop();
142 for( unsigned int qp = 0; qp < nop; ++qp )
143 evaluateAll( quadrature[ qp ], dofs, ranges[ qp ] );
144 }
145
147 template< class Point, class DofVector >
148 void evaluateAll ( const Point &x, const DofVector &dofs, RangeType &value ) const
149 {
150 for( int i = 0; i < RangeType::dimension; ++i )
151 value[ i ] = dofs[ i ];
152 }
153
155 template< class Point, class RangeArray >
156 void evaluateAll ( const Point &x, RangeArray &values ) const
157 {
158 for( int i = 0; i < RangeType::dimension; ++i )
159 {
160 values[ i ] = RangeType( 0 );
161 values[ i ][ i ] = typename RangeType::field_type( 1 );
162 }
163 }
164
166 template< class QuadratureType, class DofVector, class JacobianArray >
167 void jacobianAll ( const QuadratureType &quadrature, const DofVector &dofs, JacobianArray &jacobians ) const
168 {
169 const unsigned int nop = quadrature.nop();
170 for( unsigned int qp = 0; qp < nop; ++qp )
171 jacobianAll( quadrature[ qp ], dofs, jacobians[ qp ] );
172 }
173
175 template< class Point, class DofVector >
176 void jacobianAll ( const Point &x, const DofVector &dofs, JacobianRangeType &jacobian ) const
177 {
178 jacobian = JacobianRangeType( 0 );
179 }
180
182 template< class Point, class JacobianRangeArray >
183 void jacobianAll ( const Point &x, JacobianRangeArray &jacobians ) const
184 {
185 for( int i = 0; i < RangeType::dimension; ++i )
186 jacobians[ i ] = JacobianRangeType( 0 );
187 }
188
190 template< class QuadratureType, class DofVector, class HessianArray >
191 void hessianAll ( const QuadratureType &quadrature, const DofVector &dofs, HessianArray &hessians ) const
192 {
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 ) );
197 }
198
200 template< class Point, class DofVector >
201 void hessianAll ( const Point &x, const DofVector &dofs, HessianRangeType &hessian ) const
202 {
203 hessian = HessianRangeType( typename HessianRangeType::value_type( 0 ) );
204 }
205
207 template< class Point, class HessianRangeArray >
208 void hessianAll ( const Point &x, HessianRangeArray &hessians ) const
209 {
210 for( int i = 0; i < RangeType::dimension; ++i )
211 hessians[ i ] = HessianRangeType( typename HessianRangeType::value_type( 0 ) );
212 }
213 };
214
217 } // namespace Fem
218
219} // namespace Dune
220
221#endif // #ifndef DUNE_FEM_SPACE_FINITEVOLUME_BASISFUNCTIONSET_HH
IteratorRange< typename DF::DofIteratorType > dofs(DF &df)
Iterates over all DOFs.
Definition rangegenerators.hh:76
Definition explicitfieldvector.hh:75
actual interface class for integration point lists
Definition quadrature.hh:158
int nop() const
obtain the number of integration points
Definition quadrature.hh:312
A vector valued function space.
Definition functionspace.hh:60
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
Definition finitevolume/basisfunctionset.hh:28
void hessianAll(const Point &x, const DofVector &dofs, HessianRangeType &hessian) const
Definition finitevolume/basisfunctionset.hh:201
void axpy(const Point &x, const RangeType &valueFactor, DofVector &dofs) const
evaluate all basis function and multiply with given values and add to dofs
Definition finitevolume/basisfunctionset.hh:104
void axpy(const Quadrature &quadrature, const Vector &values, DofVector &dofs) const
evaluate all basis function and multiply with given values and add to dofs
Definition finitevolume/basisfunctionset.hh:83
void jacobianAll(const Point &x, JacobianRangeArray &jacobians) const
evaluate the jacobian of all basis functions and store the result in the jacobians array
Definition finitevolume/basisfunctionset.hh:183
void evaluateAll(const Point &x, RangeArray &values) const
evaluate all basis functions and store the result in the ranges array
Definition finitevolume/basisfunctionset.hh:156
FunctionSpaceType::DomainType DomainType
range type
Definition finitevolume/basisfunctionset.hh:43
static constexpr std::size_t size()
return size of basis function set
Definition finitevolume/basisfunctionset.hh:79
void hessianAll(const QuadratureType &quadrature, const DofVector &dofs, HessianArray &hessians) const
Definition finitevolume/basisfunctionset.hh:191
EntityGeometryStorage< Entity > BaseType
Definition finitevolume/basisfunctionset.hh:30
void axpyImpl(const JacobianRangeType &jacobianFactor, DofVector &dofs) const
evaluate all basis function and multiply with given values and add to dofs
Definition finitevolume/basisfunctionset.hh:120
void jacobianAll(const Point &x, const DofVector &dofs, JacobianRangeType &jacobian) const
evaluate the jacobian of all basis functions and store the result in the jacobians array
Definition finitevolume/basisfunctionset.hh:176
const Entity & entity() const
return entity
Definition entitygeometry.hh:101
FunctionSpaceType::RangeType RangeType
range type
Definition finitevolume/basisfunctionset.hh:45
FiniteVolumeBasisFunctionSet()
Definition finitevolume/basisfunctionset.hh:58
FunctionSpaceType::HessianRangeType HessianRangeType
hessian range type
Definition finitevolume/basisfunctionset.hh:49
void evaluateAll(const Point &x, const DofVector &dofs, RangeType &value) const
evaluate all basis functions and store the result in the ranges array
Definition finitevolume/basisfunctionset.hh:148
BaseType::Geometry Geometry
Definition finitevolume/basisfunctionset.hh:35
void axpy(const Point &x, const JacobianRangeType &jacobianFactor, DofVector &dofs) const
evaluate all basis function and multiply with given values and add to dofs
Definition finitevolume/basisfunctionset.hh:126
void axpy(const Point &x, const RangeType &valueFactor, const JacobianRangeType &jacobianFactor, DofVector &dofs) const
evaluate all basis function and multiply with given values and add to dofs
Definition finitevolume/basisfunctionset.hh:131
void hessianAll(const Point &x, HessianRangeArray &hessians) const
Definition finitevolume/basisfunctionset.hh:208
FiniteVolumeBasisFunctionSet(const EntityType &entity)
Definition finitevolume/basisfunctionset.hh:60
void axpy(const Quadrature &quadrature, const VectorA &valuesA, const VectorB &valuesB, DofVector &dofs) const
evaluate all basis function and multiply with given values and add to dofs
Definition finitevolume/basisfunctionset.hh:92
void jacobianAll(const QuadratureType &quadrature, const DofVector &dofs, JacobianArray &jacobians) const
evaluate the jacobian of all basis functions and store the result in the jacobians array
Definition finitevolume/basisfunctionset.hh:167
static constexpr int order()
return order of basis function set
Definition finitevolume/basisfunctionset.hh:76
BaseType::EntityType EntityType
entity type
Definition finitevolume/basisfunctionset.hh:34
void evaluateAll(const Quadrature &quadrature, const DofVector &dofs, RangeArray &ranges) const
evaluate all basis functions and store the result in the ranges array
Definition finitevolume/basisfunctionset.hh:139
FunctionSpaceType::JacobianRangeType JacobianRangeType
jacobian range type
Definition finitevolume/basisfunctionset.hh:47
FunctionSpace< typename Entity::Geometry::ctype, typename Range::value_type, Entity::Geometry::coorddimension, Range::dimension > FunctionSpaceType
function space type
Definition finitevolume/basisfunctionset.hh:40
void axpyImpl(const RangeType &valueFactor, DofVector &dofs) const
evaluate all basis function and multiply with given values and add to dofs
Definition finitevolume/basisfunctionset.hh:112
implementation of entity and geometry storage for basis function set and local functions
Definition entitygeometry.hh:35
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
EntityType::Geometry Geometry
type of geometry
Definition entitygeometry.hh:42
T forward(T... args)