Dune Core Modules (2.9.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// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5#ifndef DUNE_ORTHONORMALBASIS_HH
6#define DUNE_ORTHONORMALBASIS_HH
7
8#include <sstream>
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 {
21 static const unsigned int dimension = dim;
22 typedef SF StorageField;
23 typedef CF ComputeField;
24
25 template <unsigned int dd, class FF>
26 struct EvaluationBasisFactory
27 {
28 typedef MonomialBasisProvider<dd,FF> Type;
29 };
30
31 typedef typename EvaluationBasisFactory< dimension, StorageField >::Type MonomialBasisProviderType;
32 typedef typename MonomialBasisProviderType::Object MonomialBasisType;
33
34 typedef SparseCoeffMatrix< StorageField, 1 > CoefficientMatrix;
35 typedef StandardEvaluator< MonomialBasisType > Evaluator;
36 typedef PolynomialBasis< Evaluator, CoefficientMatrix > Basis;
37
38 typedef unsigned int Key;
39 typedef const Basis Object;
40
41 static constexpr GeometryType SimplexGeometry = GeometryTypes::simplex(dim);
42
43 template< GeometryType::Id geometryId >
44 static Object *create ( const unsigned int order )
45 {
46 const MonomialBasisType &monomialBasis = *MonomialBasisProviderType::template create< SimplexGeometry >( order );
47
48 static CoefficientMatrix _coeffs;
49 if( _coeffs.size() <= monomialBasis.size() )
50 {
51 ONBCompute::ONBMatrix< geometryId, ComputeField > matrix( order );
52 _coeffs.fill( matrix );
53 }
54
55 return new Basis( monomialBasis, _coeffs, monomialBasis.size() );
56 }
57 static void release( Object *object ) { delete object; }
58 };
59
60}
61
62#endif // #ifndef DUNE_ORTHONORMALBASIS_HH
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
constexpr GeometryType simplex(unsigned int dim)
Returns a GeometryType representing a simplex of dimension dim.
Definition: type.hh:463
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)