Reference documentation for deal.II version 9.2.0
\(\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_nothing.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2009 - 2018 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 
18 
19 #include <deal.II/fe/fe_nothing.h>
20 
22 
23 
24 template <int dim, int spacedim>
26  const bool dominate)
27  : FiniteElement<dim, spacedim>(
28  FiniteElementData<dim>(std::vector<unsigned>(dim + 1, 0),
30  0,
31  FiniteElementData<dim>::unknown),
32  std::vector<bool>(),
33  std::vector<ComponentMask>())
34  , dominate(dominate)
35 {
36  // in most other elements we have to set up all sorts of stuff
37  // here. there isn't much that we have to do here; in particular,
38  // we can simply leave the restriction and prolongation matrices
39  // empty since their proper size is in fact zero given that the
40  // element here has no degrees of freedom
41 }
42 
43 
44 template <int dim, int spacedim>
45 std::unique_ptr<FiniteElement<dim, spacedim>>
47 {
48  return std_cxx14::make_unique<FE_Nothing<dim, spacedim>>(*this);
49 }
50 
51 
52 
53 template <int dim, int spacedim>
54 std::string
56 {
57  std::ostringstream namebuf;
58  namebuf << "FE_Nothing<" << dim << ">(";
59  if (this->n_components() > 1)
60  {
61  namebuf << this->n_components();
62  if (dominate)
63  namebuf << ", dominating";
64  }
65  else if (dominate)
66  namebuf << "dominating";
67  namebuf << ")";
68  return namebuf.str();
69 }
70 
71 
72 
73 template <int dim, int spacedim>
76 {
77  return flags;
78 }
79 
80 
81 
82 template <int dim, int spacedim>
83 double
84 FE_Nothing<dim, spacedim>::shape_value(const unsigned int /*i*/,
85  const Point<dim> & /*p*/) const
86 {
87  Assert(false, ExcMessage("This element has no shape functions."));
88  return 0;
89 }
90 
91 
92 
93 template <int dim, int spacedim>
94 std::unique_ptr<typename FiniteElement<dim, spacedim>::InternalDataBase>
96  const UpdateFlags /*update_flags*/,
97  const Mapping<dim, spacedim> & /*mapping*/,
98  const Quadrature<dim> & /*quadrature*/,
100  spacedim>
101  & /*output_data*/) const
102 {
103  // Create a default data object. Normally we would then
104  // need to resize things to hold the appropriate numbers
105  // of dofs, but in this case all data fields are empty.
106  return std_cxx14::make_unique<
108 }
109 
110 
111 
112 template <int dim, int spacedim>
113 void
117  const Quadrature<dim> &,
118  const Mapping<dim, spacedim> &,
120  const ::internal::FEValuesImplementation::MappingRelatedData<dim,
121  spacedim>
122  &,
125  spacedim>
126  &) const
127 {
128  // leave data fields empty
129 }
130 
131 
132 
133 template <int dim, int spacedim>
134 void
137  const unsigned int,
138  const Quadrature<dim - 1> &,
139  const Mapping<dim, spacedim> &,
141  const ::internal::FEValuesImplementation::MappingRelatedData<dim,
142  spacedim>
143  &,
146  spacedim>
147  &) const
148 {
149  // leave data fields empty
150 }
151 
152 
153 
154 template <int dim, int spacedim>
155 void
158  const unsigned int,
159  const unsigned int,
160  const Quadrature<dim - 1> &,
161  const Mapping<dim, spacedim> &,
163  const ::internal::FEValuesImplementation::MappingRelatedData<dim,
164  spacedim>
165  &,
168  spacedim>
169  &) const
170 {
171  // leave data fields empty
172 }
173 
174 
175 
176 template <int dim, int spacedim>
177 bool
179 {
180  return dominate;
181 }
182 
183 
184 
185 template <int dim, int spacedim>
186 bool
189 {
190  // Compare fields stored in the base class
191  if (!(this->FiniteElement<dim, spacedim>::operator==(f)))
192  return false;
193 
194  // Then make sure the other object is really of type FE_Nothing,
195  // and compare the data that has been passed to both objects'
196  // constructors.
197  if (const FE_Nothing<dim, spacedim> *f_nothing =
198  dynamic_cast<const FE_Nothing<dim, spacedim> *>(&f))
199  return ((dominate == f_nothing->dominate) &&
200  (this->components == f_nothing->components));
201  else
202  return false;
203 }
204 
205 
206 
207 template <int dim, int spacedim>
211  const unsigned int codim) const
212 {
213  Assert(codim <= dim, ExcImpossibleInDim(dim));
214  (void)codim;
215 
216  if (!dominate)
217  // if FE_Nothing does not dominate, there are no requirements
219  else if (dynamic_cast<const FE_Nothing<dim> *>(&fe) != nullptr)
220  // if it does and the other is FE_Nothing, either can dominate
222  else
223  // otherwise we dominate whatever fe is provided
225 }
226 
227 
228 template <int dim, int spacedim>
229 std::vector<std::pair<unsigned int, unsigned int>>
231  const FiniteElement<dim, spacedim> & /*fe_other*/) const
232 {
233  // the FE_Nothing has no
234  // degrees of freedom, so there
235  // are no equivalencies to be
236  // recorded
237  return std::vector<std::pair<unsigned int, unsigned int>>();
238 }
239 
240 
241 template <int dim, int spacedim>
242 std::vector<std::pair<unsigned int, unsigned int>>
244  const FiniteElement<dim, spacedim> & /*fe_other*/) const
245 {
246  // the FE_Nothing has no
247  // degrees of freedom, so there
248  // are no equivalencies to be
249  // recorded
250  return std::vector<std::pair<unsigned int, unsigned int>>();
251 }
252 
253 
254 template <int dim, int spacedim>
255 std::vector<std::pair<unsigned int, unsigned int>>
257  const FiniteElement<dim, spacedim> & /*fe_other*/) const
258 {
259  // the FE_Nothing has no
260  // degrees of freedom, so there
261  // are no equivalencies to be
262  // recorded
263  return std::vector<std::pair<unsigned int, unsigned int>>();
264 }
265 
266 
267 template <int dim, int spacedim>
268 bool
270 {
271  return true;
272 }
273 
274 
275 
276 template <int dim, int spacedim>
277 void
279  const FiniteElement<dim, spacedim> & /*source_fe*/,
280  FullMatrix<double> &interpolation_matrix) const
281 {
282  // Since this element has no dofs,
283  // the interpolation matrix is necessarily empty.
284  (void)interpolation_matrix;
285 
286  Assert(interpolation_matrix.m() == 0,
287  ExcDimensionMismatch(interpolation_matrix.m(), 0));
288  Assert(interpolation_matrix.n() == 0,
289  ExcDimensionMismatch(interpolation_matrix.n(), 0));
290 }
291 
292 
293 
294 template <int dim, int spacedim>
295 void
297  const FiniteElement<dim, spacedim> & /*source_fe*/,
298  FullMatrix<double> &interpolation_matrix) const
299 {
300  // since this element has no face dofs, the
301  // interpolation matrix is necessarily empty
302  (void)interpolation_matrix;
303 
304  Assert(interpolation_matrix.m() == 0,
305  ExcDimensionMismatch(interpolation_matrix.m(), 0));
306  Assert(interpolation_matrix.n() == 0,
307  ExcDimensionMismatch(interpolation_matrix.m(), 0));
308 }
309 
310 
311 template <int dim, int spacedim>
312 void
314  const FiniteElement<dim, spacedim> & /*source_fe*/,
315  const unsigned int /*index*/,
316  FullMatrix<double> &interpolation_matrix) const
317 {
318  // since this element has no face dofs, the
319  // interpolation matrix is necessarily empty
320 
321  (void)interpolation_matrix;
322  Assert(interpolation_matrix.m() == 0,
323  ExcDimensionMismatch(interpolation_matrix.m(), 0));
324  Assert(interpolation_matrix.n() == 0,
325  ExcDimensionMismatch(interpolation_matrix.m(), 0));
326 }
327 
328 
329 
330 // explicit instantiations
331 #include "fe_nothing.inst"
332 
333 
FE_Nothing::hp_quad_dof_identities
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_quad_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const override
Definition: fe_nothing.cc:256
FE_Nothing
Definition: fe_nothing.h:83
internal::FEValuesImplementation::FiniteElementRelatedData
Definition: fe_update_flags.h:524
FiniteElementData
Definition: fe_base.h:147
FullMatrix::m
size_type m() const
FE_Nothing::get_subface_interpolation_matrix
virtual void get_subface_interpolation_matrix(const FiniteElement< dim, spacedim > &source_fe, const unsigned int index, FullMatrix< double > &interpolation_matrix) const override
Definition: fe_nothing.cc:313
FE_Nothing::get_data
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
Definition: fe_nothing.cc:95
DoFHandler::n_components
unsigned int n_components(const DoFHandler< dim, spacedim > &dh)
ComponentMask
Definition: component_mask.h:83
CellSimilarity::Similarity
Similarity
Definition: fe_update_flags.h:378
FE_Nothing::get_interpolation_matrix
virtual void get_interpolation_matrix(const FiniteElement< dim, spacedim > &source_fe, FullMatrix< double > &interpolation_matrix) const override
Definition: fe_nothing.cc:278
FullMatrix::n
size_type n() const
FE_Nothing::get_face_interpolation_matrix
virtual void get_face_interpolation_matrix(const FiniteElement< dim, spacedim > &source_fe, FullMatrix< double > &interpolation_matrix) const override
Definition: fe_nothing.cc:296
FE_Nothing::requires_update_flags
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const override
Definition: fe_nothing.cc:75
FE_Nothing::fill_fe_face_values
virtual void fill_fe_face_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_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
Definition: fe_nothing.cc:135
fe_nothing.h
FiniteElementDomination::either_element_can_dominate
@ either_element_can_dominate
Definition: fe_base.h:100
FE_Nothing::hp_constraints_are_implemented
virtual bool hp_constraints_are_implemented() const override
Definition: fe_nothing.cc:269
bool
FiniteElementDomination::no_requirements
@ no_requirements
Definition: fe_base.h:104
FE_Nothing::fill_fe_subface_values
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
Definition: fe_nothing.cc:156
Mapping
Abstract base class for mapping classes.
Definition: mapping.h:302
FiniteElementDomination::Domination
Domination
Definition: fe_base.h:83
StandardExceptions::ExcMessage
static ::ExceptionBase & ExcMessage(std::string arg1)
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
FE_Nothing::get_name
virtual std::string get_name() const override
Definition: fe_nothing.cc:55
FE_Nothing::operator==
virtual bool operator==(const FiniteElement< dim, spacedim > &fe) const override
Definition: fe_nothing.cc:188
FiniteElement
Definition: fe.h:648
UpdateFlags
UpdateFlags
Definition: fe_update_flags.h:66
FE_Nothing::clone
virtual std::unique_ptr< FiniteElement< dim, spacedim > > clone() const override
Definition: fe_nothing.cc:46
Assert
#define Assert(cond, exc)
Definition: exceptions.h:1419
Mapping::InternalDataBase
Definition: mapping.h:597
StandardExceptions::ExcImpossibleInDim
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
FiniteElement::InternalDataBase
Definition: fe.h:682
StandardExceptions::ExcDimensionMismatch
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
Point< dim >
FiniteElementDomination::this_element_dominates
@ this_element_dominates
Definition: fe_base.h:88
FullMatrix< double >
memory.h
FE_Nothing::shape_value
virtual double shape_value(const unsigned int i, const Point< dim > &p) const override
Definition: fe_nothing.cc:84
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
FE_Nothing::fill_fe_values
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
Definition: fe_nothing.cc:114
Quadrature
Definition: quadrature.h:85
FE_Nothing::FE_Nothing
FE_Nothing(const unsigned int n_components=1, const bool dominate=false)
Definition: fe_nothing.cc:25
FE_Nothing::hp_line_dof_identities
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_line_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const override
Definition: fe_nothing.cc:243
TriaIterator
Definition: tria_iterator.h:578
FE_Nothing::is_dominating
bool is_dominating() const
Definition: fe_nothing.cc:178
FE_Nothing::compare_for_domination
virtual FiniteElementDomination::Domination compare_for_domination(const FiniteElement< dim, spacedim > &fe_other, const unsigned int codim=0) const override final
Definition: fe_nothing.cc:209
FE_Nothing::hp_vertex_dof_identities
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_vertex_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const override
Definition: fe_nothing.cc:230