DUNE-FEM (unstable)

simple.hh
1#ifndef DUNE_FEM_SPACE_BASISFUNCTIONSET_SIMPLE_HH
2#define DUNE_FEM_SPACE_BASISFUNCTIONSET_SIMPLE_HH
3
4#include <cassert>
5#include <cstddef>
6
7#include <dune/geometry/referenceelements.hh>
9
10#include <dune/fem/space/basisfunctionset/functor.hh>
11
12namespace Dune
13{
14
15 namespace Fem
16 {
17
18 // SimpleBasisFunctionSet
19 // ----------------------
20
30 template< class LocalFunctionSet >
32 {
34
35 public:
37
40 typedef typename LocalFunctionSetType::Geometry Geometry;
42
51
52 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
53 typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
54
56 typedef Dune::ReferenceElement< typename EntityType::Geometry > ReferenceElementType;
57
58 /* default constructor
59 *
60 * Note: we require a local function set to have a default constructor;
61 * eventually use LocalFunctionSetProxy.
62 */
64
70 : localFunctionSet_( localFunctionSet )
71 {}
72
74 int order () const { return localFunctionSet().order(); }
75
77 std::size_t size () const { return localFunctionSet().size(); }
78
80 decltype(auto) referenceElement () const
81 {
82 return Dune::referenceElement< typename EntityType::Geometry::ctype, EntityType::Geometry::coorddimension >( entity().type() );
83 }
84
88 template< class Quadrature, class Vector, class DofVector >
89 void axpy ( const Quadrature &quad, const Vector &values, DofVector &dofs ) const
90 {
91 const unsigned int nop = quad.nop();
92 for( unsigned int qp = 0; qp < nop; ++qp )
93 axpy( quad[ qp ], values[ qp ], dofs );
94 }
95
102 template< class Quadrature, class VectorA, class VectorB, class DofVector >
103 void axpy ( const Quadrature &quad, const VectorA &valuesA, const VectorB &valuesB, DofVector &dofs ) const
104 {
105 const unsigned int nop = quad.nop();
106 for( unsigned int qp = 0; qp < nop; ++qp )
107 {
108 axpy( quad[ qp ], valuesA[ qp ], dofs );
109 axpy( quad[ qp ], valuesB[ qp ], dofs );
110 }
111 }
112
116 template< class Point, class DofVector >
117 void axpy ( const Point &x, const RangeType &valueFactor, DofVector &dofs ) const
118 {
119 FunctionalAxpyFunctor< RangeType, DofVector > functor( valueFactor, dofs );
120 localFunctionSet().evaluateEach( x, functor );
121 }
122
126 template< class Point, class DofVector >
127 void axpy ( const Point &x, const JacobianRangeType &jacobianFactor, DofVector &dofs ) const
128 {
129 FunctionalAxpyFunctor< JacobianRangeType, DofVector > functor( jacobianFactor, dofs );
130 localFunctionSet().jacobianEach( x, functor );
131 }
134 template< class Point, class DofVector >
135 void axpy ( const Point &x, const HessianRangeType &hessianFactor, DofVector &dofs ) const
136 {
137 FunctionalAxpyFunctor< HessianRangeType, DofVector > functor( hessianFactor, dofs );
138 localFunctionSet().hessianEach( x, functor );
139 }
140
144 template< class Point, class DofVector >
145 void axpy ( const Point &x, const RangeType &valueFactor,
146 const JacobianRangeType &jacobianFactor,
147 DofVector &dofs ) const
148 {
149 axpy( x, valueFactor, dofs );
150 axpy( x, jacobianFactor, dofs );
151 }
152
156 template< class Quadrature, class DofVector, class RangeArray >
157 void evaluateAll ( const Quadrature &quad, const DofVector &dofs, RangeArray &ranges ) const
158 {
159 const unsigned int nop = quad.nop();
160 for( unsigned int qp = 0; qp < nop; ++qp )
161 evaluateAll( quad[ qp ], dofs, ranges[ qp ] );
162 }
163
165 template< class Point, class DofVector >
166 void evaluateAll ( const Point &x, const DofVector &dofs, RangeType &value ) const
167 {
168 value = RangeType( 0 );
169 AxpyFunctor< DofVector, RangeType > functor( dofs, value );
170 localFunctionSet().evaluateEach( x, functor );
171 }
172
174 template< class Point, class RangeArray >
175 void evaluateAll ( const Point &x, RangeArray &values ) const
176 {
177 AssignFunctor< RangeArray > functor( values );
178 localFunctionSet().evaluateEach( x, functor );
179 }
180
182 template< class Quadrature, class DofVector, class JacobianRangeArray >
183 void jacobianAll ( const Quadrature &quad, const DofVector &dofs, JacobianRangeArray &jacobians ) const
184 {
185 const unsigned int nop = quad.nop();
186 for( unsigned int qp = 0; qp < nop; ++qp )
187 jacobianAll( quad[ qp ], dofs, jacobians[ qp ] );
188 }
189
191 template< class Point, class DofVector >
192 void jacobianAll ( const Point &x, const DofVector &dofs, JacobianRangeType &jacobian ) const
193 {
194 jacobian = JacobianRangeType( 0 );
195 AxpyFunctor< DofVector, JacobianRangeType > functor( dofs, jacobian );
196 localFunctionSet().jacobianEach( x, functor );
197 }
198
200 template< class Point, class JacobianRangeArray >
201 void jacobianAll ( const Point &x, JacobianRangeArray &jacobians ) const
202 {
203 AssignFunctor< JacobianRangeArray > functor( jacobians );
204 localFunctionSet().jacobianEach( x, functor );
205 }
206
208 template< class Point, class DofVector >
209 void hessianAll ( const Point &x, const DofVector &dofs, HessianRangeType &hessian ) const
210 {
211 hessian = HessianRangeType( typename HessianRangeType::value_type( typename RangeType::value_type( 0 ) ) );
212 AxpyFunctor< DofVector, HessianRangeType > functor( dofs, hessian );
213 localFunctionSet().hessianEach( x, functor );
214 }
215
217 template< class Point, class HessianRangeArray >
218 void hessianAll ( const Point &x, HessianRangeArray &hessians ) const
219 {
220 AssignFunctor< HessianRangeArray > functor( hessians );
221 localFunctionSet().hessianEach( x, functor );
222 }
223
225 const EntityType &entity () const { return localFunctionSet().entity(); }
226
228 const Geometry &geometry () const { return localFunctionSet().geometry(); }
229
230 // Non-interface methods
231 // ---------------------
232
234 const LocalFunctionSetType localFunctionSet () const { return localFunctionSet_; }
235
236 private:
237 LocalFunctionSetType localFunctionSet_;
238 };
239
240 } // namespace Fem
241
242} // namespace Dune
243
244#endif // #ifndef DUNE_FEM_SPACE_BASISFUNCTIONSET_SIMPLE_HH
Wrapper class for entities.
Definition: entity.hh:66
Definition: explicitfieldvector.hh:75
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
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
A vector valued function space.
Definition: functionspace.hh:60
actual interface class for integration point lists
Definition: quadrature.hh:158
int nop() const
obtain the number of integration points
Definition: quadrature.hh:312
This class is a simple basis function set which is needed for global basis functions sets (Fourier sp...
Definition: simple.hh:32
void axpy(const Quadrature &quad, const Vector &values, DofVector &dofs) const
evaluate all basis function and multiply with given values and add to dofs
Definition: simple.hh:89
void jacobianAll(const Point &x, JacobianRangeArray &jacobians) const
please doc me
Definition: simple.hh:201
FunctionSpaceType::HessianRangeType HessianRangeType
hessian range type
Definition: simple.hh:50
FunctionSpaceType::JacobianRangeType JacobianRangeType
jacobian range type
Definition: simple.hh:48
void jacobianAll(const Point &x, const DofVector &dofs, JacobianRangeType &jacobian) const
please doc me
Definition: simple.hh:192
void hessianAll(const Point &x, const DofVector &dofs, HessianRangeType &hessian) const
please doc me
Definition: simple.hh:209
const Geometry & geometry() const
return geometry this basis function set was initialized on
Definition: simple.hh:228
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: simple.hh:145
const LocalFunctionSetType localFunctionSet() const
return local function set
Definition: simple.hh:234
void jacobianAll(const Quadrature &quad, const DofVector &dofs, JacobianRangeArray &jacobians) const
please doc me
Definition: simple.hh:183
FunctionSpaceType::RangeType RangeType
range type
Definition: simple.hh:46
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: simple.hh:127
const EntityType & entity() const
return entity this basis function set was initialized on
Definition: simple.hh:225
void evaluateAll(const Point &x, const DofVector &dofs, RangeType &value) const
please doc me
Definition: simple.hh:166
void hessianAll(const Point &x, HessianRangeArray &hessians) const
please doc me
Definition: simple.hh:218
std::size_t size() const
return size of basis function set
Definition: simple.hh:77
LocalFunctionSetType::EntityType EntityType
entity type
Definition: simple.hh:39
void evaluateAll(const Quadrature &quad, const DofVector &dofs, RangeArray &ranges) const
evaluate all basis functions and store the result in the ranges array
Definition: simple.hh:157
Dune::ReferenceElement< typename EntityType::Geometry > ReferenceElementType
type of reference element
Definition: simple.hh:56
void axpy(const Point &x, const HessianRangeType &hessianFactor, DofVector &dofs) const
Add H:D^2phi to each dof.
Definition: simple.hh:135
decltype(auto) referenceElement() const
return reference element
Definition: simple.hh:80
void axpy(const Quadrature &quad, const VectorA &valuesA, const VectorB &valuesB, DofVector &dofs) const
evaluate all basis function and multiply with given values and add to dofs
Definition: simple.hh:103
SimpleBasisFunctionSet(const LocalFunctionSetType &localFunctionSet)
constructor
Definition: simple.hh:69
FunctionSpaceType::DomainType DomainType
range type
Definition: simple.hh:44
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: simple.hh:117
void evaluateAll(const Point &x, RangeArray &values) const
please doc me
Definition: simple.hh:175
int order() const
return order of basis function set
Definition: simple.hh:74
Dune namespace.
Definition: alignedallocator.hh:13
Local basis functions.
Definition: localfunctionset.hh:28
const EntityType & entity() const
return entity
void jacobianEach(const Point &x, Functor functor) const
void evaluateEach(const Point &x, Functor functor) const
void hessianEach(const Point &x, Functor functor) const
int order() const
return order of basis functions
std::size_t size() const
return number of basis functions
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)