31#include <Kokkos_Macros.hpp>
49 if constexpr (dim == 1)
51 else if constexpr (dim == 2)
53 const unsigned int n_dofs = (
degree + 1) * (
degree + 2) / 2;
56 else if constexpr (dim == 3)
58 const unsigned int n_dofs =
65 this->
reinit(support_points);
80 if constexpr (dim == 1)
82 else if constexpr (dim == 2)
84 else if constexpr (dim == 3)
91 const double x = p[0];
92 const double y = dim > 1 ? p[1] : 0.0;
93 const double z = dim > 2 ? p[2] : 0.0;
110 const double s = 1 - z;
111 const double t = 1 - y - z;
117 j, 2 * i + 1, 0, y, s);
120 k, 2 * (i + j) + 2, 0, z,
true);
122 const double phi = Qi * Qj * Pk;
124 if (std::fabs(phi) < 1e-14)
135 const unsigned int i,
140 if constexpr (dim == 1)
145 else if constexpr (dim == 2)
149 for (
unsigned int j = 0, counter = 0; j < this->
degree() + 1; ++j)
150 for (
unsigned int k = 0; k < this->
degree() + 1 - j; ++k, ++counter)
154 else if constexpr (dim == 3)
158 for (
unsigned int j = 0, counter = 0; j < this->
degree() + 1; ++j)
159 for (
unsigned int k = 0; k < this->
degree() + 1 - j; ++k)
160 for (
unsigned int l = 0; l < this->
degree() + 1 - j - k;
176 const unsigned int j,
177 const unsigned int k,
182 if constexpr (dim == 1)
184 else if constexpr (dim == 2)
186 else if constexpr (dim == 3)
195 const double x = p[0];
196 const double y = dim > 1 ? p[1] : 0.0;
197 const double z = dim > 2 ? p[2] : 0.0;
213 const double s = 1 - z;
214 const double ds_dz = -1.0;
216 const double t = 1 - y - z;
217 const double dt_dy = -1.0;
218 const double dt_dz = -1.0;
223 j, 2 * i + 1, 0, y, s);
225 k, 2 * (i + j) + 2, 0, z,
true);
227 const double dQi_dx =
229 1, 0, i, 0, 0, x, t);
230 const double dQi_dt =
232 0, 1, i, 0, 0, x, t);
234 const double dQj_dy =
236 1, 0, j, 2 * i + 1, 0, y, s);
237 const double dQj_ds =
239 0, 1, j, 2 * i + 1, 0, y, s);
242 k, 2 * (i + j) + 2, 0, z,
true);
245 grad[0] = dQi_dx * Qj * Pk;
246 if constexpr (dim > 1)
247 grad[1] = dQi_dt * dt_dy * Qj * Pk + Qi * dQj_dy * Pk;
248 if constexpr (dim > 2)
250 dQi_dt * dt_dz * Qj * Pk + Qi * dQj_ds * ds_dz * Pk + Qi * Qj * dPk_dz;
252 for (
unsigned int d = 0; d < dim; ++d)
253 if (std::fabs(grad[d]) < 1e-14)
264 const unsigned int i,
269 if constexpr (dim == 1)
274 else if constexpr (dim == 2)
278 for (
unsigned int j = 0, counter = 0; j < this->
degree() + 1; ++j)
279 for (
unsigned int k = 0; k < this->
degree() + 1 - j; ++k, ++counter)
283 else if constexpr (dim == 3)
287 for (
unsigned int j = 0, counter = 0; j < this->
degree() + 1; ++j)
288 for (
unsigned int k = 0; k < this->
degree() + 1 - j; ++k)
289 for (
unsigned int l = 0; l < this->
degree() + 1 - j - k;
305 const unsigned int j,
306 const unsigned int k,
311 if constexpr (dim == 1)
313 else if constexpr (dim == 2)
315 else if constexpr (dim == 3)
324 const double x = p[0];
325 const double y = dim > 1 ? p[1] : 0.0;
326 const double z = dim > 2 ? p[2] : 0.0;
342 const double s = 1 - z;
343 const double ds_dz = -1.0;
345 const double t = 1 - y - z;
346 const double dt_dy = -1.0;
347 const double dt_dz = -1.0;
353 j, 2 * i + 1, 0, y, s);
355 k, 2 * (i + j) + 2, 0, z,
true);
358 const double dQi_dx =
360 1, 0, i, 0, 0, x, t);
361 const double dQi_dt =
363 0, 1, i, 0, 0, x, t);
366 const double dQj_dy =
368 1, 0, j, 2 * i + 1, 0, y, s);
369 const double dQj_ds =
371 0, 1, j, 2 * i + 1, 0, y, s);
375 k, 2 * (i + j) + 2, 0, z,
true);
378 const double dQi_dx_dx =
380 2, 0, i, 0, 0, x, t);
381 const double dQi_dx_dt =
383 1, 1, i, 0, 0, x, t);
384 const double dQi_dt_dt =
386 0, 2, i, 0, 0, x, t);
389 const double dQj_dy_dy =
391 2, 0, j, 2 * i + 1, 0, y, s);
392 const double dQj_dy_ds =
394 1, 1, j, 2 * i + 1, 0, y, s);
395 const double dQj_ds_ds =
397 0, 2, j, 2 * i + 1, 0, y, s);
400 const double dPk_dz_dz =
402 2, k, 2 * (i + j) + 2, 0, z,
true);
405 deriv[0][0] = dQi_dx_dx * Qj * Pk;
407 if constexpr (dim > 1)
409 deriv[0][1] = dQi_dx_dt * dt_dy * Qj * Pk + dQi_dx * dQj_dy * Pk;
410 deriv[1][0] = deriv[0][1];
411 deriv[1][1] = dQi_dt_dt * Qj * Pk + dQi_dt * dt_dy * dQj_dy * Pk * 2.0 +
414 if constexpr (dim > 2)
417 dQi_dt_dt * Qj * Pk + dQi_dt * dt_dy * dQj_ds * ds_dz * Pk +
418 dQi_dt * dt_dy * Qj * dPk_dz + dQi_dt * dt_dy * dQj_dy * Pk +
419 Qi * dQj_dy_ds * ds_dz * Pk + Qi * dQj_dy * dPk_dz;
420 deriv[2][1] = deriv[1][2];
422 deriv[2][0] = dQi_dx_dt * dt_dz * Qj * Pk +
423 dQi_dx * dQj_ds * ds_dz * Pk + dQi_dx * Qj * dPk_dz;
424 deriv[0][2] = deriv[2][0];
427 dQi_dt_dt * Qj * Pk + 2.0 * dQi_dt * dt_dz * dQj_ds * ds_dz * Pk +
428 2.0 * dQi_dt * dt_dz * Qj * dPk_dz + Qi * dQj_ds_ds * Pk +
429 2.0 * Qi * dQj_ds * ds_dz * dPk_dz + Qi * Qj * dPk_dz_dz;
433 for (
unsigned int d = 0; d < dim; ++d)
434 for (
unsigned int e = 0; e < dim; ++e)
435 if (std::fabs(deriv[d][e]) < 1e-14)
446 const unsigned int i,
451 if constexpr (dim == 1)
456 else if constexpr (dim == 2)
460 for (
unsigned int j = 0, counter = 0; j < this->
degree() + 1; ++j)
461 for (
unsigned int k = 0; k < this->
degree() + 1 - j; ++k, ++counter)
468 else if constexpr (dim == 3)
472 for (
unsigned int j = 0, counter = 0; j < this->
degree() + 1; ++j)
473 for (
unsigned int k = 0; k < this->
degree() + 1 - j; ++k)
474 for (
unsigned int l = 0; l < this->
degree() + 1 - j - k;
493 std::vector<double> &values,
499 (void)third_derivatives;
500 (void)fourth_derivatives;
502 if (values.size() == this->n())
503 for (
unsigned int i = 0; i < this->
n(); ++i)
506 if (grads.size() == this->n())
507 for (
unsigned int i = 0; i < this->n(); ++i)
510 if (grad_grads.size() == this->n())
511 for (
unsigned int i = 0; i < this->n(); ++i)
521 return "ScalarLagrangePolynomialSimplex";
527std::unique_ptr<ScalarPolynomialsBase<dim>>
530 return std::make_unique<ScalarLagrangePolynomialSimplex<dim>>(*this);
double evaluate_orthogonal_basis_function_by_degree(const unsigned int i, const unsigned int j, const unsigned int k, const Point< dim > &p) const override
ScalarLagrangePolynomialSimplex(const unsigned int degree, const std::vector< Point< dim > > &support_points)
Tensor< 1, dim > evaluate_orthogonal_basis_derivative_by_degree(const unsigned int i, const unsigned int j, const unsigned int k, const Point< dim > &p) const override
virtual std::unique_ptr< ScalarPolynomialsBase< dim > > clone() const override
std::string name() const override
Tensor< 1, dim > evaluate_orthogonal_basis_derivative(const unsigned int i, const Point< dim > &p) 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
virtual Tensor< 2, dim > evaluate_orthogonal_basis_2nd_derivative_by_degree(const unsigned int i, const unsigned int j, const unsigned int k, const Point< dim > &p) const override
virtual Tensor< 2, dim > evaluate_orthogonal_basis_2nd_derivative(const unsigned int i, const Point< dim > &p) const override
double evaluate_orthogonal_basis_function(const unsigned int i, const Point< dim > &p) const override
virtual unsigned int degree() const
void reinit(const std::vector< Point< dim > > &support_points)
Tensor< 2, dim > compute_grad_grad(const unsigned int i, const Point< dim > &p) const override
ScalarPolynomialsVandermondeBase(const unsigned int degree, const unsigned int n_dofs)
Tensor< 1, dim > compute_grad(const unsigned int i, const Point< dim > &p) const override
double compute_value(const unsigned int i, const Point< dim > &p) const override
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_ASSERT_UNREACHABLE()
#define DEAL_II_NOT_IMPLEMENTED()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
Number jacobi_polynomial_kth_derivative(const unsigned int derivative_order, const unsigned int degree, const int alpha, const int beta, const Number x, const bool rescale_to_dealii_unit_interval)
Number jacobi_polynomial_homogenized_derivative(const unsigned int order_x, const unsigned int order_s, const unsigned int degree, const int alpha, const int beta, const Number x, const Number s)
Number jacobi_polynomial_derivative(const unsigned int degree, const int alpha, const int beta, const Number x, const bool rescale_to_dealii_unit_interval)
Number jacobi_polynomial_homogenized_value(const unsigned int degree, const int alpha, const int beta, const Number x, const Number s)
Number jacobi_polynomial_value(const unsigned int degree, const int alpha, const int beta, const Number x, const bool rescale_to_dealii_unit_interval=true)