deal.II version GIT relicensing-2289-g1e5549a87a 2024-12-21 21:30:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
fe_pyramid_p.cc
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2021 - 2024 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#include <deal.II/base/config.h>
16
19
20#include <deal.II/fe/fe_dgq.h>
23#include <deal.II/fe/fe_q.h>
26#include <deal.II/fe/fe_tools.h>
28
30
31namespace
32{
37 get_dpo_vector_fe_pyramid_p(const unsigned int degree)
38 {
40
41 if (degree == 1)
42 {
43 dpo.dofs_per_object_exclusive = {{1}, {0}, {0, 0, 0, 0, 0}, {0}};
44 dpo.dofs_per_object_inclusive = {{1}, {2}, {4, 3, 3, 3, 3}, {5}};
45 dpo.object_index = {{}, {5}, {5}, {5}};
46 dpo.first_object_index_on_face = {{}, {4, 3, 3, 3, 3}, {4, 3, 3, 3, 3}};
47 }
48 else
49 {
51 }
52
53 return dpo;
54 }
55
60 get_dpo_vector_fe_pyramid_dgp(const unsigned int degree)
61 {
62 unsigned int n_dofs = 0;
63
64 if (degree == 1)
65 n_dofs = 5;
66 else
68
69 return internal::expand(3, {{0, 0, 0, n_dofs}}, ReferenceCells::Pyramid);
70 }
71} // namespace
72
73
74template <int dim, int spacedim>
76 const unsigned int degree,
78 const typename FiniteElementData<dim>::Conformity conformity)
79 : ::FE_Poly<dim, spacedim>(
81 FiniteElementData<dim>(dpos,
82 ReferenceCells::Pyramid,
83 1,
84 degree,
85 conformity),
86 std::vector<bool>(
87 FiniteElementData<dim>(dpos, ReferenceCells::Pyramid, 1, degree)
88 .dofs_per_cell,
89 true),
90 std::vector<ComponentMask>(
91 FiniteElementData<dim>(dpos, ReferenceCells::Pyramid, 1, degree)
92 .dofs_per_cell,
93 ComponentMask(std::vector<bool>(1, true))))
94{
95 AssertDimension(dim, 3);
96
97 if (degree == 1)
98 {
99 for (const auto i : this->reference_cell().vertex_indices())
100 this->unit_support_points.emplace_back(
101 this->reference_cell().template vertex<dim>(i));
102
103 this->unit_face_support_points.resize(this->reference_cell().n_faces());
104
105 for (const auto f : this->reference_cell().face_indices())
106 {
107 const auto face_reference_cell =
109
110 for (const auto i : face_reference_cell.vertex_indices())
111 this->unit_face_support_points[f].emplace_back(
112 face_reference_cell.template vertex<dim - 1>(i));
113 }
114 }
115 else
117}
118
119
120
121template <int dim, int spacedim>
122void
125 const std::vector<Vector<double>> &support_point_values,
126 std::vector<double> &nodal_values) const
127{
128 AssertDimension(support_point_values.size(),
129 this->get_unit_support_points().size());
130 AssertDimension(support_point_values.size(), nodal_values.size());
131 AssertDimension(this->dofs_per_cell, nodal_values.size());
132
133 for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
134 {
135 AssertDimension(support_point_values[i].size(), 1);
136
137 nodal_values[i] = support_point_values[i](0);
138 }
139}
140
141
142
143template <int dim, int spacedim>
145 : FE_PyramidPoly<dim, spacedim>(degree,
146 get_dpo_vector_fe_pyramid_p(degree),
147 FiniteElementData<dim>::H1)
148{}
149
150
151
152template <int dim, int spacedim>
153std::unique_ptr<FiniteElement<dim, spacedim>>
155{
156 return std::make_unique<FE_PyramidP<dim, spacedim>>(*this);
157}
158
159
160
161template <int dim, int spacedim>
162std::string
164{
165 std::ostringstream namebuf;
166 namebuf << "FE_PyramidP<" << Utilities::dim_string(dim, spacedim) << ">("
167 << this->degree << ")";
168
169 return namebuf.str();
170}
171
172
173
174template <int dim, int spacedim>
177 const FiniteElement<dim, spacedim> &fe_other,
178 const unsigned int codim) const
179{
180 Assert(codim <= dim, ExcImpossibleInDim(dim));
181
182 // vertex/line/face domination
183 // (if fe_other is derived from FE_SimplexDGP)
184 // ------------------------------------
185 if (codim > 0)
186 if (dynamic_cast<const FE_SimplexDGP<dim, spacedim> *>(&fe_other) !=
187 nullptr)
188 // there are no requirements between continuous and discontinuous
189 // elements
191
192 // vertex/line/face domination
193 // (if fe_other is not derived from FE_SimplexDGP)
194 // & cell domination
195 // ----------------------------------------
196 if (const FE_PyramidP<dim, spacedim> *fe_pp_other =
197 dynamic_cast<const FE_PyramidP<dim, spacedim> *>(&fe_other))
198 {
199 if (this->degree < fe_pp_other->degree)
201 else if (this->degree == fe_pp_other->degree)
203 else
205 }
206 else if (const FE_SimplexP<dim, spacedim> *fe_p_other =
207 dynamic_cast<const FE_SimplexP<dim, spacedim> *>(&fe_other))
208 {
209 if (this->degree < fe_p_other->degree)
211 else if (this->degree == fe_p_other->degree)
213 else
215 }
216 else if (const FE_Q<dim, spacedim> *fe_q_other =
217 dynamic_cast<const FE_Q<dim, spacedim> *>(&fe_other))
218 {
219 if (this->degree < fe_q_other->degree)
221 else if (this->degree == fe_q_other->degree)
223 else
225 }
226 else if (const FE_Nothing<dim, spacedim> *fe_nothing =
227 dynamic_cast<const FE_Nothing<dim, spacedim> *>(&fe_other))
228 {
229 if (fe_nothing->is_dominating())
231 else
232 // the FE_Nothing has no degrees of freedom and it is typically used
233 // in a context where we don't require any continuity along the
234 // interface
236 }
237
240}
241
242
243
244template <int dim, int spacedim>
245std::vector<std::pair<unsigned int, unsigned int>>
247 const FiniteElement<dim, spacedim> &fe_other) const
248{
249 (void)fe_other;
250
251 Assert((dynamic_cast<const FE_SimplexP<dim, spacedim> *>(&fe_other)) ||
252 (dynamic_cast<const FE_Q<dim, spacedim> *>(&fe_other)),
254
255 return {{0, 0}};
256}
257
258
259
260template <int dim, int spacedim>
261std::vector<std::pair<unsigned int, unsigned int>>
263 const FiniteElement<dim, spacedim> &fe_other) const
264{
265 (void)fe_other;
266
267 Assert((dynamic_cast<const FE_SimplexP<dim, spacedim> *>(&fe_other)) ||
268 (dynamic_cast<const FE_Q<dim, spacedim> *>(&fe_other)),
270
271 std::vector<std::pair<unsigned int, unsigned int>> result;
272
273 for (unsigned int i = 0; i < this->degree - 1; ++i)
274 result.emplace_back(i, i);
275
276 return result;
277}
278
279
280
281template <int dim, int spacedim>
282std::vector<std::pair<unsigned int, unsigned int>>
284 const FiniteElement<dim, spacedim> &fe_other,
285 const unsigned int face_no) const
286{
287 (void)fe_other;
288
289
290 AssertIndexRange(face_no, 5);
291
292 if (face_no == 0)
293 {
294 Assert((dynamic_cast<const FE_Q<dim, spacedim> *>(&fe_other)),
296 }
297 else
298 {
299 Assert((dynamic_cast<const FE_SimplexP<dim, spacedim> *>(&fe_other)),
301 }
302
303 std::vector<std::pair<unsigned int, unsigned int>> result;
304
305 for (unsigned int i = 0; i < this->n_dofs_per_quad(face_no); ++i)
306 result.emplace_back(i, i);
307
308 return result;
309}
310
311
312
313template <int dim, int spacedim>
315 : FE_PyramidPoly<dim, spacedim>(degree,
316 get_dpo_vector_fe_pyramid_dgp(degree),
317 FiniteElementData<dim>::L2)
318{}
319
320
321
322template <int dim, int spacedim>
323std::unique_ptr<FiniteElement<dim, spacedim>>
325{
326 return std::make_unique<FE_PyramidDGP<dim, spacedim>>(*this);
327}
328
329
330
331template <int dim, int spacedim>
332std::string
334{
335 std::ostringstream namebuf;
336 namebuf << "FE_PyramidDGP<" << Utilities::dim_string(dim, spacedim) << ">("
337 << this->degree << ")";
338
339 return namebuf.str();
340}
341
342// explicit instantiations
343#include "fe_pyramid_p.inst"
344
std::string get_name() const override
FE_PyramidDGP(const unsigned int degree)
std::unique_ptr< FiniteElement< dim, spacedim > > clone() const override
FE_PyramidP(const unsigned int degree)
std::unique_ptr< FiniteElement< dim, spacedim > > clone() const override
std::vector< std::pair< unsigned int, unsigned int > > hp_line_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const override
std::vector< std::pair< unsigned int, unsigned int > > hp_vertex_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const override
std::vector< std::pair< unsigned int, unsigned int > > hp_quad_dof_identities(const FiniteElement< dim, spacedim > &fe_other, const unsigned int face_no=0) const override
std::string get_name() const override
FiniteElementDomination::Domination compare_for_domination(const FiniteElement< dim, spacedim > &fe_other, const unsigned int codim) const override
FE_PyramidPoly(const unsigned int degree, const internal::GenericDoFsPerObject &dpos, const typename FiniteElementData< dim >::Conformity conformity)
virtual void convert_generalized_support_point_values_to_dof_values(const std::vector< Vector< double > > &support_point_values, std::vector< double > &nodal_values) const override
Definition fe_q.h:554
const unsigned int degree
Definition fe_data.h:452
ReferenceCell reference_cell() const
std::vector< std::vector< Point< dim - 1 > > > unit_face_support_points
Definition fe.h:2495
std::vector< Point< dim > > unit_support_points
Definition fe.h:2488
std_cxx20::ranges::iota_view< unsigned int, unsigned int > vertex_indices() const
unsigned int n_faces() const
ReferenceCell face_reference_cell(const unsigned int face_no) const
std_cxx20::ranges::iota_view< unsigned int, unsigned int > face_indices() const
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
#define DEAL_II_NOT_IMPLEMENTED()
std::size_t size
Definition mpi.cc:734
constexpr const ReferenceCell Pyramid
std::string dim_string(const int dim, const int spacedim)
Definition utilities.cc:555
internal::GenericDoFsPerObject expand(const unsigned int dim, const std::vector< unsigned int > &dofs_per_object, const ReferenceCell reference_cell)
Definition fe_data.cc:24
STL namespace.
std::vector< std::vector< unsigned int > > object_index
Definition fe_data.h:197
std::vector< std::vector< unsigned int > > first_object_index_on_face
Definition fe_data.h:202
std::vector< std::vector< unsigned int > > dofs_per_object_inclusive
Definition fe_data.h:192
std::vector< std::vector< unsigned int > > dofs_per_object_exclusive
Definition fe_data.h:187