DUNE-FEM (unstable)

basisfunctionset.hh
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
10#include <dune/geometry/referenceelements.hh>
11#include <dune/geometry/type.hh>
12
13#include <dune/fem/storage/entitygeometry.hh>
14#include <dune/fem/space/common/functionspace.hh>
15
16namespace Dune
17{
18
19 namespace Fem
20 {
21
22 // FiniteVolumeBasisFunctionSet
23 // ----------------------------
24
25 template< class Entity, class Range >
26 struct FiniteVolumeBasisFunctionSet
27 : public EntityGeometryStorage< Entity >
28 {
29 protected:
30 typedef EntityGeometryStorage< Entity > BaseType;
31
32 public:
34 typedef typename BaseType::EntityType EntityType;
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
43 typedef typename FunctionSpaceType::DomainType DomainType;
45 typedef typename FunctionSpaceType::RangeType RangeType;
47 typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
49 typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
50
52 typedef std::decay_t< decltype( Dune::ReferenceElements< typename EntityType::Geometry::ctype, EntityType::Geometry::coorddimension >::general( std::declval< const Dune::GeometryType & >() ) ) > ReferenceElementType;
53
58 FiniteVolumeBasisFunctionSet () {}
59
60 explicit FiniteVolumeBasisFunctionSet ( const EntityType &entity )
61 : BaseType( entity )
62 {}
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
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.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)