26 , polynomial_space_Q(create_polynomials_Q())
27 , polynomial_space_bubble(create_polynomials_bubble())
32 std::vector<std::vector<Polynomials::Polynomial<double>>>
35 std::vector<std::vector<Polynomials::Polynomial<double>>> pols;
36 std::vector<Polynomials::Polynomial<double>> bubble_shapes;
41 for (
unsigned int d = 0;
d < dim; ++
d)
42 pols.push_back(bubble_shapes);
54 std::vector<std::vector<Polynomials::Polynomial<double>>>
57 std::vector<std::vector<Polynomials::Polynomial<double>>> pols;
58 std::vector<Polynomials::Polynomial<double>> Q_shapes;
61 for (
unsigned int d = 0;
d < dim; ++
d)
62 pols.push_back(Q_shapes);
78 Assert(values.size() == this->n() || values.size() == 0,
80 Assert(grads.size() == this->n() || grads.size() == 0,
82 Assert(grad_grads.size() == this->n() || grad_grads.size() == 0,
84 Assert(third_derivatives.size() == this->n() || third_derivatives.size() == 0,
86 Assert(fourth_derivatives.size() == this->n() ||
87 fourth_derivatives.size() == 0,
90 std::vector<double> Q_values;
91 std::vector<Tensor<1, dim>> Q_grads;
92 std::vector<Tensor<2, dim>> Q_grad_grads;
93 std::vector<Tensor<3, dim>> Q_third_derivatives;
94 std::vector<Tensor<4, dim>> Q_fourth_derivatives;
95 std::vector<double> bubble_values;
96 std::vector<Tensor<1, dim>> bubble_grads;
97 std::vector<Tensor<2, dim>> bubble_grad_grads;
98 std::vector<Tensor<3, dim>> bubble_third_derivatives;
99 std::vector<Tensor<4, dim>> bubble_fourth_derivatives;
101 constexpr
int n_bubbles =
103 constexpr
int n_q = 1 << dim;
106 Q_values.resize((values.size() == 0) ? 0 : n_q);
107 Q_grads.resize((grads.size() == 0) ? 0 : n_q);
108 Q_grad_grads.resize((grad_grads.size() == 0) ? 0 : n_q);
109 Q_third_derivatives.resize((third_derivatives.size() == 0) ? 0 : n_q);
110 Q_fourth_derivatives.resize((fourth_derivatives.size() == 0) ? 0 : n_q);
111 bubble_values.resize((values.size() == 0) ? 0 : n_bubbles);
112 bubble_grads.resize((grads.size() == 0) ? 0 : n_bubbles);
113 bubble_grad_grads.resize((grad_grads.size() == 0) ? 0 : n_bubbles);
114 bubble_third_derivatives.resize((third_derivatives.size() == 0) ? 0 :
116 bubble_fourth_derivatives.resize(
117 (fourth_derivatives.size() == 0) ? 0 : n_bubbles);
122 std::vector<Tensor<1, dim>> normals;
127 normals.push_back(normal);
131 std::vector<Tensor<1, dim>> units;
132 for (
unsigned int i = 0; i < dim; ++i)
136 units.push_back(unit);
141 std::vector<int> aniso_indices;
144 aniso_indices.push_back(6);
145 aniso_indices.push_back(7);
146 aniso_indices.push_back(2);
147 aniso_indices.push_back(5);
151 aniso_indices.push_back(24);
152 aniso_indices.push_back(25);
153 aniso_indices.push_back(20);
154 aniso_indices.push_back(23);
155 aniso_indices.push_back(8);
156 aniso_indices.push_back(17);
159 polynomial_space_bubble.evaluate(unit_point,
163 bubble_third_derivatives,
164 bubble_fourth_derivatives);
165 polynomial_space_Q.evaluate(unit_point,
170 Q_fourth_derivatives);
173 for (
unsigned int i = 0; i < dim * GeometryInfo<dim>::vertices_per_cell; ++i)
175 if (values.size() != 0)
177 values[i] = units[i % dim] * Q_values[i / dim];
179 if (grads.size() != 0)
183 if (grad_grads.size() != 0)
185 grad_grads[i] =
outer_product(units[i % dim], Q_grad_grads[i / dim]);
187 if (third_derivatives.size() != 0)
189 third_derivatives[i] =
192 if (fourth_derivatives.size() != 0)
194 fourth_derivatives[i] =
195 outer_product(units[i % dim], Q_fourth_derivatives[i / dim]);
201 i < dim * GeometryInfo<dim>::vertices_per_cell +
209 if (values.size() != 0)
211 values[i] = normals[j] * bubble_values[aniso_indices[j]];
213 if (grads.size() != 0)
215 grads[i] =
outer_product(normals[j], bubble_grads[aniso_indices[j]]);
217 if (grad_grads.size() != 0)
220 outer_product(normals[j], bubble_grad_grads[aniso_indices[j]]);
222 if (third_derivatives.size() != 0)
224 third_derivatives[i] =
226 bubble_third_derivatives[aniso_indices[j]]);
228 if (fourth_derivatives.size() != 0)
230 fourth_derivatives[i] =
232 bubble_fourth_derivatives[aniso_indices[j]]);
243 if (dim == 2 || dim == 3)
254 std::unique_ptr<TensorPolynomialsBase<dim>>
257 return std_cxx14::make_unique<PolynomialsBernardiRaugel<dim>>(*this);