1#ifndef DUNE_FEM_OPERATOR_COMMON_LOCALMATRIXCOLUMN_HH
2#define DUNE_FEM_OPERATOR_COMMON_LOCALMATRIXCOLUMN_HH
6#include <dune/fem/operator/common/temporarylocalmatrix.hh>
17 template<
class LocalMatrix >
18 class LocalMatrixEntry
20 typedef LocalMatrixEntry< LocalMatrix > ThisType;
23 typedef LocalMatrix LocalMatrixType;
25 typedef typename LocalMatrixType::RangeFieldType RangeFieldType;
27 LocalMatrixEntry ( LocalMatrixType &localMatrix,
unsigned int row,
unsigned int col )
28 : localMatrix_( localMatrix ), row_( row ), col_( col )
31 operator RangeFieldType ()
const {
return localMatrix_.get( row_, col_ ); }
33 ThisType &operator= (
const RangeFieldType &value ) { localMatrix_.set( row_, col_, value );
return *
this; }
35 ThisType &operator+= (
const RangeFieldType &value ) { localMatrix_.add( row_, col_, value );
return *
this; }
36 ThisType &operator-= (
const RangeFieldType &value ) { localMatrix_.add( row_, col_, -value );
return *
this; }
38 ThisType &operator*= (
const RangeFieldType &value ) { localMatrix_.set( row_, col_, localMatrix_.get( row_, col_ ) * value );
return *
this; }
39 ThisType &operator/= (
const RangeFieldType &value ) { localMatrix_.set( row_, col_, localMatrix_.get( row_, col_ ) / value );
return *
this; }
42 LocalMatrixType &localMatrix_;
43 unsigned int row_, col_;
51 template<
class LocalMatrix >
52 class LocalMatrixColumn
54 typedef LocalMatrixColumn< LocalMatrix > ThisType;
57 typedef LocalMatrix LocalMatrixType;
59 typedef typename LocalMatrixType::RangeFieldType RangeFieldType;
60 typedef typename LocalMatrixType::RangeBasisFunctionSetType BasisFunctionSetType;
62 typedef typename BasisFunctionSetType::RangeType RangeType;
63 typedef typename BasisFunctionSetType::JacobianRangeType JacobianRangeType;
64 typedef typename BasisFunctionSetType::HessianRangeType HessianRangeType;
66 typedef RangeFieldType value_type;
67 typedef unsigned int size_type;
69 LocalMatrixColumn ( LocalMatrixType &localMatrix,
unsigned int col )
70 : localMatrix_( localMatrix ), col_( col )
73 RangeFieldType operator[] ( size_type row )
const {
return localMatrix_.get( row, col_ ); }
75 LocalMatrixEntry< LocalMatrixType > operator[] ( size_type row ) {
return LocalMatrixEntry< LocalMatrixType >( localMatrix_, row, col_ ); }
77 template<
class Point,
class... Factor >
78 void axpy (
const Point &x, Factor &&... factor )
80 basisFunctionSet().axpy( x, std::forward< Factor >( factor )..., *
this );
84 void axpyQuadrature (
const Quadrature &quadrature, Factor &&... factor )
86 basisFunctionSet().axpy( quadrature, std::forward< Factor >( factor )..., *
this );
89 const BasisFunctionSetType &basisFunctionSet ()
const {
return localMatrix_.rangeBasisFunctionSet(); }
91 auto size()
const {
return basisFunctionSet().size(); }
94 LocalMatrixType &localMatrix_;
103 template<
class DomainSpace,
class RangeSpace >
104 class LocalMatrixColumn< TemporaryLocalMatrix< DomainSpace, RangeSpace > >
106 typedef LocalMatrixColumn< TemporaryLocalMatrix< DomainSpace, RangeSpace > > ThisType;
109 typedef TemporaryLocalMatrix< DomainSpace, RangeSpace > LocalMatrixType;
111 typedef typename LocalMatrixType::RangeFieldType RangeFieldType;
112 typedef typename LocalMatrixType::RangeBasisFunctionSetType BasisFunctionSetType;
114 typedef typename BasisFunctionSetType::RangeType RangeType;
115 typedef typename BasisFunctionSetType::JacobianRangeType JacobianRangeType;
116 typedef typename BasisFunctionSetType::HessianRangeType HessianRangeType;
118 typedef RangeFieldType value_type;
119 typedef unsigned int size_type;
121 LocalMatrixColumn ( LocalMatrixType &localMatrix,
unsigned int col )
122 : localMatrix_( localMatrix ), col_( col )
125 const value_type &operator[] ( size_type row )
const {
return localMatrix_[ row ][ col_ ]; }
126 value_type &operator[] ( size_type row ) {
return localMatrix_[ row ][ col_ ]; }
128 template<
class Point,
class... Factor >
129 void axpy (
const Point &x, Factor &&... factor )
131 basisFunctionSet().axpy( x, std::forward< Factor >( factor )..., *
this );
135 void axpyQuadrature (
const Quadrature &quadrature, Factor &&... factor )
137 basisFunctionSet().axpy( quadrature, std::forward< Factor >( factor )..., *
this );
140 const BasisFunctionSetType &basisFunctionSet ()
const {
return localMatrix_.rangeBasisFunctionSet(); }
142 auto size()
const {
return basisFunctionSet().size(); }
145 LocalMatrixType &localMatrix_;
actual interface class for quadratures
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