15#ifndef dealii_tensor_product_polynomials_bubbles_h
16#define dealii_tensor_product_polynomials_bubbles_h
86 const std::vector<unsigned int> &
92 const std::vector<unsigned int> &
109 std::vector<double> &values,
223 virtual std::unique_ptr<ScalarPolynomialsBase<dim>>
224 clone()
const override;
253 const std::vector<Pol> &pols)
255 Utilities::fixed_power<dim>(pols.size()) + dim)
257 , index_map(tensor_polys.n() +
258 ((tensor_polys.polynomials.size() <= 2) ? 1 : dim))
259 , index_map_inverse(tensor_polys.n() +
260 ((tensor_polys.polynomials.size() <= 2) ? 1 : dim))
262 const unsigned int q_degree =
tensor_polys.polynomials.size() - 1;
263 const unsigned int n_bubbles = ((q_degree <= 1) ? 1 : dim);
265 for (
unsigned int i = 0; i <
tensor_polys.n() + n_bubbles; ++i)
277 return tensor_polys.n() + dim;
290inline const std::vector<unsigned int> &
298inline const std::vector<unsigned int> &
301 return index_map_inverse;
309 return "TensorProductPolynomialsBubbles";
317 const unsigned int i,
320 const unsigned int q_degree = tensor_polys.polynomials.size() - 1;
321 const unsigned int max_q_indices = tensor_polys.n();
322 Assert(i < max_q_indices + ((q_degree <= 1) ? 1 : dim),
326 if (i < max_q_indices)
327 return tensor_polys.template compute_derivative<order>(i, p);
329 const unsigned int comp = i - tensor_polys.n();
339 for (
unsigned int d = 0;
d < dim; ++
d)
341 derivative_1[
d] = 1.;
343 for (
unsigned j = 0; j < dim; ++j)
345 (d == j ? 4 * (1 - 2 * p[j]) : 4 * p[j] * (1 - p[j]));
347 for (
unsigned int i = 0; i < q_degree - 1; ++i)
348 derivative_1[d] *= 2 * p[comp] - 1;
355 for (
unsigned int j = 0; j < dim; ++j)
356 value *= 4 * p[j] * (1 - p[j]);
358 double tmp =
value * 2 * (q_degree - 1);
359 for (
unsigned int i = 0; i < q_degree - 2; ++i)
360 tmp *= 2 * p[comp] - 1;
361 derivative_1[comp] += tmp;
371 double v[dim + 1][3];
373 for (
unsigned int c = 0; c < dim; ++c)
375 v[c][0] = 4 * p[c] * (1 - p[c]);
376 v[c][1] = 4 * (1 - 2 * p[c]);
381 for (
unsigned int i = 0; i < q_degree - 1; ++i)
382 tmp *= 2 * p[comp] - 1;
387 double tmp = 2 * (q_degree - 1);
388 for (
unsigned int i = 0; i < q_degree - 2; ++i)
389 tmp *= 2 * p[comp] - 1;
397 double tmp = 4 * (q_degree - 2) * (q_degree - 1);
398 for (
unsigned int i = 0; i < q_degree - 3; ++i)
399 tmp *= 2 * p[comp] - 1;
408 for (
unsigned int d1 = 0; d1 < dim; ++d1)
409 for (
unsigned int d2 = 0; d2 < dim; ++d2)
411 grad_grad_1[d1][d2] = v[dim][0];
412 for (
unsigned int x = 0; x < dim; ++x)
414 unsigned int derivative = 0;
415 if (d1 == x || d2 == x)
422 grad_grad_1[d1][d2] *= v[x][derivative];
430 for (
unsigned int d = 0;
d < dim; ++
d)
432 grad_grad_2[
d][comp] = v[dim][1];
433 grad_grad_3[comp][
d] = v[dim][1];
434 for (
unsigned int x = 0; x < dim; ++x)
436 grad_grad_2[
d][comp] *= v[x][
d == x];
437 grad_grad_3[comp][
d] *= v[x][
d == x];
442 double psi_value = 1.;
443 for (
unsigned int x = 0; x < dim; ++x)
444 psi_value *= v[x][0];
446 for (
unsigned int d1 = 0; d1 < dim; ++d1)
447 for (
unsigned int d2 = 0; d2 < dim; ++d2)
448 derivative_2[d1][d2] =
449 grad_grad_1[d1][d2] + grad_grad_2[d1][d2] + grad_grad_3[d1][d2];
450 derivative_2[comp][comp] += psi_value * v[dim][2];
467 const unsigned int i,
470 return compute_derivative<1>(i, p);
478 const unsigned int i,
481 return compute_derivative<2>(i, p);
489 const unsigned int i,
492 return compute_derivative<3>(i, p);
500 const unsigned int i,
503 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
static constexpr unsigned int dimension
void set_numbering(const std::vector< unsigned int > &renumber)
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
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
#define DEAL_II_NOT_IMPLEMENTED()
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