Dune Core Modules (2.6.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/geometry/topologyfactory.hh>
9
10#include <dune/localfunctions/utility/polynomialbasis.hh>
11#include <dune/localfunctions/orthonormal/orthonormalcompute.hh>
12
13namespace Dune
14{
15
16 // OrthonormalBasisFactory
17 // -----------------------
18 template< int dim, class SF, class CF = typename ComputeField< SF, 512 >::Type >
19 struct OrthonormalBasisFactory;
20 template< int dim, class SF, class CF >
21 struct OrthonormalBasisFactoryTraits
22 {
23 typedef Dune::MonomialBasisProvider< dim, SF > MonomialBasisProviderType;
24 typedef typename MonomialBasisProviderType::Object MonomialBasisType;
25 typedef SparseCoeffMatrix< SF, 1 > CoefficientMatrix;
26 typedef StandardEvaluator< MonomialBasisType > Evaluator;
27 typedef PolynomialBasis< Evaluator, CoefficientMatrix > Basis;
28
29 static const unsigned int dimension = dim;
30 typedef unsigned int Key;
31 typedef const Basis Object;
32 typedef OrthonormalBasisFactory<dim,SF,CF> Factory;
33 };
34
35 template< int dim, class SF, class CF >
36 struct OrthonormalBasisFactory :
37 public TopologyFactory< OrthonormalBasisFactoryTraits<dim,SF,CF> >
38 {
39 static const unsigned int dimension = dim;
40 typedef SF StorageField;
41 typedef CF ComputeField;
42 typedef OrthonormalBasisFactoryTraits<dim,SF,CF> Traits;
43
44 typedef typename Traits::Key Key;
45 typedef typename Traits::Object Object;
46
47 template <unsigned int dd, class FF>
48 struct EvaluationBasisFactory
49 {
50 typedef MonomialBasisProvider<dd,FF> Type;
51 };
52
53 typedef typename EvaluationBasisFactory< dimension, StorageField >::Type MonomialBasisProviderType;
54 typedef typename MonomialBasisProviderType::Object MonomialBasisType;
55
56 typedef SparseCoeffMatrix< StorageField, 1 > CoefficientMatrix;
57 typedef StandardEvaluator< MonomialBasisType > Evaluator;
58 typedef PolynomialBasis< Evaluator, CoefficientMatrix > Basis;
59
60 typedef typename Impl::SimplexTopology< dim >::type SimplexTopology;
61
62 template< class Topology >
63 static Object *createObject ( const unsigned int order )
64 {
65 const typename Traits::MonomialBasisType &monomialBasis = *Traits::MonomialBasisProviderType::template create< SimplexTopology >( order );
66
67 static typename Traits::CoefficientMatrix _coeffs;
68 if( _coeffs.size() <= monomialBasis.size() )
69 {
70 ONBCompute::ONBMatrix< Topology, ComputeField > matrix( order );
71 _coeffs.fill( matrix );
72 }
73
74 return new Basis( monomialBasis, _coeffs, monomialBasis.size() );
75 }
76 };
77
78}
79
80#endif // #ifndef DUNE_ORTHONORMALBASIS_HH
Dune namespace.
Definition: alignedallocator.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 28, 23:30, 2024)