36 std::vector<std::vector<Polynomials::Polynomial<double>>>
37 create_rt_polynomials(
const unsigned int dim,
38 const unsigned int normal_degree,
39 const unsigned int tangential_degree)
41 std::vector<std::vector<Polynomials::Polynomial<double>>> pols(dim);
42 if (normal_degree > 0)
48 if (tangential_degree > 0)
49 for (
unsigned int d = 1;
d < dim; ++
d)
53 for (
unsigned int d = 1;
d < dim; ++
d)
65 const unsigned int normal_degree,
66 const unsigned int tangential_degree)
68 n_polynomials(normal_degree, tangential_degree))
69 , normal_degree(normal_degree)
70 , tangential_degree(tangential_degree)
72 create_rt_polynomials(dim, normal_degree, tangential_degree))
88 for (
unsigned int i = 0; i <
n_pols; ++i)
142 Assert(values.size() == this->n() || values.size() == 0,
144 Assert(grads.size() == this->n() || grads.size() == 0,
146 Assert(grad_grads.size() == this->n() || grad_grads.size() == 0,
148 Assert(third_derivatives.size() == this->n() || third_derivatives.size() == 0,
150 Assert(fourth_derivatives.size() == this->n() ||
151 fourth_derivatives.size() == 0,
154 std::vector<double> p_values;
155 std::vector<Tensor<1, dim>> p_grads;
156 std::vector<Tensor<2, dim>> p_grad_grads;
157 std::vector<Tensor<3, dim>> p_third_derivatives;
158 std::vector<Tensor<4, dim>> p_fourth_derivatives;
160 const unsigned int n_sub = polynomial_space.n();
161 p_values.resize((values.size() == 0) ? 0 : n_sub);
162 p_grads.resize((grads.size() == 0) ? 0 : n_sub);
163 p_grad_grads.resize((grad_grads.size() == 0) ? 0 : n_sub);
164 p_third_derivatives.resize((third_derivatives.size() == 0) ? 0 : n_sub);
165 p_fourth_derivatives.resize((fourth_derivatives.size() == 0) ? 0 : n_sub);
167 for (
unsigned int d = 0; d < dim; ++d)
175 for (
unsigned int c = 0; c < dim; ++c)
176 p(c) = unit_point((c + d) % dim);
178 polynomial_space.evaluate(p,
183 p_fourth_derivatives);
185 for (
unsigned int i = 0; i < p_values.size(); ++i)
186 values[lexicographic_to_hierarchic[i + d * n_sub]][d] =
187 p_values[renumber_aniso[d][i]];
189 for (
unsigned int i = 0; i < p_grads.size(); ++i)
190 for (
unsigned int d1 = 0; d1 < dim; ++d1)
191 grads[lexicographic_to_hierarchic[i + d * n_sub]][d][(d1 + d) % dim] =
192 p_grads[renumber_aniso[d][i]][d1];
194 for (
unsigned int i = 0; i < p_grad_grads.size(); ++i)
195 for (
unsigned int d1 = 0; d1 < dim; ++d1)
196 for (
unsigned int d2 = 0; d2 < dim; ++d2)
197 grad_grads[lexicographic_to_hierarchic[i + d * n_sub]][d]
198 [(d1 + d) % dim][(d2 + d) % dim] =
199 p_grad_grads[renumber_aniso[d][i]][d1][d2];
201 for (
unsigned int i = 0; i < p_third_derivatives.size(); ++i)
202 for (
unsigned int d1 = 0; d1 < dim; ++d1)
203 for (
unsigned int d2 = 0; d2 < dim; ++d2)
204 for (
unsigned int d3 = 0; d3 < dim; ++d3)
205 third_derivatives[lexicographic_to_hierarchic[i + d * n_sub]][d]
206 [(d1 + d) % dim][(d2 + d) % dim]
208 p_third_derivatives[renumber_aniso[d][i]][d1]
211 for (
unsigned int i = 0; i < p_fourth_derivatives.size(); ++i)
212 for (
unsigned int d1 = 0; d1 < dim; ++d1)
213 for (
unsigned int d2 = 0; d2 < dim; ++d2)
214 for (
unsigned int d3 = 0; d3 < dim; ++d3)
215 for (
unsigned int d4 = 0; d4 < dim; ++d4)
216 fourth_derivatives[lexicographic_to_hierarchic[i + d * n_sub]]
217 [d][(d1 + d) % dim][(d2 + d) % dim]
218 [(d3 + d) % dim][(d4 + d) % dim] =
219 p_fourth_derivatives[renumber_aniso[d][i]]
230 return "RaviartThomas";
239 return n_polynomials(degree + 1, degree);
247 const unsigned int normal_degree,
248 const unsigned int tangential_degree)
250 return dim * (normal_degree + 1) *
257std::vector<unsigned int>
259 const unsigned int normal_degree,
260 const unsigned int tangential_degree)
262 const unsigned int n_dofs_face =
264 std::vector<unsigned int> lexicographic_numbering;
266 for (
unsigned int j = 0; j < n_dofs_face; ++j)
268 lexicographic_numbering.push_back(j);
269 if (normal_degree > 1)
270 for (
unsigned int i = n_dofs_face * 2 * dim;
271 i < n_dofs_face * 2 * dim + normal_degree - 1;
273 lexicographic_numbering.push_back(i + j * (normal_degree - 1));
274 lexicographic_numbering.push_back(n_dofs_face + j);
278 unsigned int layers = (dim == 3) ? tangential_degree + 1 : 1;
279 for (
unsigned int k = 0; k < layers; ++k)
281 unsigned int k_add = k * (tangential_degree + 1);
282 for (
unsigned int j = n_dofs_face * 2;
283 j < n_dofs_face * 2 + tangential_degree + 1;
285 lexicographic_numbering.push_back(j + k_add);
287 if (normal_degree > 1)
288 for (
unsigned int i = n_dofs_face * (2 * dim + (normal_degree - 1));
289 i < n_dofs_face * (2 * dim + (normal_degree - 1)) +
290 (normal_degree - 1) * (tangential_degree + 1);
293 lexicographic_numbering.push_back(i + k_add * tangential_degree);
295 for (
unsigned int j = n_dofs_face * 3;
296 j < n_dofs_face * 3 + tangential_degree + 1;
298 lexicographic_numbering.push_back(j + k_add);
304 for (
unsigned int i = 4 * n_dofs_face; i < 5 * n_dofs_face; ++i)
305 lexicographic_numbering.push_back(i);
306 if (normal_degree > 1)
307 for (
unsigned int i =
308 6 * n_dofs_face + n_dofs_face * 2 * (normal_degree - 1);
309 i < 6 * n_dofs_face + n_dofs_face * 3 * (normal_degree - 1);
311 lexicographic_numbering.push_back(i);
312 for (
unsigned int i = 5 * n_dofs_face; i < 6 * n_dofs_face; ++i)
313 lexicographic_numbering.push_back(i);
316 return lexicographic_numbering;
322std::unique_ptr<TensorPolynomialsBase<dim>>
325 return std::make_unique<PolynomialsRaviartThomas<dim>>(*this);
331std::vector<Point<dim>>
336 tangential_degree == 0 ?
348 const unsigned int n_sub = polynomial_space.n();
349 std::vector<Point<dim>> points(dim * n_sub);
350 points.resize(n_polynomials(normal_degree, tangential_degree));
351 for (
unsigned int d = 0; d < dim; ++d)
352 for (
unsigned int i = 0; i < n_sub; ++i)
353 for (
unsigned int c = 0; c < dim; ++c)
354 points[lexicographic_to_hierarchic[i + d * n_sub]][(c + d) % dim] =
355 quad.
point(renumber_aniso[d][i])[c];
static std::vector< unsigned int > get_lexicographic_numbering(const unsigned int normal_degree, const unsigned int tangential_degree)
const unsigned int normal_degree
std::array< std::vector< unsigned int >, dim > renumber_aniso
const unsigned int tangential_degree
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
std::string name() const override
PolynomialsRaviartThomas(const unsigned int degree_normal, const unsigned int degree_tangential)
static unsigned int n_polynomials(const unsigned int normal_degree, const unsigned int tangential_degree)
std::vector< unsigned int > lexicographic_to_hierarchic
std::vector< unsigned int > hierarchic_to_lexicographic
virtual std::unique_ptr< TensorPolynomialsBase< dim > > clone() const override
const AnisotropicPolynomials< dim > polynomial_space
std::vector< Point< dim > > get_polynomial_support_points() const
const Point< dim > & point(const unsigned int i) const
const unsigned int n_pols
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
std::vector< Polynomial< double > > generate_complete_Lagrange_basis(const std::vector< Point< 1 > > &points)
constexpr T pow(const T base, const int iexp)
std::vector< Integer > invert_permutation(const std::vector< Integer > &permutation)