Dune Core Modules (2.8.0)

orthonormalbasis.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_ORTHONORMALBASIS_HH
4#define DUNE_ORTHONORMALBASIS_HH
5
6#include <sstream>
7
8#include <dune/localfunctions/utility/polynomialbasis.hh>
9#include <dune/localfunctions/orthonormal/orthonormalcompute.hh>
10
11namespace Dune
12{
13
14 // OrthonormalBasisFactory
15 // -----------------------
16 template< int dim, class SF, class CF = typename ComputeField< SF, 512 >::Type >
17 struct OrthonormalBasisFactory
18 {
19 static const unsigned int dimension = dim;
20 typedef SF StorageField;
21 typedef CF ComputeField;
22
23 template <unsigned int dd, class FF>
24 struct EvaluationBasisFactory
25 {
26 typedef MonomialBasisProvider<dd,FF> Type;
27 };
28
29 typedef typename EvaluationBasisFactory< dimension, StorageField >::Type MonomialBasisProviderType;
30 typedef typename MonomialBasisProviderType::Object MonomialBasisType;
31
32 typedef SparseCoeffMatrix< StorageField, 1 > CoefficientMatrix;
33 typedef StandardEvaluator< MonomialBasisType > Evaluator;
34 typedef PolynomialBasis< Evaluator, CoefficientMatrix > Basis;
35
36 typedef unsigned int Key;
37 typedef const Basis Object;
38
39 static constexpr GeometryType SimplexGeometry = GeometryTypes::simplex(dim);
40
41 template< GeometryType::Id geometryId >
42 static Object *create ( const unsigned int order )
43 {
44 const MonomialBasisType &monomialBasis = *MonomialBasisProviderType::template create< SimplexGeometry >( order );
45
46 static CoefficientMatrix _coeffs;
47 if( _coeffs.size() <= monomialBasis.size() )
48 {
49 ONBCompute::ONBMatrix< geometryId, ComputeField > matrix( order );
50 _coeffs.fill( matrix );
51 }
52
53 return new Basis( monomialBasis, _coeffs, monomialBasis.size() );
54 }
55 static void release( Object *object ) { delete object; }
56 };
57
58}
59
60#endif // #ifndef DUNE_ORTHONORMALBASIS_HH
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:130
constexpr GeometryType simplex(unsigned int dim)
Returns a GeometryType representing a simplex of dimension dim.
Definition: type.hh:461
Dune namespace.
Definition: alignedallocator.hh:11
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 25, 23:30, 2024)