| 1 |
// ------------------------------------------------------------------------ |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
// Copyright (C) 2004 - 2025 by the deal.II authors |
| 5 |
// |
| 6 |
// This file is part of the deal.II library. |
| 7 |
// |
| 8 |
// Part of the source code is dual licensed under Apache-2.0 WITH |
| 9 |
// LLVM-exception OR LGPL-2.1-or-later. Detailed license information |
| 10 |
// governing the source code and code contributions can be found in |
| 11 |
// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II. |
| 12 |
// |
| 13 |
// ------------------------------------------------------------------------ |
| 14 |
|
| 15 |
#ifndef dealii_polynomials_vector_anisotropic_h |
| 16 |
#define dealii_polynomials_vector_anisotropic_h |
| 17 |
|
| 18 |
|
| 19 |
#include <deal.II/base/config.h> |
| 20 |
|
| 21 |
#include <deal.II/base/exceptions.h> |
| 22 |
#include <deal.II/base/point.h> |
| 23 |
#include <deal.II/base/polynomial.h> |
| 24 |
#include <deal.II/base/polynomial_space.h> |
| 25 |
#include <deal.II/base/tensor.h> |
| 26 |
#include <deal.II/base/tensor_polynomials_base.h> |
| 27 |
#include <deal.II/base/tensor_product_polynomials.h> |
| 28 |
|
| 29 |
#include <mutex> |
| 30 |
#include <vector> |
| 31 |
|
| 32 |
|
| 33 |
DEAL_II_NAMESPACE_OPEN |
| 34 |
|
| 35 |
/** |
| 36 |
* This class implements vector-valued anisotropic polynomials and can be |
| 37 |
* used further for the generation of vector-valued polynomials with |
| 38 |
* degrees being different in the `dim - 1` tangential directions and the |
| 39 |
* normal direction, respectively. The known |
| 40 |
* examples include Raviart-Thomas and Nédélec polynomials. |
| 41 |
* The polynomial space can be renumbered as required by specific elements. |
| 42 |
* In fact, Raviart-Thomas and Nédélec elements will choose a different ordering |
| 43 |
* to ensure continuity in normal or tangential direction, respectively |
| 44 |
* @ingroup Polynomials |
| 45 |
*/ |
| 46 |
template <int dim> |
| 47 |
class PolynomialsVectorAnisotropic : public TensorPolynomialsBase<dim> |
| 48 |
{ |
| 49 |
public: |
| 50 |
/** |
| 51 |
* Constructor. Creates all basis functions for anisotropic vector-valued |
| 52 |
* polynomials of given degrees in normal and tangential directions, |
| 53 |
* respectively. |
| 54 |
*/ |
| 55 |
PolynomialsVectorAnisotropic( |
| 56 |
const unsigned int degree_normal, |
| 57 |
const unsigned int degree_tangential, |
| 58 |
const std::vector<unsigned int> &polynomial_ordering); |
| 59 |
|
| 60 |
/** |
| 61 |
* Copy constructor. |
| 62 |
*/ |
| 63 |
PolynomialsVectorAnisotropic(const PolynomialsVectorAnisotropic &other) = |
| 64 |
default; |
| 65 |
|
| 66 |
/** |
| 67 |
* Compute the value and certain derivatives of each anisotropic polynomial |
| 68 |
* at |
| 69 |
* @p unit_point. |
| 70 |
* |
| 71 |
* The size of the vectors must either be zero or equal <tt>n()</tt>. In |
| 72 |
* the first case, the function will not compute these values. |
| 73 |
*/ |
| 74 |
void |
| 75 |
evaluate(const Point<dim> &unit_point, |
| 76 |
std::vector<Tensor<1, dim>> &values, |
| 77 |
std::vector<Tensor<2, dim>> &grads, |
| 78 |
std::vector<Tensor<3, dim>> &grad_grads, |
| 79 |
std::vector<Tensor<4, dim>> &third_derivatives, |
| 80 |
std::vector<Tensor<5, dim>> &fourth_derivatives) const override; |
| 81 |
|
| 82 |
/** |
| 83 |
* Return the name of the space, which is |
| 84 |
* <tt>PolynomialsVectorAnisotropic</tt>. |
| 85 |
*/ |
| 86 |
std::string |
| 87 |
name() const override; |
| 88 |
|
| 89 |
/** |
| 90 |
* Return the number of polynomials in the space without requiring to |
| 91 |
* build an object of PolynomialsVectorAnisotropic. This is required by the |
| 92 |
* FiniteElement classes. |
| 93 |
*/ |
| 94 |
static unsigned int |
| 95 |
n_polynomials(const unsigned int normal_degree, |
| 96 |
const unsigned int tangential_degree); |
| 97 |
|
| 98 |
/** |
| 99 |
* Return degree of polynomials in tangential direction. |
| 100 |
*/ |
| 101 |
unsigned int |
| 102 |
get_tangential_degree() const; |
| 103 |
|
| 104 |
/** |
| 105 |
* Return degree of polynomials in normal direction. |
| 106 |
*/ |
| 107 |
unsigned int |
| 108 |
get_normal_degree() const; |
| 109 |
|
| 110 |
/** |
| 111 |
* @copydoc TensorPolynomialsBase::clone() |
| 112 |
*/ |
| 113 |
virtual std::unique_ptr<TensorPolynomialsBase<dim>> |
| 114 |
clone() const override; |
| 115 |
|
| 116 |
/** |
| 117 |
* Compute the generalized support points in the ordering used by the |
| 118 |
* polynomial shape functions. Note that these points are not support points |
| 119 |
* in the classical sense as the Lagrange polynomials of the different |
| 120 |
* components have different points, which need to be combined in terms of |
| 121 |
* Piola transformations. |
| 122 |
*/ |
| 123 |
std::vector<Point<dim>> |
| 124 |
get_polynomial_support_points() const; |
| 125 |
|
| 126 |
private: |
| 127 |
/** |
| 128 |
* The given degree in the normal direction. |
| 129 |
*/ |
| 130 |
const unsigned int normal_degree; |
| 131 |
|
| 132 |
/** |
| 133 |
* The given degree in the tangential direction. |
| 134 |
*/ |
| 135 |
const unsigned int tangential_degree; |
| 136 |
|
| 137 |
/** |
| 138 |
* An object representing the polynomial space for a single component. |
| 139 |
* We can re-use it for all components by rotating the coordinates of the |
| 140 |
* evaluation point. |
| 141 |
*/ |
| 142 |
const AnisotropicPolynomials<dim> polynomial_space; |
| 143 |
|
| 144 |
/** |
| 145 |
* Renumbering from lexicographic order that is used in the underlying |
| 146 |
* scalar anisotropic tensor-product polynomial space to the numbering |
| 147 |
* used by the finite element. |
| 148 |
*/ |
| 149 |
std::vector<unsigned int> lexicographic_to_hierarchic; |
| 150 |
|
| 151 |
/** |
| 152 |
* Renumbering from hierarchic to lexicographic order. Inverse of |
| 153 |
* lexicographic_to_hierarchic. |
| 154 |
*/ |
| 155 |
std::vector<unsigned int> hierarchic_to_lexicographic; |
| 156 |
|
| 157 |
/** |
| 158 |
* Renumbering from shifted polynomial spaces to lexicographic one. |
| 159 |
*/ |
| 160 |
std::array<std::vector<unsigned int>, dim> renumber_aniso; |
| 161 |
}; |
| 162 |
|
| 163 |
|
| 164 |
DEAL_II_NAMESPACE_CLOSE |
| 165 |
|
| 166 |
#endif |