dune-localfunctions  2.7.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 
11 namespace Dune
12 {
13 
14  // DGLocalCoefficients
15  // -------------------
16 
21  {
22  typedef DGLocalCoefficients This;
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;
60  typedef const DGLocalCoefficients Object;
61 
62  template< class Topology >
63  static Object *create ( const Key &key )
64  {
65  const typename BasisFactory::Object *basis
66  = BasisFactory::template create< Topology >( 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
Dune::DGLocalCoefficientsFactory::dimension
static const unsigned int dimension
Definition: dglocalcoefficients.hh:58
Dune
Definition: bdfmcube.hh:15
localkey.hh
Dune::DGLocalCoefficients::size
unsigned int size() const
Definition: dglocalcoefficients.hh:39
Dune::DGLocalCoefficientsFactory::create
static Object * create(const Key &key)
Definition: dglocalcoefficients.hh:63
Dune::DGLocalCoefficientsFactory::release
static void release(Object *object)
Definition: dglocalcoefficients.hh:71
Dune::DGLocalCoefficients::DGLocalCoefficients
DGLocalCoefficients(const unsigned int n)
construct local keys for n basis functions
Definition: dglocalcoefficients.hh:26
Dune::DGLocalCoefficientsFactory
A factory class for the dg local coefficients.
Definition: dglocalcoefficients.hh:56
Dune::DGLocalCoefficientsFactory::Key
BasisFactory::Key Key
Definition: dglocalcoefficients.hh:59
Dune::DGLocalCoefficients
A class providing local coefficients for dg spaces.
Definition: dglocalcoefficients.hh:20
Dune::DGLocalCoefficients::localKey
const LocalKey & localKey(const unsigned int i) const
Definition: dglocalcoefficients.hh:33
Dune::DGLocalCoefficientsFactory::Object
const typedef DGLocalCoefficients Object
Definition: dglocalcoefficients.hh:60
Dune::LocalKey
Describe position of one degree of freedom.
Definition: localkey.hh:20