1#ifndef DUNE_FEM_OPERATOR_PROJECTION_LOCAL_RIESZ_DENSE_HH
2#define DUNE_FEM_OPERATOR_PROJECTION_LOCAL_RIESZ_DENSE_HH
12#include "localrieszprojection.hh"
23 template<
class BasisFunctionSet,
class Quadrature >
24 class DenseLocalRieszProjection
25 :
public LocalRieszProjection< BasisFunctionSet, DenseLocalRieszProjection< BasisFunctionSet, Quadrature > >
27 typedef DenseLocalRieszProjection< BasisFunctionSet, Quadrature > ThisType;
28 typedef LocalRieszProjection< BasisFunctionSet, DenseLocalRieszProjection< BasisFunctionSet, Quadrature > > BaseType;
38 explicit DenseLocalRieszProjection (
const BasisFunctionSetType &basisFunctionSet )
39 : basisFunctionSet_( basisFunctionSet ),
40 inverse_( basisFunctionSet.
size(), basisFunctionSet.
size() )
42 assemble( basisFunctionSet, inverse_ );
46 explicit DenseLocalRieszProjection ( BasisFunctionSetType &&basisFunctionSet )
47 : basisFunctionSet_(
std::forward< BasisFunctionSetType >( basisFunctionSet ) ),
48 inverse_( basisFunctionSet.
size(), basisFunctionSet.
size() )
50 assemble( basisFunctionSet, inverse_ );
60 DenseLocalRieszProjection (
const ThisType &other ) =
default;
62 DenseLocalRieszProjection ( ThisType &&other )
63 : basisFunctionSet_(
std::move( other.basisFunctionSet_ ) ),
64 inverse_(
std::move( other.inverse_ ) )
67 ThisType &operator= (
const ThisType &other ) =
default;
69 ThisType &operator= ( ThisType &&other )
71 basisFunctionSet_ = std::move( other.basisFunctionSet_ );
72 inverse_ = std::move( other.inverse_ );
83 BasisFunctionSetType basisFunctionSet ()
const {
return basisFunctionSet_; }
86 template<
class F,
class LocalDofVector >
87 void apply (
const F&f, LocalDofVector &dofs )
const
89 inverse_.mv( f, dofs );
95 template<
class DenseMatrix >
96 void assemble (
const BasisFunctionSetType &basisFunctionSet, DenseMatrix &matrix )
98 const std::size_t
size = basisFunctionSet.size();
99 std::vector< typename BasisFunctionSetType::RangeType > phi(
size );
102 assert( matrix.N() == basisFunctionSet.size() );
103 assert( matrix.M() == basisFunctionSet.size() );
105 const auto &geometry = basisFunctionSet.geometry();
106 const Quadrature quadrature( geometry.type(), 2*basisFunctionSet.order() );
107 const std::size_t nop = quadrature.nop();
108 for( std::size_t qp = 0; qp < nop; ++qp )
110 basisFunctionSet.evaluateAll( quadrature[ qp ], phi );
112 const auto weight = quadrature.weight( qp )*geometry.integrationElement( quadrature.point( qp ) );
113 for( std::size_t i = 0; i <
size; ++i )
115 matrix[ i ][ i ] += weight*( phi[ i ] * phi[ i ] );
116 for( std::size_t j = i+1; j <
size; ++j )
118 const auto value = weight*( phi[ i ]* phi[ j ] );
119 matrix[ i ][ j ] += value;
120 matrix[ j ][ i ] += value;
126 BasisFunctionSetType basisFunctionSet_;
Traits::value_type value_type
export the type representing the field
Definition: densematrix.hh:157
BasisFunctionSet BasisFunctionSetType
basis function set
Definition: localrieszprojection.hh:26
actual interface class for quadratures
This file implements a dense matrix with dynamic numbers of rows and columns.
Dune namespace.
Definition: alignedallocator.hh:13
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75