27 , polynomial_space_Q(create_polynomials_Q())
28 , polynomial_space_bubble(create_polynomials_bubble())
33std::vector<std::vector<Polynomials::Polynomial<double>>>
36 std::vector<std::vector<Polynomials::Polynomial<double>>> pols;
37 std::vector<Polynomials::Polynomial<double>> bubble_shapes;
42 for (
unsigned int d = 0; d < dim; ++d)
43 pols.push_back(bubble_shapes);
55std::vector<std::vector<Polynomials::Polynomial<double>>>
58 std::vector<std::vector<Polynomials::Polynomial<double>>> pols;
59 std::vector<Polynomials::Polynomial<double>> Q_shapes;
62 for (
unsigned int d = 0; d < dim; ++d)
63 pols.push_back(Q_shapes);
79 Assert(values.size() == this->n() || values.size() == 0,
81 Assert(grads.size() == this->n() || grads.size() == 0,
83 Assert(grad_grads.size() == this->n() || grad_grads.size() == 0,
85 Assert(third_derivatives.size() == this->n() || third_derivatives.size() == 0,
87 Assert(fourth_derivatives.size() == this->n() ||
88 fourth_derivatives.size() == 0,
91 std::vector<double> Q_values;
92 std::vector<Tensor<1, dim>> Q_grads;
93 std::vector<Tensor<2, dim>> Q_grad_grads;
94 std::vector<Tensor<3, dim>> Q_third_derivatives;
95 std::vector<Tensor<4, dim>> Q_fourth_derivatives;
96 std::vector<double> bubble_values;
97 std::vector<Tensor<1, dim>> bubble_grads;
98 std::vector<Tensor<2, dim>> bubble_grad_grads;
99 std::vector<Tensor<3, dim>> bubble_third_derivatives;
100 std::vector<Tensor<4, dim>> bubble_fourth_derivatives;
102 constexpr int n_bubbles =
104 constexpr int n_q = 1 << dim;
107 Q_values.resize((values.size() == 0) ? 0 : n_q);
108 Q_grads.resize((grads.size() == 0) ? 0 : n_q);
109 Q_grad_grads.resize((grad_grads.size() == 0) ? 0 : n_q);
110 Q_third_derivatives.resize((third_derivatives.size() == 0) ? 0 : n_q);
111 Q_fourth_derivatives.resize((fourth_derivatives.size() == 0) ? 0 : n_q);
112 bubble_values.resize((values.size() == 0) ? 0 : n_bubbles);
113 bubble_grads.resize((grads.size() == 0) ? 0 : n_bubbles);
114 bubble_grad_grads.resize((grad_grads.size() == 0) ? 0 : n_bubbles);
115 bubble_third_derivatives.resize((third_derivatives.size() == 0) ? 0 :
117 bubble_fourth_derivatives.resize(
118 (fourth_derivatives.size() == 0) ? 0 : n_bubbles);
123 std::vector<Tensor<1, dim>> normals;
128 normals.push_back(normal);
132 std::vector<Tensor<1, dim>> units;
133 for (
unsigned int i = 0; i < dim; ++i)
137 units.push_back(unit);
142 std::vector<int> aniso_indices;
145 aniso_indices.push_back(6);
146 aniso_indices.push_back(7);
147 aniso_indices.push_back(2);
148 aniso_indices.push_back(5);
152 aniso_indices.push_back(24);
153 aniso_indices.push_back(25);
154 aniso_indices.push_back(20);
155 aniso_indices.push_back(23);
156 aniso_indices.push_back(8);
157 aniso_indices.push_back(17);
160 polynomial_space_bubble.evaluate(unit_point,
164 bubble_third_derivatives,
165 bubble_fourth_derivatives);
166 polynomial_space_Q.evaluate(unit_point,
171 Q_fourth_derivatives);
174 for (
unsigned int i = 0; i < dim * GeometryInfo<dim>::vertices_per_cell; ++i)
176 if (values.size() != 0)
178 values[i] = units[i % dim] * Q_values[i / dim];
180 if (grads.size() != 0)
184 if (grad_grads.size() != 0)
186 grad_grads[i] =
outer_product(units[i % dim], Q_grad_grads[i / dim]);
188 if (third_derivatives.size() != 0)
190 third_derivatives[i] =
193 if (fourth_derivatives.size() != 0)
195 fourth_derivatives[i] =
196 outer_product(units[i % dim], Q_fourth_derivatives[i / dim]);
202 i < dim * GeometryInfo<dim>::vertices_per_cell +
210 if (values.size() != 0)
212 values[i] = normals[j] * bubble_values[aniso_indices[j]];
214 if (grads.size() != 0)
216 grads[i] =
outer_product(normals[j], bubble_grads[aniso_indices[j]]);
218 if (grad_grads.size() != 0)
221 outer_product(normals[j], bubble_grad_grads[aniso_indices[j]]);
223 if (third_derivatives.size() != 0)
225 third_derivatives[i] =
227 bubble_third_derivatives[aniso_indices[j]]);
229 if (fourth_derivatives.size() != 0)
231 fourth_derivatives[i] =
233 bubble_fourth_derivatives[aniso_indices[j]]);
244 if (dim == 2 || dim == 3)
255std::unique_ptr<TensorPolynomialsBase<dim>>
258 return std::make_unique<PolynomialsBernardiRaugel<dim>>(*this);
static std::vector< std::vector< Polynomials::Polynomial< double > > > create_polynomials_bubble()
void evaluate(const Point< dim > &unit_point, std::vector< Tensor< 1, dim > > &values, std::vector< Tensor< 2, dim > > &grads, std::vector< Tensor< 3, dim > > &grad_grads, std::vector< Tensor< 4, dim > > &third_derivatives, std::vector< Tensor< 5, dim > > &fourth_derivatives) const override
PolynomialsBernardiRaugel(const unsigned int k)
static std::vector< std::vector< Polynomials::Polynomial< double > > > create_polynomials_Q()
virtual std::unique_ptr< TensorPolynomialsBase< dim > > clone() const override
static unsigned int n_polynomials(const unsigned int k)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
constexpr T pow(const T base, const int iexp)
static std_cxx20::ranges::iota_view< unsigned int, unsigned int > face_indices()
DEAL_II_HOST constexpr SymmetricTensor< 4, dim, Number > outer_product(const SymmetricTensor< 2, dim, Number > &t1, const SymmetricTensor< 2, dim, Number > &t2)