Dune Core Modules (unstable)

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