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
41
50
51 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
52 typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
53
55 typedef Dune::ReferenceElement< typename EntityType::Geometry > ReferenceElementType;
56
57 /* default constructor
58 *
59 * Note: we require a local function set to have a default constructor;
60 * eventually use LocalFunctionSetProxy.
61 */
63
69 : localFunctionSet_( localFunctionSet )
70 {}
71
73 int order () const { return localFunctionSet().order(); }
74
76 std::size_t size () const { return localFunctionSet().size(); }
77
79 decltype(auto) referenceElement () const
80 {
81 return Dune::referenceElement< typename EntityType::Geometry::ctype, EntityType::Geometry::coorddimension >( entity().type() );
82 }
83
87 template< class Quadrature, class Vector, class DofVector >
88 void axpy ( const Quadrature &quad, const Vector &values, DofVector &dofs ) const
89 {
90 const unsigned int nop = quad.nop();
91 for( unsigned int qp = 0; qp < nop; ++qp )
92 axpy( quad[ qp ], values[ qp ], dofs );
93 }
94
101 template< class Quadrature, class VectorA, class VectorB, class DofVector >
102 void axpy ( const Quadrature &quad, const VectorA &valuesA, const VectorB &valuesB, DofVector &dofs ) const
103 {
104 const unsigned int nop = quad.nop();
105 for( unsigned int qp = 0; qp < nop; ++qp )
106 {
107 axpy( quad[ qp ], valuesA[ qp ], dofs );
108 axpy( quad[ qp ], valuesB[ qp ], dofs );
109 }
110 }
111
115 template< class Point, class DofVector >
116 void axpy ( const Point &x, const RangeType &valueFactor, DofVector &dofs ) const
117 {
118 FunctionalAxpyFunctor< RangeType, DofVector > functor( valueFactor, dofs );
119 localFunctionSet().evaluateEach( x, functor );
120 }
121
125 template< class Point, class DofVector >
126 void axpy ( const Point &x, const JacobianRangeType &jacobianFactor, DofVector &dofs ) const
127 {
128 FunctionalAxpyFunctor< JacobianRangeType, DofVector > functor( jacobianFactor, dofs );
129 localFunctionSet().jacobianEach( x, functor );
130 }
133 template< class Point, class DofVector >
134 void axpy ( const Point &x, const HessianRangeType &hessianFactor, DofVector &dofs ) const
135 {
136 FunctionalAxpyFunctor< HessianRangeType, DofVector > functor( hessianFactor, dofs );
137 localFunctionSet().hessianEach( x, functor );
138 }
139
143 template< class Point, class DofVector >
144 void axpy ( const Point &x, const RangeType &valueFactor,
145 const JacobianRangeType &jacobianFactor,
146 DofVector &dofs ) const
147 {
148 axpy( x, valueFactor, dofs );
149 axpy( x, jacobianFactor, dofs );
150 }
151
155 template< class Quadrature, class DofVector, class RangeArray >
156 void evaluateAll ( const Quadrature &quad, const DofVector &dofs, RangeArray &ranges ) const
157 {
158 const unsigned int nop = quad.nop();
159 for( unsigned int qp = 0; qp < nop; ++qp )
160 evaluateAll( quad[ qp ], dofs, ranges[ qp ] );
161 }
162
164 template< class Point, class DofVector >
165 void evaluateAll ( const Point &x, const DofVector &dofs, RangeType &value ) const
166 {
167 value = RangeType( 0 );
168 AxpyFunctor< DofVector, RangeType > functor( dofs, value );
169 localFunctionSet().evaluateEach( x, functor );
170 }
171
173 template< class Point, class RangeArray >
174 void evaluateAll ( const Point &x, RangeArray &values ) const
175 {
176 AssignFunctor< RangeArray > functor( values );
177 localFunctionSet().evaluateEach( x, functor );
178 }
179
181 template< class Quadrature, class DofVector, class JacobianRangeArray >
182 void jacobianAll ( const Quadrature &quad, const DofVector &dofs, JacobianRangeArray &jacobians ) const
183 {
184 const unsigned int nop = quad.nop();
185 for( unsigned int qp = 0; qp < nop; ++qp )
186 jacobianAll( quad[ qp ], dofs, jacobians[ qp ] );
187 }
188
190 template< class Point, class DofVector >
191 void jacobianAll ( const Point &x, const DofVector &dofs, JacobianRangeType &jacobian ) const
192 {
193 jacobian = JacobianRangeType( 0 );
194 AxpyFunctor< DofVector, JacobianRangeType > functor( dofs, jacobian );
195 localFunctionSet().jacobianEach( x, functor );
196 }
197
199 template< class Point, class JacobianRangeArray >
200 void jacobianAll ( const Point &x, JacobianRangeArray &jacobians ) const
201 {
202 AssignFunctor< JacobianRangeArray > functor( jacobians );
203 localFunctionSet().jacobianEach( x, functor );
204 }
205
207 template< class Point, class DofVector >
208 void hessianAll ( const Point &x, const DofVector &dofs, HessianRangeType &hessian ) const
209 {
210 hessian = HessianRangeType( typename HessianRangeType::value_type( typename RangeType::value_type( 0 ) ) );
211 AxpyFunctor< DofVector, HessianRangeType > functor( dofs, hessian );
212 localFunctionSet().hessianEach( x, functor );
213 }
214
216 template< class Point, class HessianRangeArray >
217 void hessianAll ( const Point &x, HessianRangeArray &hessians ) const
218 {
219 AssignFunctor< HessianRangeArray > functor( hessians );
220 localFunctionSet().hessianEach( x, functor );
221 }
222
224 const EntityType &entity () const { return localFunctionSet().entity(); }
225
226
227 // Non-interface methods
228 // ---------------------
229
231 const LocalFunctionSetType localFunctionSet () const { return localFunctionSet_; }
232
233 private:
234 LocalFunctionSetType localFunctionSet_;
235 };
236
237 } // namespace Fem
238
239} // namespace Dune
240
241#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
int nop() const
obtain the number of integration points
Definition: quadrature.hh:291
actual interface class for quadratures
Definition: quadrature.hh:401
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:88
void jacobianAll(const Point &x, JacobianRangeArray &jacobians) const
please doc me
Definition: simple.hh:200
FunctionSpaceType::HessianRangeType HessianRangeType
hessian range type
Definition: simple.hh:49
FunctionSpaceType::JacobianRangeType JacobianRangeType
jacobian range type
Definition: simple.hh:47
void jacobianAll(const Point &x, const DofVector &dofs, JacobianRangeType &jacobian) const
please doc me
Definition: simple.hh:191
void hessianAll(const Point &x, const DofVector &dofs, HessianRangeType &hessian) const
please doc me
Definition: simple.hh:208
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:144
const LocalFunctionSetType localFunctionSet() const
return local function set
Definition: simple.hh:231
void jacobianAll(const Quadrature &quad, const DofVector &dofs, JacobianRangeArray &jacobians) const
please doc me
Definition: simple.hh:182
FunctionSpaceType::RangeType RangeType
range type
Definition: simple.hh:45
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:126
const EntityType & entity() const
please doc me
Definition: simple.hh:224
void evaluateAll(const Point &x, const DofVector &dofs, RangeType &value) const
please doc me
Definition: simple.hh:165
void hessianAll(const Point &x, HessianRangeArray &hessians) const
please doc me
Definition: simple.hh:217
std::size_t size() const
return size of basis function set
Definition: simple.hh:76
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:156
Dune::ReferenceElement< typename EntityType::Geometry > ReferenceElementType
type of reference element
Definition: simple.hh:55
void axpy(const Point &x, const HessianRangeType &hessianFactor, DofVector &dofs) const
Add H:D^2phi to each dof.
Definition: simple.hh:134
decltype(auto) referenceElement() const
return reference element
Definition: simple.hh:79
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:102
SimpleBasisFunctionSet(const LocalFunctionSetType &localFunctionSet)
constructor
Definition: simple.hh:68
FunctionSpaceType::DomainType DomainType
range type
Definition: simple.hh:43
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:116
void evaluateAll(const Point &x, RangeArray &values) const
please doc me
Definition: simple.hh:174
int order() const
return order of basis function set
Definition: simple.hh:73
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 (Jul 27, 22:29, 2024)