DUNE PDELab (2.8)

dglocalcoefficients.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_DGLOCALCOEFFICIENTS_HH
4#define DUNE_DGLOCALCOEFFICIENTS_HH
5
6#include <cassert>
7#include <vector>
8
9#include <dune/localfunctions/common/localkey.hh>
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;
60 typedef const DGLocalCoefficients Object;
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
A class providing local coefficients for dg spaces.
Definition: dglocalcoefficients.hh:21
DGLocalCoefficients(const unsigned int n)
construct local keys for n basis functions
Definition: dglocalcoefficients.hh:26
Describe position of one degree of freedom.
Definition: localkey.hh:21
Dune namespace.
Definition: alignedallocator.hh:11
A factory class for the dg local coefficients.
Definition: dglocalcoefficients.hh:57
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)