1 #ifndef DUNE_BASISMATRIX_HH
2 #define DUNE_BASISMATRIX_HH
5 #include <dune/common/exceptions.hh>
21 template<
class PreBasis,
class Interpolation,
25 template<
class PreBasis,
class Interpolation,
32 const Interpolation& localInterpolation )
33 : cols_(preBasis.size())
35 localInterpolation.interpolate( preBasis, *
this );
39 DUNE_THROW(MathError,
"While computing basis a singular matrix was constructed!");
54 template<
class Topology,
class F,
58 :
public BasisMatrixBase< const MonomialBasis< Topology, F >, Interpolation, Field >
65 const Interpolation& localInterpolation )
66 :
Base(preBasis, localInterpolation)
69 template <
class Vector>
70 void row(
const unsigned int row, Vector &vec )
const
72 const unsigned int N = Matrix::rows();
73 assert( Matrix::cols() == N && vec.size() == N );
76 for (
unsigned int i=0;i<N;++i)
80 template<
int dim,
class F,
84 :
public BasisMatrixBase< const VirtualMonomialBasis< dim, F >, Interpolation, Field >
91 const Interpolation& localInterpolation )
92 :
Base(preBasis, localInterpolation)
95 template <
class Vector>
96 void row(
const unsigned int row, Vector &vec )
const
98 const unsigned int N = Matrix::rows();
99 assert( Matrix::cols() == N && vec.size() == N );
102 for (
unsigned int i=0;i<N;++i)
106 template<
class Eval,
class CM,
class D,
class R,
110 :
public BasisMatrixBase< const PolynomialBasis<Eval,CM,D,R>, Interpolation, Field >
117 const Interpolation& localInterpolation )
118 :
Base(preBasis, localInterpolation),
122 unsigned int cols()
const
124 return preBasis_.matrix().baseSize() ;
126 template <
class Vector>
127 void row(
const unsigned int row, Vector &vec )
const
129 assert( Matrix::rows() == Matrix::cols() );
130 assert( vec.size() == preBasis_.matrix().baseSize() );
131 assert( Matrix::cols() == preBasis_.size() );
132 for (
unsigned int j=0;j<Matrix::cols();++j)
134 for (
unsigned int i=0;i<Matrix::rows();++i)
136 addRow(i,Base::Matrix::operator()(i,row),vec);
139 const PreBasis& preBasis_;
141 template<
class Eval,
class CM,
145 :
public BasisMatrixBase< const PolynomialBasisWithMatrix<Eval,CM>, Interpolation, Field >
152 const Interpolation& localInterpolation )
153 :
Base(preBasis, localInterpolation),
157 unsigned int cols()
const
159 return preBasis_.matrix().baseSize() ;
161 unsigned int rows ()
const
163 assert( Matrix::rows() == preBasis_.matrix().size() );
164 return preBasis_.matrix().size()*CM::blockSize ;
166 template <
class Vector>
167 void row(
const unsigned int row, Vector &vec )
const
169 unsigned int r = row / CM::blockSize;
170 assert( r < Matrix::rows() );
171 assert( Matrix::rows() == Matrix::cols() );
172 assert( vec.size() == preBasis_.matrix().baseSize() );
173 assert( Matrix::cols() == preBasis_.size() );
174 for (
unsigned int j=0;j<vec.size();++j)
176 for (
unsigned int i=0;i<Matrix::rows();++i)
178 addRow(i*CM::blockSize+row%CM::blockSize,Base::Matrix::operator()(i,r),vec);
181 const PreBasis& preBasis_;
185 #endif // DUNE_BASISMATRIX_HH