16#ifndef dealii_tensor_product_polynomials_bubbles_h
17#define dealii_tensor_product_polynomials_bubbles_h
87 const std::vector<unsigned int> &
93 const std::vector<unsigned int> &
110 std::vector<double> &
values,
224 virtual std::unique_ptr<ScalarPolynomialsBase<dim>>
225 clone()
const override;
254 const std::vector<Pol> &pols)
258 , index_map(tensor_polys.n() +
259 ((tensor_polys.polynomials.size() <= 2) ? 1 : dim))
260 , index_map_inverse(tensor_polys.n() +
261 ((tensor_polys.polynomials.size() <= 2) ? 1 : dim))
263 const unsigned int q_degree =
tensor_polys.polynomials.size() - 1;
264 const unsigned int n_bubbles = ((q_degree <= 1) ? 1 : dim);
266 for (
unsigned int i = 0; i <
tensor_polys.n() + n_bubbles; ++i)
278 return tensor_polys.n() + dim;
291inline const std::vector<unsigned int> &
299inline const std::vector<unsigned int> &
302 return index_map_inverse;
310 return "TensorProductPolynomialsBubbles";
318 const unsigned int i,
321 const unsigned int q_degree = tensor_polys.polynomials.size() - 1;
322 const unsigned int max_q_indices = tensor_polys.n();
323 Assert(i < max_q_indices + ((q_degree <= 1) ? 1 : dim),
327 if (i < max_q_indices)
328 return tensor_polys.template compute_derivative<order>(i, p);
330 const unsigned int comp = i - tensor_polys.n();
340 for (
unsigned int d = 0;
d < dim; ++
d)
342 derivative_1[
d] = 1.;
344 for (
unsigned j = 0; j < dim; ++j)
346 (
d == j ? 4 * (1 - 2 * p(j)) : 4 * p(j) * (1 - p(j)));
348 for (
unsigned int i = 0; i < q_degree - 1; ++i)
349 derivative_1[
d] *= 2 * p(comp) - 1;
356 for (
unsigned int j = 0; j < dim; ++j)
357 value *= 4 * p(j) * (1 - p(j));
359 double tmp =
value * 2 * (q_degree - 1);
360 for (
unsigned int i = 0; i < q_degree - 2; ++i)
361 tmp *= 2 * p(comp) - 1;
362 derivative_1[comp] += tmp;
372 double v[dim + 1][3];
374 for (
unsigned int c = 0; c < dim; ++c)
376 v[c][0] = 4 * p(c) * (1 - p(c));
377 v[c][1] = 4 * (1 - 2 * p(c));
382 for (
unsigned int i = 0; i < q_degree - 1; ++i)
383 tmp *= 2 * p(comp) - 1;
388 double tmp = 2 * (q_degree - 1);
389 for (
unsigned int i = 0; i < q_degree - 2; ++i)
390 tmp *= 2 * p(comp) - 1;
398 double tmp = 4 * (q_degree - 2) * (q_degree - 1);
399 for (
unsigned int i = 0; i < q_degree - 3; ++i)
400 tmp *= 2 * p(comp) - 1;
409 for (
unsigned int d1 = 0; d1 < dim; ++d1)
410 for (
unsigned int d2 = 0; d2 < dim; ++d2)
412 grad_grad_1[d1][d2] = v[dim][0];
413 for (
unsigned int x = 0; x < dim; ++x)
415 unsigned int derivative = 0;
416 if (d1 == x || d2 == x)
423 grad_grad_1[d1][d2] *= v[x][derivative];
431 for (
unsigned int d = 0;
d < dim; ++
d)
433 grad_grad_2[
d][comp] = v[dim][1];
434 grad_grad_3[comp][
d] = v[dim][1];
435 for (
unsigned int x = 0; x < dim; ++x)
437 grad_grad_2[
d][comp] *= v[x][
d == x];
438 grad_grad_3[comp][
d] *= v[x][
d == x];
443 double psi_value = 1.;
444 for (
unsigned int x = 0; x < dim; ++x)
445 psi_value *= v[x][0];
447 for (
unsigned int d1 = 0; d1 < dim; ++d1)
448 for (
unsigned int d2 = 0; d2 < dim; ++d2)
449 derivative_2[d1][d2] =
450 grad_grad_1[d1][d2] + grad_grad_2[d1][d2] + grad_grad_3[d1][d2];
451 derivative_2[comp][comp] += psi_value * v[dim][2];
468 const unsigned int i,
471 return compute_derivative<1>(i, p);
479 const unsigned int i,
482 return compute_derivative<2>(i, p);
490 const unsigned int i,
493 return compute_derivative<3>(i, p);
501 const unsigned int i,
504 return compute_derivative<4>(i, p);
const std::vector< unsigned int > & get_numbering_inverse() const
virtual Tensor< 2, dim > compute_2nd_derivative(const unsigned int i, const Point< dim > &p) const override
std::string name() 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
Tensor< 1, dim > compute_grad(const unsigned int i, const Point< dim > &p) const override
Tensor< order, dim > compute_derivative(const unsigned int i, const Point< dim > &p) const
Tensor< 2, dim > compute_grad_grad(const unsigned int i, const Point< dim > &p) const override
std::vector< unsigned int > index_map_inverse
TensorProductPolynomialsBubbles(const std::vector< Pol > &pols)
std::vector< unsigned int > index_map
void set_numbering(const std::vector< unsigned int > &renumber)
static const unsigned int dimension
virtual Tensor< 1, dim > compute_1st_derivative(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
TensorProductPolynomials< dim > tensor_polys
const std::vector< unsigned int > & get_numbering() const
virtual Tensor< 4, dim > compute_4th_derivative(const unsigned int i, const Point< dim > &p) const override
void output_indices(std::ostream &out) const
double compute_value(const unsigned int i, const Point< dim > &p) const override
virtual std::unique_ptr< ScalarPolynomialsBase< dim > > clone() const override
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
static const unsigned int invalid_unsigned_int