3#ifndef DUNE_ORTHONORMALCOMPUTE_HH
4#define DUNE_ORTHONORMALCOMPUTE_HH
13#include <dune/common/fmatrix.hh>
15#include <dune/geometry/type.hh>
25 template<
class scalar_t >
29 for(
int j = start; j <= end; ++j )
39 template< Dune::GeometryType::Id geometryId >
42 static constexpr Dune::GeometryType
geometry = geometryId;
45 template<
int dim,
class scalar_t >
47 scalar_t &p, scalar_t &q )
49 return compute(alpha, p, q, std::make_integer_sequence<int,dimension>{});
52 template<
int dim,
class scalar_t ,
int ...ints>
54 scalar_t &p, scalar_t &q, std::integer_sequence<int,ints...> intS)
60 ((computeIntegral<ints>(alpha,p,q,ord)),...);
65 template<
int step,
int dim,
class scalar_t >
67 scalar_t &p, scalar_t &q,
int& ord)
69 int i = alpha.
z( step );
71 if constexpr (
geometry.isPrismatic(step))
78 p *= factorial< scalar_t >( 1, i );
79 q *= factorial< scalar_t >( step+1 + ord, step+1 + ord + i );
90 template< Dune::GeometryType::Id geometryId,
class scalar_t >
98 typedef std::vector< scalar_t >
vec_t;
104 constexpr Dune::GeometryType geometry = geometryId;
105 constexpr unsigned int dim = geometry.dim();
108 const std::size_t size = basis.
size();
109 std::vector< Dune::FieldVector< MI, 1 > > y( size );
110 Dune::FieldVector< MI, dim > x;
111 for(
unsigned int i = 0; i < dim; ++i )
122 for( std::size_t i = 0; i < size; ++i )
124 for( std::size_t j = 0; j < size; ++j )
136 template<
class Vector >
137 void row (
unsigned int row, Vector &vec )
const
141 for( std::size_t i = 0; i <
Base::rows(); ++i )
146 void sprod (
int col1,
int col2, scalar_t &ret )
149 for(
int k = 0; k <= col1; ++k )
151 for(
int l = 0; l <=col2; ++l )
152 ret += Base::operator()( l, col2 ) * S( l, k ) *
Base::operator()( k, col1 );
156 void vmul ( std::size_t col, std::size_t rowEnd,
const scalar_t &s )
158 for( std::size_t i = 0; i <= rowEnd; ++i )
159 Base::operator()( i, col ) *= s;
162 void vsub ( std::size_t coldest, std::size_t colsrc, std::size_t rowEnd,
const scalar_t &s )
164 for( std::size_t i = 0; i <= rowEnd; ++i )
165 Base::operator()( i, coldest ) -= s * Base::operator()( i, colsrc );
173 for( std::size_t i = 0; i < N; ++i )
175 for( std::size_t j = 0; j < N; ++j )
176 Base::operator()( i, j ) = scalar_t( i == j ? 1 : 0 );
182 vmul( 0, 0, scalar_t( 1 ) / sqrt( s ) );
183 for( std::size_t i = 1; i < N; ++i )
185 for( std::size_t k = 0; k < i; ++k )
191 vmul( i, i, scalar_t( 1 ) / sqrt( s ) );
void field_cast(const F1 &f1, F2 &f2)
a helper class to cast from one field to another
Definition: field.hh:157
Definition: orthonormalcompute.hh:23
scalar_t factorial(int start, int end)
Definition: orthonormalcompute.hh:26
Definition: orthonormalcompute.hh:41
static int compute(const Dune::MultiIndex< dim, scalar_t > &alpha, scalar_t &p, scalar_t &q)
Definition: orthonormalcompute.hh:46
static int compute(const Dune::MultiIndex< dim, scalar_t > &alpha, scalar_t &p, scalar_t &q, std::integer_sequence< int, ints... > intS)
Definition: orthonormalcompute.hh:53
static void computeIntegral(const Dune::MultiIndex< dim, scalar_t > &alpha, scalar_t &p, scalar_t &q, int &ord)
Definition: orthonormalcompute.hh:66
static constexpr int dimension
Definition: orthonormalcompute.hh:43
static constexpr Dune::GeometryType geometry
Definition: orthonormalcompute.hh:42
Definition: orthonormalcompute.hh:93
ONBMatrix(unsigned int order)
Definition: orthonormalcompute.hh:101
std::vector< scalar_t > vec_t
Definition: orthonormalcompute.hh:98
void row(unsigned int row, Vector &vec) const
Definition: orthonormalcompute.hh:137
Dune::LFEMatrix< scalar_t > mat_t
Definition: orthonormalcompute.hh:99
Definition: lfematrix.hh:16
unsigned int cols() const
Definition: lfematrix.hh:61
void resize(const unsigned int rows, const unsigned int cols)
Definition: lfematrix.hh:78
const Field & operator()(const unsigned int row, const unsigned int col) const
Definition: lfematrix.hh:42
unsigned int rows() const
Definition: lfematrix.hh:56
unsigned int size() const
Definition: monomialbasis.hh:474
void evaluate(const unsigned int deriv, const DomainVector &x, Field *const values) const
Definition: monomialbasis.hh:496
Definition: monomialbasis.hh:569
Definition: multiindex.hh:35
int z(int i) const
Definition: multiindex.hh:89