Dune Core Modules (2.6.0)

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/geometry/topologyfactory.hh>
10#include <dune/localfunctions/common/localkey.hh>
11
12namespace Dune
13{
14
15 // DGLocalCoefficients
16 // -------------------
17
22 {
24
25 public:
27 DGLocalCoefficients ( const unsigned int n )
28 : localKey_( n )
29 {
30 for( unsigned i = 0; i < n; ++i )
31 localKey_[ i ] = LocalKey( 0, 0, i );
32 }
33
34 const LocalKey &localKey ( const unsigned int i ) const
35 {
36 assert( i < size() );
37 return localKey_[ i ];
38 }
39
40 unsigned int size () const
41 {
42 return localKey_.size();
43 }
44
45 private:
46 std::vector< LocalKey > localKey_;
47 };
48
49
50
51 // DGLocalCoefficientsFactory
52 // --------------------------
56 template< class BasisCreator >
57 struct DGLocalCoefficientsFactory;
58 template< class BasisFactory >
59 struct DGLocalCoefficientsFactoryTraits
60 {
61 static const unsigned int dimension = BasisFactory::dimension;
62 typedef typename BasisFactory::Key Key;
63 typedef DGLocalCoefficients LocalCoefficients;
64 typedef const DGLocalCoefficients Object;
65 typedef DGLocalCoefficientsFactory<BasisFactory> Factory;
66 };
67
68 template< class BasisFactory >
70 public TopologyFactory< DGLocalCoefficientsFactoryTraits<BasisFactory> >
71 {
72 typedef DGLocalCoefficientsFactoryTraits<BasisFactory> Traits;
73
74 static const unsigned int dimension = Traits::dimension;
75 typedef typename Traits::Key Key;
76 typedef typename Traits::Object Object;
77
78 template< class Topology >
79 static Object *createObject ( const Key &key )
80 {
81 const typename BasisFactory::Object *basis
82 = BasisFactory::template create< Topology >( key );
83 Object *coefficients = new Object( basis->size() );
84 BasisFactory::release( basis );
85 return coefficients;
86 }
87 };
88
89}
90
91#endif // #ifndef DUNE_DGLOCALCOEFFICIENTS_HH
A class providing local coefficients for dg spaces.
Definition: dglocalcoefficients.hh:22
DGLocalCoefficients(const unsigned int n)
construct local keys for n basis functions
Definition: dglocalcoefficients.hh:27
Describe position of one degree of freedom.
Definition: localkey.hh:21
Dune namespace.
Definition: alignedallocator.hh:10
A factory class for the dg local coefficients.
Definition: dglocalcoefficients.hh:71
Provide a factory over the generic topologies.
Definition: topologyfactory.hh:39
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)