deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+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_nothing.cc
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2009 - 2026 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13
15
16#include <memory>
17
19
20
21template <int dim, int spacedim>
23 const unsigned int n_components,
24 const bool dominate)
25 : FiniteElement<dim, spacedim>(
26 FiniteElementData<dim>(std::vector<unsigned>(dim + 1, 0),
27 type,
28 n_components,
29 0,
30 FiniteElementData<dim>::unknown),
31 std::vector<bool>(),
32 std::vector<ComponentMask>())
33 , dominate(dominate)
34{
36 ExcMessage("A finite element needs to have at least one "
37 "vector component."));
38
39 // in most other elements we have to set up all sorts of stuff
40 // here. there isn't much that we have to do here; in particular,
41 // we can simply leave the restriction and prolongation matrices
42 // empty since their proper size is in fact zero given that the
43 // element here has no degrees of freedom
44}
45
46
47
48template <int dim, int spacedim>
49FE_Nothing<dim, spacedim>::FE_Nothing(const unsigned int n_components,
50 const bool dominate)
51 : FE_Nothing<dim, spacedim>(ReferenceCells::get_hypercube<dim>(),
52 n_components,
53 dominate)
54{}
55
56
57
58template <int dim, int spacedim>
59std::unique_ptr<FiniteElement<dim, spacedim>>
61{
62 return std::make_unique<FE_Nothing<dim, spacedim>>(*this);
63}
64
65
66
67template <int dim, int spacedim>
68std::string
70{
71 std::ostringstream namebuf;
72 namebuf << "FE_Nothing<" << Utilities::dim_string(dim, spacedim) << ">(";
73
74 std::vector<std::string> name_components;
75 if (this->reference_cell() != ReferenceCells::get_hypercube<dim>())
76 name_components.push_back(this->reference_cell().to_string());
77 if (this->n_components() > 1)
78 name_components.push_back(std::to_string(this->n_components()));
79 if (dominate)
80 name_components.emplace_back("dominating");
81
82 for (const std::string &comp : name_components)
83 {
84 namebuf << comp;
85 if (comp != name_components.back())
86 namebuf << ", ";
87 }
88 namebuf << ")";
89
90 return namebuf.str();
91}
92
93
94
95template <int dim, int spacedim>
98{
99 return flags;
100}
101
102
103
104template <int dim, int spacedim>
105double
107 const Point<dim> & /*p*/) const
108{
109 Assert(false, ExcMessage("This element has no shape functions."));
110 return 0;
111}
112
113
114
115template <int dim, int spacedim>
116std::unique_ptr<typename FiniteElement<dim, spacedim>::InternalDataBase>
118 const UpdateFlags /*update_flags*/,
119 const Mapping<dim, spacedim> & /*mapping*/,
120 const Quadrature<dim> & /*quadrature*/,
122 spacedim>
123 & /*output_data*/) const
124{
125 // Create a default data object. Normally we would then
126 // need to resize things to hold the appropriate numbers
127 // of dofs, but in this case all data fields are empty.
128 return std::make_unique<
130}
131
132
133
134template <int dim, int spacedim>
135void
150
151
152
153template <int dim, int spacedim>
154void
169
171
172template <int dim, int spacedim>
173void
176 const unsigned int,
177 const unsigned int,
178 const Quadrature<dim - 1> &,
184 spacedim>
185 &) const
186{
187 // leave data fields empty
188}
189
190
191
192template <int dim, int spacedim>
193bool
195{
196 return dominate;
197}
198
199
201template <int dim, int spacedim>
205 const unsigned int codim) const
206{
207 Assert(codim <= dim, ExcImpossibleInDim(dim));
208
209 if (!dominate)
210 // if FE_Nothing does not dominate, there are no requirements
212 else if (dynamic_cast<const FE_Nothing<dim> *>(&fe) != nullptr)
213 // if it does and the other is FE_Nothing, either can dominate
215 else
216 // otherwise we dominate whatever FE is provided
218}
219
220
221
222template <int dim, int spacedim>
223std::vector<std::pair<unsigned int, unsigned int>>
225 const FiniteElement<dim, spacedim> & /*fe_other*/) const
226{
227 // the FE_Nothing has no
228 // degrees of freedom, so there
229 // are no equivalencies to be
230 // recorded
231 return std::vector<std::pair<unsigned int, unsigned int>>();
232}
233
234
235template <int dim, int spacedim>
236std::vector<std::pair<unsigned int, unsigned int>>
238 const FiniteElement<dim, spacedim> & /*fe_other*/) const
239{
240 // the FE_Nothing has no
241 // degrees of freedom, so there
242 // are no equivalencies to be
243 // recorded
244 return std::vector<std::pair<unsigned int, unsigned int>>();
245}
246
247
248template <int dim, int spacedim>
249std::vector<std::pair<unsigned int, unsigned int>>
251 const FiniteElement<dim, spacedim> & /*fe_other*/,
252 const unsigned int) const
253{
254 // the FE_Nothing has no
255 // degrees of freedom, so there
256 // are no equivalencies to be
257 // recorded
258 return std::vector<std::pair<unsigned int, unsigned int>>();
259}
260
261
262template <int dim, int spacedim>
263bool
269
270
271template <int dim, int spacedim>
272void
274 const FiniteElement<dim, spacedim> & /*source_fe*/,
275 FullMatrix<double> &interpolation_matrix) const
276{
277 // Since this element has no dofs,
278 // the interpolation matrix is necessarily empty.
279 Assert(interpolation_matrix.m() == 0,
280 ExcDimensionMismatch(interpolation_matrix.m(), 0));
281 Assert(interpolation_matrix.n() == 0,
282 ExcDimensionMismatch(interpolation_matrix.n(), 0));
283}
284
285
286
287template <int dim, int spacedim>
288void
290 const FiniteElement<dim, spacedim> & /*source_fe*/,
291 FullMatrix<double> &interpolation_matrix,
292 const unsigned int) const
294 // since this element has no face dofs, the
295 // interpolation matrix is necessarily empty
296 Assert(interpolation_matrix.m() == 0,
297 ExcDimensionMismatch(interpolation_matrix.m(), 0));
298 Assert(interpolation_matrix.n() == 0,
299 ExcDimensionMismatch(interpolation_matrix.m(), 0));
300}
302
303
304template <int dim, int spacedim>
305void
307 const FiniteElement<dim, spacedim> & /*source_fe*/,
308 const unsigned int /*index*/,
309 FullMatrix<double> &interpolation_matrix,
310 const unsigned int) const
311{
312 // since this element has no face dofs, the
313 // interpolation matrix is necessarily empty
314 Assert(interpolation_matrix.m() == 0,
315 ExcDimensionMismatch(interpolation_matrix.m(), 0));
316 Assert(interpolation_matrix.n() == 0,
317 ExcDimensionMismatch(interpolation_matrix.m(), 0));
318}
319
320
321
322template <int dim, int spacedim>
323std::pair<Table<2, bool>, std::vector<unsigned int>>
325{
326 // since this element has no dofs, there are no constant modes
327 return {Table<2, bool>{}, std::vector<unsigned int>{}};
328}
329
330
331
332// explicit instantiations
333#include "fe/fe_nothing.inst"
334
335
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_line_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const override
virtual std::string get_name() const override
Definition fe_nothing.cc:69
virtual void get_subface_interpolation_matrix(const FiniteElement< dim, spacedim > &source_fe, const unsigned int index, FullMatrix< double > &interpolation_matrix, const unsigned int face_no=0) const override
virtual std::unique_ptr< FiniteElement< dim, spacedim > > clone() const override
Definition fe_nothing.cc:60
virtual void get_face_interpolation_matrix(const FiniteElement< dim, spacedim > &source_fe, FullMatrix< double > &interpolation_matrix, const unsigned int face_no=0) const override
FE_Nothing(const ReferenceCell< dim > &type, const unsigned int n_components=1, const bool dominate=false)
Definition fe_nothing.cc:22
virtual void fill_fe_subface_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const unsigned int sub_no, const Quadrature< dim - 1 > &quadrature, const Mapping< dim, spacedim > &mapping, const typename Mapping< dim, spacedim >::InternalDataBase &mapping_internal, const internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &mapping_data, const typename FiniteElement< dim, spacedim >::InternalDataBase &fe_internal, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const override
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const override
Definition fe_nothing.cc:97
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_vertex_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const override
virtual double shape_value(const unsigned int i, const Point< dim > &p) const override
virtual void fill_fe_face_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const hp::QCollection< dim - 1 > &quadrature, const Mapping< dim, spacedim > &mapping, const typename Mapping< dim, spacedim >::InternalDataBase &mapping_internal, const internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &mapping_data, const typename FiniteElement< dim, spacedim >::InternalDataBase &fe_internal, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const override
virtual void get_interpolation_matrix(const FiniteElement< dim, spacedim > &source_fe, FullMatrix< double > &interpolation_matrix) const override
virtual FiniteElementDomination::Domination compare_for_domination(const FiniteElement< dim, spacedim > &fe_other, const unsigned int codim=0) const override final
virtual void fill_fe_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const CellSimilarity::Similarity cell_similarity, const Quadrature< dim > &quadrature, const Mapping< dim, spacedim > &mapping, const typename Mapping< dim, spacedim >::InternalDataBase &mapping_internal, const internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &mapping_data, const typename FiniteElement< dim, spacedim >::InternalDataBase &fe_internal, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const override
bool is_dominating() const
virtual std::unique_ptr< typename FiniteElement< dim, spacedim >::InternalDataBase > get_data(const UpdateFlags update_flags, const Mapping< dim, spacedim > &mapping, const Quadrature< dim > &quadrature, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const override
virtual bool hp_constraints_are_implemented() const override
virtual std::pair< Table< 2, bool >, std::vector< unsigned int > > get_constant_modes() const override
virtual 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
unsigned int n_components() const
size_type n() const
size_type m() const
Abstract base class for mapping classes.
Definition mapping.h:318
Definition point.h:111
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define Assert(cond, exc)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
UpdateFlags
std::string dim_string(const int dim, const int spacedim)
Definition utilities.cc:547
STL namespace.