monomial.icc
Go to the documentation of this file.
#ifndef _RHEOLEF_MONOMIAL_ICC
#define _RHEOLEF_MONOMIAL_ICC
//
// monomial basis, as initial local FEM basis
// see also bernstein and dubiner that are better conditionned
//
// author: Pierre.Saramito@imag.fr
//
// date: 2 september 2017
//
// note: initially copied from rheolef/fem/lib/Pk.cc
//
#include "rheolef/reference_element.h"
#include "basis_ordering.icc"
namespace rheolef {
// mx[k][i] = x[i]^k, k=0..degree, i=0..d-1
template<class T>
static
void
precompute_power_monomial (
reference_element hat_K,
size_t d,
const point_basic<T>& x,
size_t degree,
Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& xm)
{
xm.resize (degree+1);
for (size_t mu = 0; mu < d; mu++) {
xm[0][mu] = 1;
}
if (degree == 0) return;
xm[1] = x;
for (size_t i = 2; i <= degree; i++) {
for (size_t mu = 0; mu < d; mu++) {
xm[i][mu] = xm[i-1][mu]*xm[1][mu];
}
}
}
// ----------------------------------------------
// monomial basis evaluation
// result = prod_{i=0}^{d-1} x[i]^m[i]
// use predomputed x[i]^m for efficiency
// ----------------------------------------------
template<class T>
static
T
eval_monomial_internal (
reference_element hat_K,
size_t d,
const Eigen::Matrix<point_basic<T>,Eigen::Dynamic,1>& xm,
const point_basic<size_t>& m) // power_index
{
T result;
if (d == 2) {
result = xm[m[0]][0]
*xm[m[1]][1];
} else if (d == 3) {
result = xm[m[0]][0]
*xm[m[1]][1]
*xm[m[2]][2];
} else if (d == 1) {
result = xm[m[0]][0];
} else { // d == 0
result = 1;
}
return result;
}
}// namespace rheolef
#endif // _RHEOLEF_MONOMIAL_ICC
basis_ordering.icc
rheolef::point_basic< T >
point_basic< T >
Definition: piola_fem.h:135
T
Expr1::float_type T
Definition: field_expr.h:261
mkgeo_ball.d
int d
Definition: mkgeo_ball.sh:154
mkgeo_contraction.mu
mu
Definition: mkgeo_contraction.sh:193
mkgeo_sector.m
m
Definition: mkgeo_sector.sh:118
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37