16#ifndef dealii_polynomial_space_h
17#define dealii_polynomial_space_h
120 template <
class StreamType>
146 std::vector<double> &
values,
237 virtual std::unique_ptr<ScalarPolynomialsBase<dim>>
238 clone()
const override;
249 std::array<unsigned int, dim>
273std::array<unsigned int, 1>
276std::array<unsigned int, 2>
279std::array<unsigned int, 3>
290 , polynomials(pols.
begin(), pols.
end())
291 , index_map(n_polynomials(pols.size()))
292 , index_map_inverse(n_polynomials(pols.size()))
298 for (
unsigned int i = 0; i < this->
n(); ++i)
311 return "PolynomialSpace";
316template <
class StreamType>
320 for (
unsigned int i = 0; i < this->n(); ++i)
324 for (
unsigned int d = 0;
d < dim; ++
d)
336 const std::array<unsigned int, dim> indices =
compute_index(i);
340 std::vector<double> tmp(order + 1);
341 for (
unsigned int d = 0;
d < dim; ++
d)
343 polynomials[indices[
d]].value(p(
d), tmp);
344 for (
unsigned int j = 0; j < order + 1; ++j)
356 for (
unsigned int d = 0;
d < dim; ++
d)
358 derivative_1[
d] = 1.;
359 for (
unsigned int x = 0; x < dim; ++x)
361 unsigned int x_order = 0;
365 derivative_1[
d] *= v[x][x_order];
375 for (
unsigned int d1 = 0; d1 < dim; ++d1)
376 for (
unsigned int d2 = 0; d2 < dim; ++d2)
378 derivative_2[d1][d2] = 1.;
379 for (
unsigned int x = 0; x < dim; ++x)
381 unsigned int x_order = 0;
387 derivative_2[d1][d2] *= v[x][x_order];
397 for (
unsigned int d1 = 0; d1 < dim; ++d1)
398 for (
unsigned int d2 = 0; d2 < dim; ++d2)
399 for (
unsigned int d3 = 0; d3 < dim; ++d3)
401 derivative_3[d1][d2][d3] = 1.;
402 for (
unsigned int x = 0; x < dim; ++x)
404 unsigned int x_order = 0;
412 derivative_3[d1][d2][d3] *= v[x][x_order];
422 for (
unsigned int d1 = 0; d1 < dim; ++d1)
423 for (
unsigned int d2 = 0; d2 < dim; ++d2)
424 for (
unsigned int d3 = 0; d3 < dim; ++d3)
425 for (
unsigned int d4 = 0; d4 < dim; ++d4)
427 derivative_4[d1][d2][d3][d4] = 1.;
428 for (
unsigned int x = 0; x < dim; ++x)
430 unsigned int x_order = 0;
440 derivative_4[d1][d2][d3][d4] *= v[x][x_order];
461 return compute_derivative<1>(i, p);
471 return compute_derivative<2>(i, p);
481 return compute_derivative<3>(i, p);
491 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
Tensor< 1, dim > compute_grad(const unsigned int i, const Point< dim > &p) const override
static const unsigned int dimension
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
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
unsigned int compute_index()
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
VectorType::value_type * end(VectorType &V)
VectorType::value_type * begin(VectorType &V)
typename internal::ndarray::HelperArray< T, Ns... >::type ndarray