dune-fem  2.4.1-rc
basisfunctionset/simple.hh
Go to the documentation of this file.
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>
8 #include <dune/geometry/type.hh>
9 
11 
12 namespace Dune
13 {
14 
15  namespace Fem
16  {
17 
18  // SimpleBasisFunctionSet
19  // ----------------------
20 
27  template< class LocalFunctionSet >
29  {
31 
32  public:
34 
38 
47 
49  typedef Dune::ReferenceElement< typename EntityType::Geometry::ctype, EntityType::Geometry::coorddimension > ReferenceElementType;
50 
51  /* default constructor
52  *
53  * Note: we require a local function set to have a default constructor;
54  * eventually use LocalFunctionSetProxy.
55  */
57 
62  explicit SimpleBasisFunctionSet ( const LocalFunctionSetType &localFunctionSet )
63  : localFunctionSet_( localFunctionSet )
64  {}
65 
67  int order () const { return localFunctionSet().order(); }
68 
70  std::size_t size () const { return localFunctionSet().size(); }
71 
73  const ReferenceElementType &referenceElement () const
74  {
75  return Dune::ReferenceElements< typename EntityType::Geometry::ctype, EntityType::Geometry::coorddimension >::general( entity().type() );
76  }
77 
81  template< class Quadrature, class Vector, class DofVector >
82  void axpy ( const Quadrature &quad, const Vector &values, DofVector &dofs ) const
83  {
84  const unsigned int nop = quad.nop();
85  for( unsigned int qp = 0; qp < nop; ++qp )
86  axpy( quad[ qp ], values[ qp ], dofs );
87  }
88 
95  template< class Quadrature, class VectorA, class VectorB, class DofVector >
96  void axpy ( const Quadrature &quad, const VectorA &valuesA, const VectorB &valuesB, DofVector &dofs ) const
97  {
98  const unsigned int nop = quad.nop();
99  for( unsigned int qp = 0; qp < nop; ++qp )
100  {
101  axpy( quad[ qp ], valuesA[ qp ], dofs );
102  axpy( quad[ qp ], valuesB[ qp ], dofs );
103  }
104  }
105 
109  template< class Point, class DofVector >
110  void axpy ( const Point &x, const RangeType &valueFactor, DofVector &dofs ) const
111  {
112  FunctionalAxpyFunctor< RangeType, DofVector > functor( valueFactor, dofs );
113  localFunctionSet().evaluateEach( x, functor );
114  }
115 
119  template< class Point, class DofVector >
120  void axpy ( const Point &x, const JacobianRangeType &jacobianFactor, DofVector &dofs ) const
121  {
122  FunctionalAxpyFunctor< JacobianRangeType, DofVector > functor( jacobianFactor, dofs );
123  localFunctionSet().jacobianEach( x, functor );
124  }
125 
129  template< class Point, class DofVector >
130  void axpy ( const Point &x, const RangeType &valueFactor,
131  const JacobianRangeType &jacobianFactor,
132  DofVector &dofs ) const
133  {
134  axpy( x, valueFactor, dofs );
135  axpy( x, jacobianFactor, dofs );
136  }
137 
141  template< class Quadrature, class DofVector, class RangeArray >
142  void evaluateAll ( const Quadrature &quad, const DofVector &dofs, RangeArray &ranges ) const
143  {
144  const unsigned int nop = quad.nop();
145  for( unsigned int qp = 0; qp < nop; ++qp )
146  evaulateAll( quad[ qp ], dofs, ranges[ qp ] );
147  }
148 
150  template< class Point, class DofVector >
151  void evaluateAll ( const Point &x, const DofVector &dofs, RangeType &value ) const
152  {
153  value = RangeType( 0 );
154  AxpyFunctor< DofVector, RangeType > functor( dofs, value );
155  localFunctionSet().evaluateEach( x, functor );
156  }
157 
159  template< class Point, class RangeArray >
160  void evaluateAll ( const Point &x, RangeArray &values ) const
161  {
162  AssignFunctor< RangeArray > functor( values );
163  localFunctionSet().evaluateEach( x, functor );
164  }
165 
167  template< class Quadrature, class DofVector, class JacobianRangeArray >
168  void jacobianAll ( const Quadrature &quad, const DofVector &dofs, JacobianRangeArray &jacobians ) const
169  {
170  const unsigned int nop = quad.nop();
171  for( unsigned int qp = 0; qp < nop; ++qp )
172  jacobianAll( quad[ qp ], dofs, jacobians[ qp ] );
173  }
174 
176  template< class Point, class DofVector >
177  void jacobianAll ( const Point &x, const DofVector &dofs, JacobianRangeType &jacobian ) const
178  {
179  jacobian = JacobianRangeType( 0 );
180  AxpyFunctor< DofVector, JacobianRangeType > functor( dofs, jacobian );
181  localFunctionSet().jacobianEach( x, functor );
182  }
183 
185  template< class Point, class JacobianRangeArray >
186  void jacobianAll ( const Point &x, JacobianRangeArray &jacobians ) const
187  {
188  AssignFunctor< JacobianRangeArray > functor( jacobians );
189  localFunctionSet().jacobianEach( x, functor );
190  }
191 
193  template< class Point, class DofVector >
194  void hessianAll ( const Point &x, const DofVector &dofs, HessianRangeType &hessian ) const
195  {
196  hessian = HessianRangeType( typename HessianRangeType::value_type( typename RangeType::value_type( 0 ) ) );
197  AxpyFunctor< DofVector, HessianRangeType > functor( dofs, hessian );
198  localFunctionSet().hessianEach( x, functor );
199  }
200 
202  template< class Point, class HessianRangeArray >
203  void hessianAll ( const Point &x, HessianRangeArray &hessians ) const
204  {
205  AssignFunctor< HessianRangeArray > functor( hessians );
206  localFunctionSet().hessianEach( x, functor );
207  }
208 
210  const EntityType &entity () const { return localFunctionSet().entity(); }
211 
212 
213  // Non-interface methods
214  // ---------------------
215 
217  const LocalFunctionSetType localFunctionSet () const { return localFunctionSet_; }
218 
219  private:
220  LocalFunctionSetType localFunctionSet_;
221  };
222 
223  } // namespace Fem
224 
225 } // namespace Dune
226 
227 #endif // #ifndef DUNE_FEM_SPACE_BASISFUNCTIONSET_SIMPLE_HH
FunctionSpaceType::RangeType RangeType
range type
Definition: basisfunctionset/simple.hh:42
LocalFunctionSet LocalFunctionSetType
Definition: basisfunctionset/simple.hh:33
void jacobianAll(const Point &x, JacobianRangeArray &jacobians) const
please doc me
Definition: basisfunctionset/simple.hh:186
void jacobianEach(const Point &x, Functor functor) const
evalute jacobian of each basis function
const LocalFunctionSetType localFunctionSet() const
return local function set
Definition: basisfunctionset/simple.hh:217
int nop() const
obtain the number of integration points
Definition: quadrature.hh:226
LocalFunctionSetType::EntityType EntityType
entity type
Definition: basisfunctionset/simple.hh:36
A vector valued function space.
Definition: functionspace.hh:16
int order() const
return order of basis functions
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: basisfunctionset/simple.hh:130
VectorSpaceTraits< DomainField, RangeField, dimD, dimR >::LinearMappingType JacobianRangeType
Intrinsic type used for the jacobian values has a Dune::FieldMatrix type interface.
Definition: functionspaceinterface.hh:74
FunctionSpaceType::HessianRangeType HessianRangeType
hessian range type
Definition: basisfunctionset/simple.hh:46
FieldVector< FieldMatrix< RangeFieldType, dimDomain, dimDomain >, dimRange > HessianRangeType
Intrinsic type used for the hessian values has a Dune::FieldMatrix type interface.
Definition: functionspaceinterface.hh:78
Local basis functions.
Definition: localfunctionset.hh:29
void jacobianAll(const Point &x, const DofVector &dofs, JacobianRangeType &jacobian) const
please doc me
Definition: basisfunctionset/simple.hh:177
const EntityType & entity() const
please doc me
Definition: basisfunctionset/simple.hh:210
void hessianAll(const Point &x, HessianRangeArray &hessians) const
please doc me
Definition: basisfunctionset/simple.hh:203
Definition: space/basisfunctionset/functor.hh:87
void evaluateAll(const Point &x, const DofVector &dofs, RangeType &value) const
please doc me
Definition: basisfunctionset/simple.hh:151
FunctionSpaceType::DomainType DomainType
range type
Definition: basisfunctionset/simple.hh:40
void jacobianAll(const Quadrature &quad, const DofVector &dofs, JacobianRangeArray &jacobians) const
please doc me
Definition: basisfunctionset/simple.hh:168
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: basisfunctionset/simple.hh:82
Definition: misc/functor.hh:30
Definition: coordinate.hh:4
const ReferenceElementType & referenceElement() const
return reference element
Definition: basisfunctionset/simple.hh:73
VectorSpaceTraits< DomainField, RangeField, dimD, dimR >::DomainType DomainType
Type of domain vector (using type of domain field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:66
void hessianEach(const Point &x, Functor functor) const
evalute hessian of each basis function
Definition: space/basisfunctionset/functor.hh:111
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: basisfunctionset/simple.hh:96
FunctionSpaceType::JacobianRangeType JacobianRangeType
jacobian range type
Definition: basisfunctionset/simple.hh:44
const EntityType & entity() const
return entity
void evaluateAll(const Point &x, RangeArray &values) const
please doc me
Definition: basisfunctionset/simple.hh:160
std::size_t size() const
return number of basis functions
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: basisfunctionset/simple.hh:110
Dune::ReferenceElement< typename EntityType::Geometry::ctype, EntityType::Geometry::coorddimension > ReferenceElementType
type of reference element
Definition: basisfunctionset/simple.hh:49
LocalFunctionSetType::FunctionSpaceType FunctionSpaceType
Definition: basisfunctionset/simple.hh:37
void hessianAll(const Point &x, const DofVector &dofs, HessianRangeType &hessian) const
please doc me
Definition: basisfunctionset/simple.hh:194
int order() const
return order of basis function set
Definition: basisfunctionset/simple.hh:67
SimpleBasisFunctionSet(const LocalFunctionSetType &localFunctionSet)
constructor
Definition: basisfunctionset/simple.hh:62
VectorSpaceTraits< DomainField, RangeField, dimD, dimR >::RangeType RangeType
Type of range vector (using type of range field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:70
void evaluateAll(const Quadrature &quad, const DofVector &dofs, RangeArray &ranges) const
evaluate all basis functions and store the result in the ranges array
Definition: basisfunctionset/simple.hh:142
Entity EntityType
entity type
Definition: localfunctionset.hh:32
Please doc me.
Definition: basisfunctionset/simple.hh:28
void evaluateEach(const Point &x, Functor functor) const
evalute each basis function
SimpleBasisFunctionSet()
Definition: basisfunctionset/simple.hh:56
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: basisfunctionset/simple.hh:120
actual interface class for quadratures
Definition: quadrature.hh:320
std::size_t size() const
return size of basis function set
Definition: basisfunctionset/simple.hh:70