16 #ifndef dealii_tensor_product_polynomials_bubbles_h 17 #define dealii_tensor_product_polynomials_bubbles_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/tensor.h> 26 #include <deal.II/base/tensor_product_polynomials.h> 27 #include <deal.II/base/utilities.h> 31 DEAL_II_NAMESPACE_OPEN
73 std::vector<double> & values,
160 const std::vector<Pol> &pols)
163 const unsigned int q_degree = this->
polynomials.size() - 1;
164 const unsigned int n_bubbles = ((q_degree <= 1) ? 1 : dim);
166 for (
unsigned int i = 0; i < n_bubbles; ++i)
179 return this->n_tensor_pols + dim;
195 const unsigned int i,
198 const unsigned int q_degree = this->polynomials.size() - 1;
199 const unsigned int max_q_indices = this->n_tensor_pols;
200 const unsigned int n_bubbles = ((q_degree <= 1) ? 1 : dim);
205 if (i < max_q_indices)
207 ->TensorProductPolynomials<dim>::template compute_derivative<order>(i, p);
209 const unsigned int comp = i - this->n_tensor_pols;
219 for (
unsigned int d = 0;
d < dim; ++
d)
221 derivative_1[
d] = 1.;
223 for (
unsigned j = 0; j < dim; ++j)
225 (d == j ? 4 * (1 - 2 * p(j)) : 4 * p(j) * (1 - p(j)));
227 for (
unsigned int i = 0; i < q_degree - 1; ++i)
228 derivative_1[d] *= 2 * p(comp) - 1;
235 for (
unsigned int j = 0; j < dim; ++j)
236 value *= 4 * p(j) * (1 - p(j));
238 double tmp = value * 2 * (q_degree - 1);
239 for (
unsigned int i = 0; i < q_degree - 2; ++i)
240 tmp *= 2 * p(comp) - 1;
241 derivative_1[comp] += tmp;
251 double v[dim + 1][3];
253 for (
unsigned int c = 0; c < dim; ++c)
255 v[c][0] = 4 * p(c) * (1 - p(c));
256 v[c][1] = 4 * (1 - 2 * p(c));
261 for (
unsigned int i = 0; i < q_degree - 1; ++i)
262 tmp *= 2 * p(comp) - 1;
267 double tmp = 2 * (q_degree - 1);
268 for (
unsigned int i = 0; i < q_degree - 2; ++i)
269 tmp *= 2 * p(comp) - 1;
277 double tmp = 4 * (q_degree - 2) * (q_degree - 1);
278 for (
unsigned int i = 0; i < q_degree - 3; ++i)
279 tmp *= 2 * p(comp) - 1;
288 for (
unsigned int d1 = 0; d1 < dim; ++d1)
289 for (
unsigned int d2 = 0; d2 < dim; ++d2)
291 grad_grad_1[d1][d2] = v[dim][0];
292 for (
unsigned int x = 0; x < dim; ++x)
294 unsigned int derivative = 0;
295 if (d1 == x || d2 == x)
302 grad_grad_1[d1][d2] *= v[x][derivative];
310 for (
unsigned int d = 0;
d < dim; ++
d)
312 grad_grad_2[
d][comp] = v[dim][1];
313 grad_grad_3[comp][
d] = v[dim][1];
314 for (
unsigned int x = 0; x < dim; ++x)
316 grad_grad_2[
d][comp] *= v[x][
d == x];
317 grad_grad_3[comp][
d] *= v[x][
d == x];
322 double psi_value = 1.;
323 for (
unsigned int x = 0; x < dim; ++x)
324 psi_value *= v[x][0];
326 for (
unsigned int d1 = 0; d1 < dim; ++d1)
327 for (
unsigned int d2 = 0; d2 < dim; ++d2)
328 derivative_2[d1][d2] =
329 grad_grad_1[d1][d2] + grad_grad_2[d1][d2] + grad_grad_3[d1][d2];
330 derivative_2[comp][comp] += psi_value * v[dim][2];
344 DEAL_II_NAMESPACE_CLOSE
unsigned int n_tensor_pols
static const unsigned int invalid_unsigned_int
std::vector< Polynomials::Polynomial< double > > polynomials
Tensor< 1, dim > compute_grad(const unsigned int i, const Point< dim > &p) const
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
#define Assert(cond, exc)
std::vector< unsigned int > index_map_inverse
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
TensorProductPolynomialsBubbles(const std::vector< Pol > &pols)
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
std::vector< unsigned int > index_map
double compute_value(const unsigned int i, const Point< dim > &p) const
static ::ExceptionBase & ExcNotImplemented()
static ::ExceptionBase & ExcInternalError()