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