3#ifndef DUNE_DEFAULTBASISFACTORY_HH
4#define DUNE_DEFAULTBASISFACTORY_HH
8#include <dune/geometry/topologyfactory.hh>
10#include <dune/localfunctions/utility/basismatrix.hh>
17 static T
apply(
const T &t )
31 template<
class PreBFactory,
32 class InterpolFactory,
33 unsigned int dim,
unsigned int dimR,
35 class PreBasisKeyExtractor = Identity >
36 struct DefaultBasisFactory;
38 template<
class PreBFactory,
39 class InterpolFactory,
40 unsigned int dim,
unsigned int dimR,
42 class PreBasisKeyExtractor >
43 struct DefaultBasisFactoryTraits
45 static const unsigned int dimension = dim;
46 static const unsigned int dimRange = dimR;
48 typedef PreBFactory PreBasisFactory;
49 typedef typename PreBasisFactory::Object PreBasis;
50 typedef InterpolFactory InterpolationFactory;
51 typedef typename InterpolationFactory::Object Interpolation;
53 typedef typename PreBasisFactory::template EvaluationBasisFactory<dim,SF>::Type MonomialBasisFactory;
54 typedef typename MonomialBasisFactory::Object MonomialBasis;
55 typedef StandardEvaluator< MonomialBasis > Evaluator;
56 typedef PolynomialBasisWithMatrix< Evaluator, SparseCoeffMatrix< SF, dimRange > > Basis;
58 typedef const Basis Object;
59 typedef typename InterpolationFactory::Key Key;
60 typedef DefaultBasisFactory<PreBFactory,InterpolFactory,dim,dimR,SF,CF,PreBasisKeyExtractor> Factory;
63 template<
class PreBFactory,
64 class InterpolFactory,
65 unsigned int dim,
unsigned int dimR,
67 class PreBasisKeyExtractor >
68 struct DefaultBasisFactory
69 :
public TopologyFactory<
70 DefaultBasisFactoryTraits< PreBFactory,InterpolFactory,dim,dimR,SF,CF,PreBasisKeyExtractor >
73 typedef DefaultBasisFactoryTraits< PreBFactory,InterpolFactory,dim,dimR,SF,CF,PreBasisKeyExtractor > Traits;
74 static const unsigned int dimension = Traits::dimension;
75 static const unsigned int dimRange = Traits::dimRange;
76 typedef SF StorageField;
77 typedef CF ComputeField;
78 typedef typename Traits::Basis Basis;
79 typedef typename Traits::PreBasisFactory PreBasisFactory;
81 typedef typename Traits::Object Object;
82 typedef typename Traits::Key Key;
83 template <
unsigned int dd,
class FF>
84 struct EvaluationBasisFactory
86 typedef typename Traits::PreBasisFactory::template EvaluationBasisFactory<dd,FF>::Type
90 template<
class Topology >
91 static Object *createObject (
const Key &key )
94 const typename Traits::PreBasis *preBasis = Traits::PreBasisFactory::template create<Topology>( preBasisKey );
95 const typename Traits::Interpolation *interpol = Traits::InterpolationFactory::template create<Topology>( key );
96 BasisMatrix<
typename Traits::PreBasis,
97 typename Traits::Interpolation,
98 ComputeField > matrix( *preBasis, *interpol );
100 const typename Traits::MonomialBasis *monomialBasis = Traits::MonomialBasisFactory::template create< Topology >( preBasis->order() );
102 Basis *basis =
new Basis( *monomialBasis );
104 basis->fill( matrix );
106 Traits::InterpolationFactory::release(interpol);
107 Traits::PreBasisFactory::release(preBasis);
112 static void release( Object *
object)
114 const typename Traits::MonomialBasis *monomialBasis = &(
object->basis());
116 Traits::MonomialBasisFactory::release( monomialBasis );
A few common exception classes.
decltype(auto) apply(F &&f, ArgTuple &&args)
Apply function with arguments given as tuple.
Definition: apply.hh:58
Dune namespace.
Definition: alignedallocator.hh:10
static void release(Object *object)
release the object returned by the create methods
Definition: topologyfactory.hh:60