16 #ifndef dealii_polynomial_space_h 17 #define dealii_polynomial_space_h 20 #include <deal.II/base/config.h> 22 #include <deal.II/base/exceptions.h> 23 #include <deal.II/base/point.h> 24 #include <deal.II/base/polynomial.h> 25 #include <deal.II/base/smartpointer.h> 26 #include <deal.II/base/tensor.h> 30 DEAL_II_NAMESPACE_OPEN
120 template <
class StreamType>
146 std::vector<double> & values,
228 std::array<unsigned int, dim>
257 std::array<unsigned int, 1>
260 std::array<unsigned int, 2>
263 std::array<unsigned int, 3>
273 : polynomials(pols.begin(), pols.end())
274 , n_pols(compute_n_pols(polynomials.size()))
276 , index_map_inverse(n_pols)
282 for (
unsigned int i = 0; i <
n_pols; ++i)
303 return polynomials.size();
308 template <
class StreamType>
312 for (
unsigned int i = 0; i < n_pols; ++i)
314 const std::array<unsigned int, dim> ix = compute_index(i);
316 for (
unsigned int d = 0; d < dim; ++d)
328 const std::array<unsigned int, dim> indices = compute_index(i);
330 double v[dim][order + 1];
332 std::vector<double> tmp(order + 1);
333 for (
unsigned int d = 0; d < dim; ++d)
335 polynomials[indices[d]].value(p(d), tmp);
336 for (
unsigned int j = 0; j < order + 1; ++j)
348 for (
unsigned int d = 0; d < dim; ++d)
350 derivative_1[d] = 1.;
351 for (
unsigned int x = 0; x < dim; ++x)
353 unsigned int x_order = 0;
357 derivative_1[d] *= v[x][x_order];
367 for (
unsigned int d1 = 0; d1 < dim; ++d1)
368 for (
unsigned int d2 = 0; d2 < dim; ++d2)
370 derivative_2[d1][d2] = 1.;
371 for (
unsigned int x = 0; x < dim; ++x)
373 unsigned int x_order = 0;
379 derivative_2[d1][d2] *= v[x][x_order];
389 for (
unsigned int d1 = 0; d1 < dim; ++d1)
390 for (
unsigned int d2 = 0; d2 < dim; ++d2)
391 for (
unsigned int d3 = 0; d3 < dim; ++d3)
393 derivative_3[d1][d2][d3] = 1.;
394 for (
unsigned int x = 0; x < dim; ++x)
396 unsigned int x_order = 0;
404 derivative_3[d1][d2][d3] *= v[x][x_order];
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_4[d1][d2][d3][d4] = 1.;
420 for (
unsigned int x = 0; x < dim; ++x)
422 unsigned int x_order = 0;
432 derivative_4[d1][d2][d3][d4] *= v[x][x_order];
447 DEAL_II_NAMESPACE_CLOSE
void set_numbering(const std::vector< unsigned int > &renumber)
static const unsigned int dimension
std::vector< unsigned int > index_map_inverse
#define Assert(cond, exc)
std::array< unsigned int, dim > compute_index(const unsigned int n) const
const unsigned int n_pols
Tensor< order, dim > compute_derivative(const unsigned int i, const Point< dim > &p) const
void output_indices(StreamType &out) const
Tensor< 2, dim > compute_grad_grad(const unsigned int i, const Point< dim > &p) const
double compute_value(const unsigned int i, const Point< dim > &p) const
static unsigned int compute_n_pols(const unsigned int n)
Tensor< 1, dim > compute_grad(const unsigned int i, const Point< dim > &p) const
unsigned int degree() const
PolynomialSpace(const std::vector< Pol > &pols)
static ::ExceptionBase & ExcNotImplemented()
std::vector< unsigned int > index_map
const std::vector< Polynomials::Polynomial< double > > polynomials
void compute(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