dune-localfunctions 2.8.0
dglocalcoefficients.hh
Go to the documentation of this file.
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_DGLOCALCOEFFICIENTS_HH
4#define DUNE_DGLOCALCOEFFICIENTS_HH
5
6#include <cassert>
7#include <vector>
8
10
11namespace Dune
12{
13
14 // DGLocalCoefficients
15 // -------------------
16
21 {
23
24 public:
26 DGLocalCoefficients ( const unsigned int n )
27 : localKey_( n )
28 {
29 for( unsigned i = 0; i < n; ++i )
30 localKey_[ i ] = LocalKey( 0, 0, i );
31 }
32
33 const LocalKey &localKey ( const unsigned int i ) const
34 {
35 assert( i < size() );
36 return localKey_[ i ];
37 }
38
39 unsigned int size () const
40 {
41 return localKey_.size();
42 }
43
44 private:
45 std::vector< LocalKey > localKey_;
46 };
47
48
49
50 // DGLocalCoefficientsFactory
51 // --------------------------
55 template< class BasisFactory >
57 {
58 static const unsigned int dimension = BasisFactory::dimension;
59 typedef typename BasisFactory::Key Key;
61
62 template< GeometryType::Id geometryId >
63 static Object *create ( const Key &key )
64 {
65 const typename BasisFactory::Object *basis
66 = BasisFactory::template create< geometryId >( key );
67 Object *coefficients = new Object( basis->size() );
68 BasisFactory::release( basis );
69 return coefficients;
70 }
71 static void release( Object *object ) { delete object; }
72 };
73
74}
75
76#endif // #ifndef DUNE_DGLOCALCOEFFICIENTS_HH
Definition: bdfmcube.hh:16
Describe position of one degree of freedom.
Definition: localkey.hh:21
A class providing local coefficients for dg spaces.
Definition: dglocalcoefficients.hh:21
unsigned int size() const
Definition: dglocalcoefficients.hh:39
const LocalKey & localKey(const unsigned int i) const
Definition: dglocalcoefficients.hh:33
DGLocalCoefficients(const unsigned int n)
construct local keys for n basis functions
Definition: dglocalcoefficients.hh:26
A factory class for the dg local coefficients.
Definition: dglocalcoefficients.hh:57
static void release(Object *object)
Definition: dglocalcoefficients.hh:71
const DGLocalCoefficients Object
Definition: dglocalcoefficients.hh:60
static Object * create(const Key &key)
Definition: dglocalcoefficients.hh:63
BasisFactory::Key Key
Definition: dglocalcoefficients.hh:59
static const unsigned int dimension
Definition: dglocalcoefficients.hh:58