Reference documentation for deal.II version Git 180c135554 2021-06-23 17:42:41 -0400
\(\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_wedge_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_wedge_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}, {3, 3, 4, 4, 4}, {6}};
46  dpo.object_index = {{}, {6}, {6}, {6}};
47  dpo.first_object_index_on_face = {{}, {3, 3, 4, 4, 4}, {3, 3, 4, 4, 4}};
48  }
49  else if (degree == 2)
50  {
51  dpo.dofs_per_object_exclusive = {{1}, {1}, {0, 0, 1, 1, 1}, {0}};
52  dpo.dofs_per_object_inclusive = {{1}, {3}, {6, 6, 9, 9, 9}, {18}};
53  dpo.object_index = {{}, {6}, {15, 15, 15, 16, 17}, {18}};
54  dpo.first_object_index_on_face = {{}, {3, 3, 4, 4, 4}, {6, 6, 8, 8, 8}};
55  }
56  else
57  {
58  Assert(false, ExcNotImplemented());
59  }
60 
61  return dpo;
62  }
63 
68  get_dpo_vector_fe_wedge_dgp(const unsigned int degree)
69  {
70  unsigned int n_dofs = 0;
71 
72  if (degree == 1)
73  n_dofs = 6;
74  else if (degree == 2)
75  n_dofs = 18;
76  else
77  Assert(false, ExcNotImplemented());
78 
79  return internal::expand(3, {{0, 0, 0, n_dofs}}, ReferenceCells::Wedge);
80  }
81 } // namespace
82 
83 template <int dim, int spacedim>
85  const unsigned int degree,
86  const internal::GenericDoFsPerObject & dpos,
87  const typename FiniteElementData<dim>::Conformity conformity)
88  : ::FE_Poly<dim, spacedim>(
89  ScalarLagrangePolynomialWedge<dim>(degree),
90  FiniteElementData<dim>(dpos,
92  1,
93  degree,
94  conformity),
95  std::vector<bool>(
96  FiniteElementData<dim>(dpos, ReferenceCells::Wedge, 1, degree)
97  .dofs_per_cell,
98  true),
99  std::vector<ComponentMask>(
100  FiniteElementData<dim>(dpos, ReferenceCells::Wedge, 1, degree)
101  .dofs_per_cell,
102  std::vector<bool>(1, true)))
103 {
104  AssertDimension(dim, 3);
105 
106  if (degree == 1)
107  {
108  this->unit_support_points.emplace_back(0.0, 0.0, 0.0);
109  this->unit_support_points.emplace_back(1.0, 0.0, 0.0);
110  this->unit_support_points.emplace_back(0.0, 1.0, 0.0);
111  this->unit_support_points.emplace_back(0.0, 0.0, 1.0);
112  this->unit_support_points.emplace_back(1.0, 0.0, 1.0);
113  this->unit_support_points.emplace_back(0.0, 1.0, 1.0);
114  }
115 }
116 
117 
118 
119 template <int dim, int spacedim>
120 FE_WedgeP<dim, spacedim>::FE_WedgeP(const unsigned int degree)
121  : FE_WedgePoly<dim, spacedim>(degree,
122  get_dpo_vector_fe_wedge_p(degree),
123  FiniteElementData<dim>::H1)
124 {}
125 
126 
127 
128 template <int dim, int spacedim>
129 std::unique_ptr<FiniteElement<dim, spacedim>>
131 {
132  return std::make_unique<FE_WedgeP<dim, spacedim>>(*this);
133 }
134 
135 
136 
137 template <int dim, int spacedim>
138 std::string
140 {
141  std::ostringstream namebuf;
142  namebuf << "FE_WedgeP<" << dim << ">(" << this->degree << ")";
143 
144  return namebuf.str();
145 }
146 
147 
148 
149 template <int dim, int spacedim>
152  const FiniteElement<dim, spacedim> &fe_other,
153  const unsigned int codim) const
154 {
155  Assert(codim <= dim, ExcImpossibleInDim(dim));
156 
157  // vertex/line/face domination
158  // (if fe_other is derived from FE_SimplexDGP)
159  // ------------------------------------
160  if (codim > 0)
161  if (dynamic_cast<const FE_SimplexDGP<dim, spacedim> *>(&fe_other) !=
162  nullptr)
163  // there are no requirements between continuous and discontinuous
164  // elements
166 
167 
168  // vertex/line/face domination
169  // (if fe_other is not derived from FE_SimplexDGP)
170  // & cell domination
171  // ----------------------------------------
172  if (const FE_WedgeP<dim, spacedim> *fe_wp_other =
173  dynamic_cast<const FE_WedgeP<dim, spacedim> *>(&fe_other))
174  {
175  if (this->degree < fe_wp_other->degree)
177  else if (this->degree == fe_wp_other->degree)
179  else
181  }
182  else if (const FE_SimplexP<dim, spacedim> *fe_p_other =
183  dynamic_cast<const FE_SimplexP<dim, spacedim> *>(&fe_other))
184  {
185  if (this->degree < fe_p_other->degree)
187  else if (this->degree == fe_p_other->degree)
189  else
191  }
192  else if (const FE_Q<dim, spacedim> *fe_q_other =
193  dynamic_cast<const FE_Q<dim, spacedim> *>(&fe_other))
194  {
195  if (this->degree < fe_q_other->degree)
197  else if (this->degree == fe_q_other->degree)
199  else
201  }
202  else if (const FE_Nothing<dim> *fe_nothing =
203  dynamic_cast<const FE_Nothing<dim> *>(&fe_other))
204  {
205  if (fe_nothing->is_dominating())
207  else
208  // the FE_Nothing has no degrees of freedom and it is typically used
209  // in a context where we don't require any continuity along the
210  // interface
212  }
213 
214  Assert(false, ExcNotImplemented());
216 }
217 
218 
219 
220 template <int dim, int spacedim>
221 std::vector<std::pair<unsigned int, unsigned int>>
223  const FiniteElement<dim, spacedim> &fe_other) const
224 {
225  (void)fe_other;
226 
227  Assert((dynamic_cast<const FE_SimplexP<dim, spacedim> *>(&fe_other)) ||
228  (dynamic_cast<const FE_Q<dim, spacedim> *>(&fe_other)),
230 
231  return {{0, 0}};
232 }
233 
234 
235 
236 template <int dim, int spacedim>
237 std::vector<std::pair<unsigned int, unsigned int>>
239  const FiniteElement<dim, spacedim> &fe_other) const
240 {
241  (void)fe_other;
242 
243  Assert((dynamic_cast<const FE_SimplexP<dim, spacedim> *>(&fe_other)) ||
244  (dynamic_cast<const FE_Q<dim, spacedim> *>(&fe_other)),
246 
247  std::vector<std::pair<unsigned int, unsigned int>> result;
248 
249  for (unsigned int i = 0; i < this->degree - 1; ++i)
250  result.emplace_back(i, i);
251 
252  return result;
253 }
254 
255 
256 
257 template <int dim, int spacedim>
258 std::vector<std::pair<unsigned int, unsigned int>>
260  const FiniteElement<dim, spacedim> &fe_other,
261  const unsigned int face_no) const
262 {
263  (void)fe_other;
264 
265  AssertIndexRange(face_no, 5);
266 
267  if (face_no < 2)
268  {
269  Assert((dynamic_cast<const FE_SimplexP<dim, spacedim> *>(&fe_other)),
271  }
272  else
273  {
274  Assert((dynamic_cast<const FE_Q<dim, spacedim> *>(&fe_other)),
276  }
277 
278  std::vector<std::pair<unsigned int, unsigned int>> result;
279 
280  for (unsigned int i = 0; i < this->n_dofs_per_quad(face_no); ++i)
281  result.emplace_back(i, i);
282 
283  return result;
284 }
285 
286 
287 
288 template <int dim, int spacedim>
289 FE_WedgeDGP<dim, spacedim>::FE_WedgeDGP(const unsigned int degree)
290  : FE_WedgePoly<dim, spacedim>(degree,
291  get_dpo_vector_fe_wedge_dgp(degree),
292  FiniteElementData<dim>::L2)
293 {}
294 
295 
296 
297 template <int dim, int spacedim>
298 std::unique_ptr<FiniteElement<dim, spacedim>>
300 {
301  return std::make_unique<FE_WedgeDGP<dim, spacedim>>(*this);
302 }
303 
304 
305 
306 template <int dim, int spacedim>
307 std::string
309 {
310  std::ostringstream namebuf;
311  namebuf << "FE_WedgeDGP<" << dim << ">(" << this->degree << ")";
312 
313  return namebuf.str();
314 }
315 
316 // explicit instantiations
317 #include "fe_wedge_p.inst"
318 
std::vector< std::vector< unsigned int > > dofs_per_object_inclusive
Definition: fe_base.h:183
FE_WedgeP(const unsigned int degree)
Definition: fe_wedge_p.cc:120
std::vector< std::vector< unsigned int > > object_index
Definition: fe_base.h:188
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1657
std::string get_name() const override
Definition: fe_wedge_p.cc:308
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:178
#define AssertIndexRange(index, range)
Definition: exceptions.h:1722
STL namespace.
unsigned int n_dofs_per_quad(unsigned int face_no=0) const
std::string get_name() const override
Definition: fe_wedge_p.cc:139
std::vector< std::pair< unsigned int, unsigned int > > hp_vertex_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const override
Definition: fe_wedge_p.cc:222
std::vector< Point< dim > > unit_support_points
Definition: fe.h:2442
constexpr const ReferenceCell Wedge
Definition: fe_q.h:548
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
#define Assert(cond, exc)
Definition: exceptions.h:1465
FE_WedgeDGP(const unsigned int degree)
Definition: fe_wedge_p.cc:289
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:399
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
Definition: fe_wedge_p.cc:259
std::vector< std::pair< unsigned int, unsigned int > > hp_line_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const override
Definition: fe_wedge_p.cc:238
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:398
FiniteElementDomination::Domination compare_for_domination(const FiniteElement< dim, spacedim > &fe_other, const unsigned int codim) const override
Definition: fe_wedge_p.cc:151
std::unique_ptr< FiniteElement< dim, spacedim > > clone() const override
Definition: fe_wedge_p.cc:299
std::vector< std::vector< unsigned int > > first_object_index_on_face
Definition: fe_base.h:193
static ::ExceptionBase & ExcNotImplemented()
FE_WedgePoly(const unsigned int degree, const internal::GenericDoFsPerObject &dpos, const typename FiniteElementData< dim >::Conformity conformity)
Definition: fe_wedge_p.cc:84
std::unique_ptr< FiniteElement< dim, spacedim > > clone() const override
Definition: fe_wedge_p.cc:130