13#ifndef dealii_polynomial_space_h
14#define dealii_polynomial_space_h
117 template <
typename StreamType>
143 std::vector<double> &values,
234 virtual std::unique_ptr<ScalarPolynomialsBase<dim>>
235 clone()
const override;
246 std::array<unsigned int, dim>
270std::array<unsigned int, 1>
273std::array<unsigned int, 2>
276std::array<unsigned int, 3>
287 , polynomials(pols.
begin(), pols.
end())
288 , index_map(n_polynomials(pols.
size()))
289 , index_map_inverse(n_polynomials(pols.
size()))
295 for (
unsigned int i = 0; i < this->
n(); ++i)
308 return "PolynomialSpace";
313template <
typename StreamType>
317 for (
unsigned int i = 0; i < this->n(); ++i)
319 const std::array<unsigned int, dim> ix = compute_index(i);
321 for (
unsigned int d = 0; d < dim; ++d)
333 const std::array<unsigned int, dim> indices = compute_index(i);
337 std::vector<double> tmp(order + 1);
338 for (
unsigned int d = 0; d < dim; ++d)
340 polynomials[indices[d]].value(p[d], tmp);
341 for (
unsigned int j = 0; j < order + 1; ++j)
346 if constexpr (order == 1)
349 for (
unsigned int d = 0; d < dim; ++d)
352 for (
unsigned int x = 0; x < dim; ++x)
354 unsigned int x_order = 0;
358 derivative[d] *= v[x][x_order];
364 else if constexpr (order == 2)
367 for (
unsigned int d1 = 0; d1 < dim; ++d1)
368 for (
unsigned int d2 = 0; d2 < dim; ++d2)
370 derivative[d1][d2] = 1.;
371 for (
unsigned int x = 0; x < dim; ++x)
373 unsigned int x_order = 0;
379 derivative[d1][d2] *= v[x][x_order];
385 else if constexpr (order == 3)
388 for (
unsigned int d1 = 0; d1 < dim; ++d1)
389 for (
unsigned int d2 = 0; d2 < dim; ++d2)
390 for (
unsigned int d3 = 0; d3 < dim; ++d3)
392 derivative[d1][d2][d3] = 1.;
393 for (
unsigned int x = 0; x < dim; ++x)
395 unsigned int x_order = 0;
403 derivative[d1][d2][d3] *= v[x][x_order];
409 else if constexpr (order == 4)
412 for (
unsigned int d1 = 0; d1 < dim; ++d1)
413 for (
unsigned int d2 = 0; d2 < dim; ++d2)
414 for (
unsigned int d3 = 0; d3 < dim; ++d3)
415 for (
unsigned int d4 = 0; d4 < dim; ++d4)
417 derivative[d1][d2][d3][d4] = 1.;
418 for (
unsigned int x = 0; x < dim; ++x)
420 unsigned int x_order = 0;
430 derivative[d1][d2][d3][d4] *= v[x][x_order];
450 return compute_derivative<1>(i, p);
460 return compute_derivative<2>(i, p);
470 return compute_derivative<3>(i, p);
480 return compute_derivative<4>(i, p);
const std::vector< Polynomials::Polynomial< double > > polynomials
void output_indices(StreamType &out) const
Tensor< order, dim > compute_derivative(const unsigned int i, const Point< dim > &p) const
PolynomialSpace(const std::vector< Pol > &pols)
double compute_value(const unsigned int i, const Point< dim > &p) const override
static constexpr unsigned int dimension
Tensor< 1, dim > compute_grad(const unsigned int i, const Point< dim > &p) const override
void set_numbering(const std::vector< unsigned int > &renumber)
static unsigned int n_polynomials(const unsigned int n)
std::array< unsigned int, dim > compute_index(const unsigned int n) const
std::string name() const override
virtual Tensor< 2, dim > compute_2nd_derivative(const unsigned int i, const Point< dim > &p) const override
virtual Tensor< 1, dim > compute_1st_derivative(const unsigned int i, const Point< dim > &p) const override
Tensor< 2, dim > compute_grad_grad(const unsigned int i, const Point< dim > &p) const override
virtual Tensor< 3, dim > compute_3rd_derivative(const unsigned int i, const Point< dim > &p) const override
std::vector< unsigned int > index_map
virtual std::unique_ptr< ScalarPolynomialsBase< dim > > clone() const override
void evaluate(const Point< dim > &unit_point, std::vector< double > &values, std::vector< Tensor< 1, dim > > &grads, std::vector< Tensor< 2, dim > > &grad_grads, std::vector< Tensor< 3, dim > > &third_derivatives, std::vector< Tensor< 4, dim > > &fourth_derivatives) const override
std::vector< unsigned int > index_map_inverse
virtual Tensor< 4, dim > compute_4th_derivative(const unsigned int i, const Point< dim > &p) const override
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NOT_IMPLEMENTED()
typename internal::ndarray::HelperArray< T, Ns... >::type ndarray