39 std::size_t max_degree = 0;
40 for (
const auto &poly : polys)
44 const auto degree_0 = degrees[0];
45 std::size_t degree_d = 0;
46 for (
unsigned int d = 1; d < dim + 1; ++d)
47 degree_d =
std::max(degree_d, degrees[d]);
49 max_degree =
std::max(max_degree, degree_d + degree_0);
61 std::vector<PolyType> polys;
73 for (
const unsigned int v : reference_cell.vertex_indices())
80 for (
const unsigned int v : reference_cell.vertex_indices())
84 for (
const unsigned int l : reference_cell.line_indices())
86 const auto v0 = reference_cell.line_to_cell_vertices(l, 0);
87 const auto v1 = reference_cell.line_to_cell_vertices(l, 1);
97 for (
const unsigned int v : reference_cell.vertex_indices())
102 for (
unsigned int l : reference_cell.line_indices())
104 const auto v0 = reference_cell.line_to_cell_vertices(l, 0);
105 const auto v1 = reference_cell.line_to_cell_vertices(l, 1);
156 const std::vector<PolyType> &polynomials)
166 for (std::size_t i = 0; i < polynomials.size(); ++i)
169 for (
unsigned int d = 0; d < dim; ++d)
170 poly_grads[i][d] = polynomials[i].derivative(d);
173 for (
unsigned int d0 = 0; d0 < dim; ++d0)
174 for (
unsigned int d1 = 0; d1 < dim; ++d1)
178 for (
unsigned int d0 = 0; d0 < dim; ++d0)
179 for (
unsigned int d1 = 0; d1 < dim; ++d1)
180 for (
unsigned int d2 = 0; d2 < dim; ++d2)
185 for (
unsigned int d0 = 0; d0 < dim; ++d0)
186 for (
unsigned int d1 = 0; d1 < dim; ++d1)
187 for (
unsigned int d2 = 0; d2 < dim; ++d2)
188 for (
unsigned int d3 = 0; d3 < dim; ++d3)
200 std::vector<double> &values,
206 Assert(values.size() == this->n() || values.empty(),
208 Assert(grads.size() == this->n() || grads.empty(),
210 Assert(grad_grads.size() == this->n() || grad_grads.empty(),
212 Assert(third_derivatives.size() == this->n() || third_derivatives.empty(),
214 Assert(fourth_derivatives.size() == this->n() || fourth_derivatives.empty(),
217 for (std::size_t i = 0; i < polys.size(); ++i)
219 if (values.size() == this->n())
220 values[i] = polys[i].value(unit_point);
223 if (grads.size() == this->n())
224 for (
unsigned int d = 0; d < dim; ++d)
225 grads[i][d] = poly_grads[i][d].value(unit_point);
228 if (grad_grads.size() == this->n())
229 for (
unsigned int d0 = 0; d0 < dim; ++d0)
230 for (
unsigned int d1 = 0; d1 < dim; ++d1)
231 grad_grads[i][d0][d1] = poly_hessians[i][d0][d1].value(unit_point);
234 if (third_derivatives.size() == this->n())
235 for (
unsigned int d0 = 0; d0 < dim; ++d0)
236 for (
unsigned int d1 = 0; d1 < dim; ++d1)
237 for (
unsigned int d2 = 0; d2 < dim; ++d2)
238 third_derivatives[i][d0][d1][d2] =
239 poly_third_derivatives[i][d0][d1][d2].value(unit_point);
242 if (fourth_derivatives.size() == this->n())
243 for (
unsigned int d0 = 0; d0 < dim; ++d0)
244 for (
unsigned int d1 = 0; d1 < dim; ++d1)
245 for (
unsigned int d2 = 0; d2 < dim; ++d2)
246 for (
unsigned int d3 = 0; d3 < dim; ++d3)
247 fourth_derivatives[i][d0][d1][d2][d3] =
248 poly_fourth_derivatives[i][d0][d1][d2][d3].value(unit_point);
260 return polys[i].value(p);
271 for (
unsigned int d = 0; d < dim; ++d)
272 result[d] = poly_grads[i][d].value(p);
284 for (
unsigned int d0 = 0; d0 < dim; ++d0)
285 for (
unsigned int d1 = 0; d1 < dim; ++d1)
286 result[d0][d1] = poly_hessians[i][d0][d1].value(p);
299 for (
unsigned int d0 = 0; d0 < dim; ++d0)
300 for (
unsigned int d1 = 0; d1 < dim; ++d1)
301 for (
unsigned int d2 = 0; d2 < dim; ++d2)
302 result[d0][d1][d2] = poly_third_derivatives[i][d0][d1][d2].value(p);
315 for (
unsigned int d0 = 0; d0 < dim; ++d0)
316 for (
unsigned int d1 = 0; d1 < dim; ++d1)
317 for (
unsigned int d2 = 0; d2 < dim; ++d2)
318 for (
unsigned int d3 = 0; d3 < dim; ++d3)
319 result[d0][d1][d2][d3] =
320 poly_fourth_derivatives[i][d0][d1][d2][d3].value(p);
332 return compute_1st_derivative(i, p);
342 return compute_2nd_derivative(i, p);
348std::unique_ptr<ScalarPolynomialsBase<dim>>
351 return std::make_unique<BarycentricPolynomials<dim>>(*this);
360 return "BarycentricPolynomials<" + std::to_string(dim) +
">";
369 std::size_t poly_memory = 0;
370 for (
const auto &poly : polys)
371 poly_memory += poly.memory_consumption();
static BarycentricPolynomial< dim, Number > monomial(const unsigned int d)
Tensor< 1, dim > compute_grad(const unsigned int i, const Point< dim > &p) const override
BarycentricPolynomials(const std::vector< BarycentricPolynomial< dim > > &polynomials)
virtual std::size_t memory_consumption() const override
Tensor< 2, dim > compute_grad_grad(const unsigned int i, const Point< dim > &p) const override
std::vector< GradType > poly_grads
std::string name() const override
Tensor< 3, dim > compute_3rd_derivative(const unsigned int i, const Point< dim > &p) const override
Tensor< 1, dim > compute_1st_derivative(const unsigned int i, const Point< dim > &p) const override
Tensor< 2, dim > compute_2nd_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
double compute_value(const unsigned int i, const Point< dim > &p) const override
std::vector< ThirdDerivativesType > poly_third_derivatives
virtual std::unique_ptr< ScalarPolynomialsBase< dim > > clone() const override
Tensor< 4, dim > compute_4th_derivative(const unsigned int i, const Point< dim > &p) const override
std::vector< HessianType > poly_hessians
static BarycentricPolynomials< dim > get_fe_p_basis(const unsigned int degree)
std::vector< FourthDerivativesType > poly_fourth_derivatives
virtual std::size_t memory_consumption() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch2(std::size_t arg1, std::size_t arg2, std::size_t arg3)
#define AssertIndexRange(index, range)
#define DEAL_II_NOT_IMPLEMENTED()
std::enable_if_t< std::is_fundamental_v< T >, std::size_t > memory_consumption(const T &t)
constexpr const ReferenceCell & get_simplex()
unsigned int get_degree(const std::vector< typename BarycentricPolynomials< dim >::PolyType > &polys)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)