15#ifndef dealii_polynomial_space_h
16#define dealii_polynomial_space_h
119 template <
typename StreamType>
145 std::vector<double> &values,
236 virtual std::unique_ptr<ScalarPolynomialsBase<dim>>
237 clone()
const override;
248 std::array<unsigned int, dim>
272std::array<unsigned int, 1>
275std::array<unsigned int, 2>
278std::array<unsigned int, 3>
289 , polynomials(pols.begin(), pols.end())
290 , index_map(n_polynomials(pols.
size()))
291 , index_map_inverse(n_polynomials(pols.
size()))
297 for (
unsigned int i = 0; i < this->
n(); ++i)
310 return "PolynomialSpace";
315template <
typename StreamType>
319 for (
unsigned int i = 0; i < this->n(); ++i)
321 const std::array<unsigned int, dim> ix = compute_index(i);
323 for (
unsigned int d = 0; d < dim; ++d)
335 const std::array<unsigned int, dim> indices = compute_index(i);
339 std::vector<double> tmp(order + 1);
340 for (
unsigned int d = 0; d < dim; ++d)
342 polynomials[indices[d]].value(p[d], tmp);
343 for (
unsigned int j = 0; j < order + 1; ++j)
348 if constexpr (order == 1)
351 for (
unsigned int d = 0; d < dim; ++d)
354 for (
unsigned int x = 0; x < dim; ++x)
356 unsigned int x_order = 0;
360 derivative[d] *= v[x][x_order];
366 else if constexpr (order == 2)
369 for (
unsigned int d1 = 0; d1 < dim; ++d1)
370 for (
unsigned int d2 = 0; d2 < dim; ++d2)
372 derivative[d1][d2] = 1.;
373 for (
unsigned int x = 0; x < dim; ++x)
375 unsigned int x_order = 0;
381 derivative[d1][d2] *= v[x][x_order];
387 else if constexpr (order == 3)
390 for (
unsigned int d1 = 0; d1 < dim; ++d1)
391 for (
unsigned int d2 = 0; d2 < dim; ++d2)
392 for (
unsigned int d3 = 0; d3 < dim; ++d3)
394 derivative[d1][d2][d3] = 1.;
395 for (
unsigned int x = 0; x < dim; ++x)
397 unsigned int x_order = 0;
405 derivative[d1][d2][d3] *= v[x][x_order];
411 else if constexpr (order == 4)
414 for (
unsigned int d1 = 0; d1 < dim; ++d1)
415 for (
unsigned int d2 = 0; d2 < dim; ++d2)
416 for (
unsigned int d3 = 0; d3 < dim; ++d3)
417 for (
unsigned int d4 = 0; d4 < dim; ++d4)
419 derivative[d1][d2][d3][d4] = 1.;
420 for (
unsigned int x = 0; x < dim; ++x)
422 unsigned int x_order = 0;
432 derivative[d1][d2][d3][d4] *= v[x][x_order];
452 return compute_derivative<1>(i, p);
462 return compute_derivative<2>(i, p);
472 return compute_derivative<3>(i, p);
482 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