Reference documentation for deal.II version Git 1d2117d9d6 2021-12-01 15:23:49 -0500
\(\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\}}\)
fe_pyramid_p.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2020 - 2021 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #include <deal.II/base/config.h>
17 
20 
21 #include <deal.II/fe/fe_dgq.h>
22 #include <deal.II/fe/fe_nothing.h>
24 #include <deal.II/fe/fe_q.h>
27 #include <deal.II/fe/fe_tools.h>
28 #include <deal.II/fe/fe_wedge_p.h>
29 
31 
32 namespace
33 {
38  get_dpo_vector_fe_pyramid_p(const unsigned int degree)
39  {
41 
42  if (degree == 1)
43  {
44  dpo.dofs_per_object_exclusive = {{1}, {0}, {0, 0, 0, 0, 0}, {0}};
45  dpo.dofs_per_object_inclusive = {{1}, {2}, {4, 3, 3, 3, 3}, {5}};
46  dpo.object_index = {{}, {5}, {5}, {5}};
47  dpo.first_object_index_on_face = {{}, {4, 3, 3, 3, 3}, {4, 3, 3, 3, 3}};
48  }
49  else
50  {
51  Assert(false, ExcNotImplemented());
52  }
53 
54  return dpo;
55  }
56 
61  get_dpo_vector_fe_pyramid_dgp(const unsigned int degree)
62  {
63  unsigned int n_dofs = 0;
64 
65  if (degree == 1)
66  n_dofs = 5;
67  else
68  Assert(false, ExcNotImplemented());
69 
70  return internal::expand(3, {{0, 0, 0, n_dofs}}, ReferenceCells::Pyramid);
71  }
72 } // namespace
73 
74 
75 template <int dim, int spacedim>
77  const unsigned int degree,
78  const internal::GenericDoFsPerObject & dpos,
79  const typename FiniteElementData<dim>::Conformity conformity)
80  : ::FE_Poly<dim, spacedim>(
82  FiniteElementData<dim>(dpos,
84  1,
85  degree,
86  conformity),
87  std::vector<bool>(
88  FiniteElementData<dim>(dpos, ReferenceCells::Pyramid, 1, degree)
89  .dofs_per_cell,
90  true),
91  std::vector<ComponentMask>(
92  FiniteElementData<dim>(dpos, ReferenceCells::Pyramid, 1, degree)
93  .dofs_per_cell,
94  std::vector<bool>(1, true)))
95 {
96  AssertDimension(dim, 3);
97 
98  if (degree == 1)
99  {
100  for (const unsigned int i : ReferenceCells::Pyramid.vertex_indices())
101  this->unit_support_points.emplace_back(
102  ReferenceCells::Pyramid.vertex<dim>(i));
103  }
104  else
105  Assert(false, ExcNotImplemented());
106 }
107 
108 
109 
110 template <int dim, int spacedim>
111 void
114  const std::vector<Vector<double>> &support_point_values,
115  std::vector<double> & nodal_values) const
116 {
117  AssertDimension(support_point_values.size(),
118  this->get_unit_support_points().size());
119  AssertDimension(support_point_values.size(), nodal_values.size());
120  AssertDimension(this->dofs_per_cell, nodal_values.size());
121 
122  for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
123  {
124  AssertDimension(support_point_values[i].size(), 1);
125 
126  nodal_values[i] = support_point_values[i](0);
127  }
128 }
129 
130 
131 
132 template <int dim, int spacedim>
133 FE_PyramidP<dim, spacedim>::FE_PyramidP(const unsigned int degree)
134  : FE_PyramidPoly<dim, spacedim>(degree,
135  get_dpo_vector_fe_pyramid_p(degree),
136  FiniteElementData<dim>::H1)
137 {}
138 
139 
140 
141 template <int dim, int spacedim>
142 std::unique_ptr<FiniteElement<dim, spacedim>>
144 {
145  return std::make_unique<FE_PyramidP<dim, spacedim>>(*this);
146 }
147 
148 
149 
150 template <int dim, int spacedim>
151 std::string
153 {
154  std::ostringstream namebuf;
155  namebuf << "FE_PyramidP<" << dim << ">(" << this->degree << ")";
156 
157  return namebuf.str();
158 }
159 
160 
161 
162 template <int dim, int spacedim>
165  const FiniteElement<dim, spacedim> &fe_other,
166  const unsigned int codim) const
167 {
168  Assert(codim <= dim, ExcImpossibleInDim(dim));
169 
170  // vertex/line/face domination
171  // (if fe_other is derived from FE_SimplexDGP)
172  // ------------------------------------
173  if (codim > 0)
174  if (dynamic_cast<const FE_SimplexDGP<dim, spacedim> *>(&fe_other) !=
175  nullptr)
176  // there are no requirements between continuous and discontinuous
177  // elements
179 
180  // vertex/line/face domination
181  // (if fe_other is not derived from FE_SimplexDGP)
182  // & cell domination
183  // ----------------------------------------
184  if (const FE_PyramidP<dim, spacedim> *fe_pp_other =
185  dynamic_cast<const FE_PyramidP<dim, spacedim> *>(&fe_other))
186  {
187  if (this->degree < fe_pp_other->degree)
189  else if (this->degree == fe_pp_other->degree)
191  else
193  }
194  else if (const FE_SimplexP<dim, spacedim> *fe_p_other =
195  dynamic_cast<const FE_SimplexP<dim, spacedim> *>(&fe_other))
196  {
197  if (this->degree < fe_p_other->degree)
199  else if (this->degree == fe_p_other->degree)
201  else
203  }
204  else if (const FE_Q<dim, spacedim> *fe_q_other =
205  dynamic_cast<const FE_Q<dim, spacedim> *>(&fe_other))
206  {
207  if (this->degree < fe_q_other->degree)
209  else if (this->degree == fe_q_other->degree)
211  else
213  }
214  else if (const FE_Nothing<dim, spacedim> *fe_nothing =
215  dynamic_cast<const FE_Nothing<dim, spacedim> *>(&fe_other))
216  {
217  if (fe_nothing->is_dominating())
219  else
220  // the FE_Nothing has no degrees of freedom and it is typically used
221  // in a context where we don't require any continuity along the
222  // interface
224  }
225 
226  Assert(false, ExcNotImplemented());
228 }
229 
230 
231 
232 template <int dim, int spacedim>
233 std::vector<std::pair<unsigned int, unsigned int>>
235  const FiniteElement<dim, spacedim> &fe_other) const
236 {
237  (void)fe_other;
238 
239  Assert((dynamic_cast<const FE_SimplexP<dim, spacedim> *>(&fe_other)) ||
240  (dynamic_cast<const FE_Q<dim, spacedim> *>(&fe_other)),
242 
243  return {{0, 0}};
244 }
245 
246 
247 
248 template <int dim, int spacedim>
249 std::vector<std::pair<unsigned int, unsigned int>>
251  const FiniteElement<dim, spacedim> &fe_other) const
252 {
253  (void)fe_other;
254 
255  Assert((dynamic_cast<const FE_SimplexP<dim, spacedim> *>(&fe_other)) ||
256  (dynamic_cast<const FE_Q<dim, spacedim> *>(&fe_other)),
258 
259  std::vector<std::pair<unsigned int, unsigned int>> result;
260 
261  for (unsigned int i = 0; i < this->degree - 1; ++i)
262  result.emplace_back(i, i);
263 
264  return result;
265 }
266 
267 
268 
269 template <int dim, int spacedim>
270 std::vector<std::pair<unsigned int, unsigned int>>
272  const FiniteElement<dim, spacedim> &fe_other,
273  const unsigned int face_no) const
274 {
275  (void)fe_other;
276 
277 
278  AssertIndexRange(face_no, 5);
279 
280  if (face_no == 0)
281  {
282  Assert((dynamic_cast<const FE_Q<dim, spacedim> *>(&fe_other)),
284  }
285  else
286  {
287  Assert((dynamic_cast<const FE_SimplexP<dim, spacedim> *>(&fe_other)),
289  }
290 
291  std::vector<std::pair<unsigned int, unsigned int>> result;
292 
293  for (unsigned int i = 0; i < this->n_dofs_per_quad(face_no); ++i)
294  result.emplace_back(i, i);
295 
296  return result;
297 }
298 
299 
300 
301 template <int dim, int spacedim>
303  : FE_PyramidPoly<dim, spacedim>(degree,
304  get_dpo_vector_fe_pyramid_dgp(degree),
305  FiniteElementData<dim>::L2)
306 {}
307 
308 
309 
310 template <int dim, int spacedim>
311 std::unique_ptr<FiniteElement<dim, spacedim>>
313 {
314  return std::make_unique<FE_PyramidDGP<dim, spacedim>>(*this);
315 }
316 
317 
318 
319 template <int dim, int spacedim>
320 std::string
322 {
323  std::ostringstream namebuf;
324  namebuf << "FE_PyramidDGP<" << dim << ">(" << this->degree << ")";
325 
326  return namebuf.str();
327 }
328 
329 // explicit instantiations
330 #include "fe_pyramid_p.inst"
331 
std::vector< std::vector< unsigned int > > dofs_per_object_inclusive
Definition: fe_base.h:184
constexpr const ReferenceCell Pyramid
std::vector< std::vector< unsigned int > > object_index
Definition: fe_base.h:189
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1655
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
FE_PyramidPoly(const unsigned int degree, const internal::GenericDoFsPerObject &dpos, const typename FiniteElementData< dim >::Conformity conformity)
Definition: fe_pyramid_p.cc:76
internal::GenericDoFsPerObject expand(const unsigned int dim, const std::vector< unsigned int > &dofs_per_object, const ::ReferenceCell reference_cell)
Definition: fe_data.cc:25
std::vector< std::vector< unsigned int > > dofs_per_object_exclusive
Definition: fe_base.h:179
#define AssertIndexRange(index, range)
Definition: exceptions.h:1720
STL namespace.
unsigned int n_dofs_per_quad(unsigned int face_no=0) const
FE_PyramidDGP(const unsigned int degree)
std::vector< Point< dim > > unit_support_points
Definition: fe.h:2447
Definition: fe_q.h:548
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
std::unique_ptr< FiniteElement< dim, spacedim > > clone() const override
std::unique_ptr< FiniteElement< dim, spacedim > > clone() const override
#define Assert(cond, exc)
Definition: exceptions.h:1461
unsigned int vertex_indices[2]
Definition: grid_tools.cc:1256
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:404
std::vector< std::pair< unsigned int, unsigned int > > hp_vertex_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const override
std::string get_name() const override
const unsigned int dofs_per_cell
Definition: fe_base.h:420
const std::vector< Point< dim > > & get_unit_support_points() const
Definition: fe.cc:1049
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:403
FE_PyramidP(const unsigned int degree)
std::vector< std::vector< unsigned int > > first_object_index_on_face
Definition: fe_base.h:194
static ::ExceptionBase & ExcNotImplemented()
std::string get_name() const override
std::vector< std::pair< unsigned int, unsigned int > > hp_line_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const override
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
FiniteElementDomination::Domination compare_for_domination(const FiniteElement< dim, spacedim > &fe_other, const unsigned int codim) const override