Debian Codegraph @

include/deal.II/fe/fe_trace.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2014 - 2023 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_trace_h
16 #define dealii_fe_trace_h
17
18 #include <deal.II/base/config.h>
19
20 #include <deal.II/base/tensor_product_polynomials.h>
21
22 #include <deal.II/fe/fe_face.h>
23 #include <deal.II/fe/fe_poly_face.h>
24 #include <deal.II/fe/fe_q.h>
25
26 DEAL_II_NAMESPACE_OPEN
27
28 /**
29 * A finite element, which is the trace of FE_Q elements, that is a tensor
30 * product of polynomials on the faces, undefined in the interior of the cells
31 * and continuous. The basis functions on the faces are formed by a tensor
32 * product of 1d Lagrange polynomials with equidistant points up to degree 2
33 * and Gauss-Lobatto points starting from degree 3.
34 *
35 * This finite element is the trace space of FE_Q on the faces.
36 *
37 * @note Since these are only finite elements on faces, only FEFaceValues and
38 * FESubfaceValues will be able to extract reasonable values from any face
39 * polynomial. In order to make the use of FESystem simpler, FEValues objects
40 * will not fail using this finite element space, but all shape function
41 * values extracted will equal to zero.
42 */
43
44 template <int dim, int spacedim = dim>
45 class FE_TraceQ
46 : public FE_PolyFace<TensorProductPolynomials<dim - 1>, dim, spacedim>
47 {
48 public:
49 /**
50 * Constructor for tensor product polynomials of degree <tt>p</tt>. The
51 * shape functions created using this constructor correspond to Legendre
52 * polynomials in each coordinate direction.
53 */
54 FE_TraceQ(unsigned int p);
55
56 /**
57 * Return a string that uniquely identifies a finite element. This class
58 * returns <tt>FE_DGQ<dim>(degree)</tt>, with <tt>dim</tt> and
59 * <tt>degree</tt> replaced by appropriate values.
60 */
61 virtual std::string
62 get_name() const override;
63
64 virtual std::unique_ptr<FiniteElement<dim, spacedim>>
65 clone() const override;
66
67 /**
68 * Implementation of the corresponding function in the FiniteElement
69 * class. Since the current element is interpolatory, the nodal
70 * values are exactly the support point values. Furthermore, since
71 * the current element is scalar, the support point values need to
72 * be vectors of length 1.
73 */
74 virtual void
75 convert_generalized_support_point_values_to_dof_values(
76 const std::vector<Vector<double>> &support_point_values,
77 std::vector<double> &nodal_values) const override;
78
79 /**
80 * This function returns @p true, if the shape function @p shape_index has
81 * non-zero function values somewhere on the face @p face_index.
82 */
83 virtual bool
84 has_support_on_face(const unsigned int shape_index,
85 const unsigned int face_index) const override;
86
87 /**
88 * Return a list of constant modes of the element. For this element, it
89 * simply returns one row with all entries set to true.
90 */
91 virtual std::pair<Table<2, bool>, std::vector<unsigned int>>
92 get_constant_modes() const override;
93
94 /**
95 * Return whether this element implements its hanging node constraints in
96 * the new way, which has to be used to make elements "hp-compatible".
97 */
98 virtual bool
99 hp_constraints_are_implemented() const override;
100
101 /**
102 * Return the matrix interpolating from a face of one element to the face
103 * of the neighboring element. The size of the matrix is then
104 * <tt>source.dofs_per_face</tt> times <tt>this->dofs_per_face</tt>. This
105 * element only provides interpolation matrices for elements of the same
106 * type and FE_Nothing. For all other elements, an exception of type
107 * FiniteElement<dim,spacedim>::ExcInterpolationNotImplemented is thrown.
108 */
109 virtual void
110 get_face_interpolation_matrix(const FiniteElement<dim, spacedim> &source,
111 FullMatrix<double> &matrix,
112 const unsigned int face_no = 0) const override;
113
114 /**
115 * Return the matrix interpolating from a face of one element to the face
116 * of the neighboring element. The size of the matrix is then
117 * <tt>source.dofs_per_face</tt> times <tt>this->dofs_per_face</tt>. This
118 * element only provides interpolation matrices for elements of the same
119 * type and FE_Nothing. For all other elements, an exception of type
120 * FiniteElement<dim,spacedim>::ExcInterpolationNotImplemented is thrown.
121 */
122 virtual void
123 get_subface_interpolation_matrix(
124 const FiniteElement<dim, spacedim> &source,
125 const unsigned int subface,
126 FullMatrix<double> &matrix,
127 const unsigned int face_no = 0) const override;
128
129 /**
130 * @copydoc FiniteElement::compare_for_domination()
131 */
132 virtual FiniteElementDomination::Domination
133 compare_for_domination(const FiniteElement<dim, spacedim> &fe_other,
134 const unsigned int codim = 0) const override final;
135
136 private:
137 /**
138 * Store a copy of FE_Q for delegating the hp-constraints functionality.
139 */
140 FE_Q<dim, spacedim> fe_q;
141
142 /**
143 * Return vector with dofs per vertex, line, quad, hex.
144 */
145 static std::vector<unsigned int>
146 get_dpo_vector(const unsigned int deg);
147 };
148
149
150
151 /**
152 * FE_TraceQ in 1d, i.e., with degrees of freedom on the element vertices.
153 */
154 template <int spacedim>
155 class FE_TraceQ<1, spacedim> : public FE_FaceQ<1, spacedim>
156 {
157 public:
158 /**
159 * Constructor.
160 */
161 FE_TraceQ(const unsigned int p);
162
163 /**
164 * Return the name of the element
165 */
166 std::string
167 get_name() const override;
168 };
169
170
171 DEAL_II_NAMESPACE_CLOSE
172
173 #endif