16 #include <deal.II/base/polynomials_bernstein.h> 18 #include <boost/math/special_functions/binomial.hpp> 22 DEAL_II_NAMESPACE_OPEN
26 template <
typename number>
28 get_bernstein_coefficients(
const unsigned int k,
const unsigned int n)
31 ExcMessage(
"Bernstein polynomial needs to be of degree > 0."));
33 std::vector<number> coeff(n + 1, number(0.0));
34 for (
unsigned int i = k; i < n + 1; ++i)
36 coeff[i] = ((i - k) % 2 == 0 ? 1 : -1) *
37 boost::math::binomial_coefficient<number>(n, i) *
38 boost::math::binomial_coefficient<number>(i, k);
44 template <
typename number>
46 const unsigned int degree)
48 get_bernstein_coefficients<number>(index, degree))
52 #include "polynomials_bernstein.inst" 54 DEAL_II_NAMESPACE_CLOSE
#define AssertIndexRange(index, range)
PolynomialsBernstein(const unsigned int index, const unsigned int degree)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)