| 1 |
// ------------------------------------------------------------------------ |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
// Copyright (C) 2021 - 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_fe_fe_p_h |
| 16 |
#define dealii_fe_fe_p_h |
| 17 |
|
| 18 |
#include <deal.II/base/config.h> |
| 19 |
|
| 20 |
#include <deal.II/base/mutex.h> |
| 21 |
#include <deal.II/base/polynomials_barycentric.h> |
| 22 |
#include <deal.II/base/types.h> |
| 23 |
|
| 24 |
#include <deal.II/fe/fe_poly.h> |
| 25 |
|
| 26 |
DEAL_II_NAMESPACE_OPEN |
| 27 |
|
| 28 |
/** |
| 29 |
* Base class of FE_SimplexP, FE_SimplexDGP, and FE_SimplexP_Bubbles. |
| 30 |
* |
| 31 |
* @note Only implemented for 2d and 3d. |
| 32 |
* |
| 33 |
* Also see |
| 34 |
* @ref simplex "Simplex support". |
| 35 |
*/ |
| 36 |
template <int dim, int spacedim = dim> |
| 37 |
class FE_SimplexPoly : public dealii::FE_Poly<dim, spacedim> |
| 38 |
{ |
| 39 |
public: |
| 40 |
/** |
| 41 |
* Constructor. |
| 42 |
*/ |
| 43 |
FE_SimplexPoly( |
| 44 |
const BarycentricPolynomials<dim> polynomials, |
| 45 |
const FiniteElementData<dim> &fe_data, |
| 46 |
const bool prolongation_is_additive, |
| 47 |
const std::vector<Point<dim>> &unit_support_points, |
| 48 |
const std::vector<std::vector<Point<dim - 1>>> unit_face_support_points, |
| 49 |
const FullMatrix<double> &interface_constraints); |
| 50 |
|
| 51 |
/** |
| 52 |
* Return a list of constant modes of the element. For this element, the |
| 53 |
* list consists of true arguments for all components. |
| 54 |
*/ |
| 55 |
virtual std::pair<Table<2, bool>, std::vector<unsigned int>> |
| 56 |
get_constant_modes() const override; |
| 57 |
|
| 58 |
/** |
| 59 |
* @copydoc dealii::FiniteElement::get_prolongation_matrix() |
| 60 |
* |
| 61 |
* @note Only implemented for RefinementCase::isotropic_refinement. |
| 62 |
*/ |
| 63 |
virtual const FullMatrix<double> & |
| 64 |
get_prolongation_matrix( |
| 65 |
const unsigned int child, |
| 66 |
const RefinementCase<dim> &refinement_case = |
| 67 |
RefinementCase<dim>::isotropic_refinement) const override; |
| 68 |
|
| 69 |
/** |
| 70 |
* @see FiniteElement::face_to_cell_index() |
| 71 |
*/ |
| 72 |
virtual unsigned int |
| 73 |
face_to_cell_index(const unsigned int face_dof_index, |
| 74 |
const unsigned int face, |
| 75 |
const types::geometric_orientation combined_orientation = |
| 76 |
numbers::default_geometric_orientation) const override; |
| 77 |
|
| 78 |
/** |
| 79 |
* @copydoc dealii::FiniteElement::get_restriction_matrix() |
| 80 |
* |
| 81 |
* @note Only implemented for RefinementCase::isotropic_refinement. |
| 82 |
*/ |
| 83 |
virtual const FullMatrix<double> & |
| 84 |
get_restriction_matrix( |
| 85 |
const unsigned int child, |
| 86 |
const RefinementCase<dim> &refinement_case = |
| 87 |
RefinementCase<dim>::isotropic_refinement) const override; |
| 88 |
|
| 89 |
/** |
| 90 |
* @copydoc dealii::FiniteElement::get_face_interpolation_matrix() |
| 91 |
*/ |
| 92 |
void |
| 93 |
get_face_interpolation_matrix(const FiniteElement<dim, spacedim> &source_fe, |
| 94 |
FullMatrix<double> &interpolation_matrix, |
| 95 |
const unsigned int face_no) const override; |
| 96 |
|
| 97 |
/** |
| 98 |
* @copydoc dealii::FiniteElement::get_subface_interpolation_matrix() |
| 99 |
*/ |
| 100 |
void |
| 101 |
get_subface_interpolation_matrix( |
| 102 |
const FiniteElement<dim, spacedim> &x_source_fe, |
| 103 |
const unsigned int subface, |
| 104 |
FullMatrix<double> &interpolation_matrix, |
| 105 |
const unsigned int face_no) const override; |
| 106 |
|
| 107 |
/** |
| 108 |
* @copydoc dealii::FiniteElement::hp_constraints_are_implemented() |
| 109 |
*/ |
| 110 |
bool |
| 111 |
hp_constraints_are_implemented() const override; |
| 112 |
|
| 113 |
/** |
| 114 |
* @copydoc dealii::FiniteElement::convert_generalized_support_point_values_to_dof_values() |
| 115 |
*/ |
| 116 |
virtual void |
| 117 |
convert_generalized_support_point_values_to_dof_values( |
| 118 |
const std::vector<Vector<double>> &support_point_values, |
| 119 |
std::vector<double> &nodal_values) const override; |
| 120 |
|
| 121 |
protected: |
| 122 |
/** |
| 123 |
* Mutex variables used for protecting the initialization of restriction |
| 124 |
* and embedding matrices. |
| 125 |
*/ |
| 126 |
mutable Threads::Mutex restriction_matrix_mutex; |
| 127 |
mutable Threads::Mutex prolongation_matrix_mutex; |
| 128 |
}; |
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
/** |
| 133 |
* Implementation of a scalar Lagrange finite element $P_k$ that yields |
| 134 |
* the finite element space of continuous, piecewise polynomials of |
| 135 |
* degree $k$. The corresponding element on hypercube cells is FE_Q, on |
| 136 |
* wegdes it is FE_WedgeP, and on pyramids it is FE_PyramidP. |
| 137 |
* |
| 138 |
* Also see |
| 139 |
* @ref simplex "Simplex support". |
| 140 |
*/ |
| 141 |
template <int dim, int spacedim = dim> |
| 142 |
class FE_SimplexP : public FE_SimplexPoly<dim, spacedim> |
| 143 |
{ |
| 144 |
public: |
| 145 |
/** |
| 146 |
* Constructor. |
| 147 |
*/ |
| 148 |
FE_SimplexP(const unsigned int degree); |
| 149 |
|
| 150 |
/** |
| 151 |
* @copydoc dealii::FiniteElement::clone() |
| 152 |
*/ |
| 153 |
std::unique_ptr<FiniteElement<dim, spacedim>> |
| 154 |
clone() const override; |
| 155 |
|
| 156 |
/** |
| 157 |
* Return a string that uniquely identifies a finite element. This class |
| 158 |
* returns <tt>FE_SimplexP<dim>(degree)</tt>, with @p dim and @p degree |
| 159 |
* replaced by appropriate values. |
| 160 |
*/ |
| 161 |
std::string |
| 162 |
get_name() const override; |
| 163 |
|
| 164 |
/** |
| 165 |
* @copydoc dealii::FiniteElement::compare_for_domination() |
| 166 |
*/ |
| 167 |
FiniteElementDomination::Domination |
| 168 |
compare_for_domination(const FiniteElement<dim, spacedim> &fe_other, |
| 169 |
const unsigned int codim) const override; |
| 170 |
|
| 171 |
/** |
| 172 |
* @copydoc dealii::FiniteElement::hp_vertex_dof_identities() |
| 173 |
*/ |
| 174 |
std::vector<std::pair<unsigned int, unsigned int>> |
| 175 |
hp_vertex_dof_identities( |
| 176 |
const FiniteElement<dim, spacedim> &fe_other) const override; |
| 177 |
|
| 178 |
/** |
| 179 |
* @copydoc dealii::FiniteElement::hp_line_dof_identities() |
| 180 |
*/ |
| 181 |
std::vector<std::pair<unsigned int, unsigned int>> |
| 182 |
hp_line_dof_identities( |
| 183 |
const FiniteElement<dim, spacedim> &fe_other) const override; |
| 184 |
}; |
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
/** |
| 189 |
* Implementation of a scalar discontinuous Lagrange finite element |
| 190 |
* $P_k$, sometimes denoted as $P_{-k}$, that yields the finite |
| 191 |
* element space of discontinuous, piecewise polynomials of degree |
| 192 |
* $k$. |
| 193 |
* |
| 194 |
* Also see |
| 195 |
* @ref simplex "Simplex support". |
| 196 |
*/ |
| 197 |
template <int dim, int spacedim = dim> |
| 198 |
class FE_SimplexDGP : public FE_SimplexPoly<dim, spacedim> |
| 199 |
{ |
| 200 |
public: |
| 201 |
/** |
| 202 |
* Constructor. |
| 203 |
*/ |
| 204 |
FE_SimplexDGP(const unsigned int degree); |
| 205 |
|
| 206 |
/** |
| 207 |
* @copydoc dealii::FiniteElement::clone() |
| 208 |
*/ |
| 209 |
std::unique_ptr<FiniteElement<dim, spacedim>> |
| 210 |
clone() const override; |
| 211 |
|
| 212 |
/** |
| 213 |
* Return a string that uniquely identifies a finite element. This class |
| 214 |
* returns <tt>FE_SimplexDGP<dim>(degree)</tt>, with @p dim and @p degree |
| 215 |
* replaced by appropriate values. |
| 216 |
*/ |
| 217 |
std::string |
| 218 |
get_name() const override; |
| 219 |
|
| 220 |
/** |
| 221 |
* @copydoc dealii::FiniteElement::compare_for_domination() |
| 222 |
*/ |
| 223 |
FiniteElementDomination::Domination |
| 224 |
compare_for_domination(const FiniteElement<dim, spacedim> &fe_other, |
| 225 |
const unsigned int codim) const override; |
| 226 |
|
| 227 |
/** |
| 228 |
* @copydoc dealii::FiniteElement::hp_vertex_dof_identities() |
| 229 |
*/ |
| 230 |
std::vector<std::pair<unsigned int, unsigned int>> |
| 231 |
hp_vertex_dof_identities( |
| 232 |
const FiniteElement<dim, spacedim> &fe_other) const override; |
| 233 |
|
| 234 |
/** |
| 235 |
* @copydoc dealii::FiniteElement::hp_line_dof_identities() |
| 236 |
*/ |
| 237 |
std::vector<std::pair<unsigned int, unsigned int>> |
| 238 |
hp_line_dof_identities( |
| 239 |
const FiniteElement<dim, spacedim> &fe_other) const override; |
| 240 |
|
| 241 |
/** |
| 242 |
* @copydoc dealii::FiniteElement::get_restriction_matrix() |
| 243 |
* |
| 244 |
* @note Only implemented for RefinementCase::isotropic_refinement. |
| 245 |
*/ |
| 246 |
virtual const FullMatrix<double> & |
| 247 |
get_restriction_matrix( |
| 248 |
const unsigned int child, |
| 249 |
const RefinementCase<dim> &refinement_case = |
| 250 |
RefinementCase<dim>::isotropic_refinement) const override; |
| 251 |
}; |
| 252 |
|
| 253 |
DEAL_II_NAMESPACE_CLOSE |
| 254 |
|
| 255 |
#endif |