Reference documentation for deal.II version 8.5.1
fe_nothing.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2009 - 2015 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 at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #include <deal.II/fe/fe_nothing.h>
18 
19 DEAL_II_NAMESPACE_OPEN
20 
21 namespace
22 {
23  const char *
24  zero_dof_message = "This element has no shape functions.";
25 }
26 
27 
28 
29 
30 template <int dim, int spacedim>
32  const bool dominate)
33  :
34  FiniteElement<dim,spacedim>
35  (FiniteElementData<dim>(std::vector<unsigned>(dim+1,0),
36  n_components, 0,
37  FiniteElementData<dim>::unknown),
38  std::vector<bool>(),
39  std::vector<ComponentMask>() ),
40  dominate(dominate)
41 {
42 // in most other elements we have to set up all sorts of stuff
43 // here. there isn't much that we have to do here; in particular,
44 // we can simply leave the restriction and prolongation matrices
45 // empty since their proper size is in fact zero given that the
46 // element here has no degrees of freedom
47 }
48 
49 
50 template <int dim, int spacedim>
53 {
54  return new FE_Nothing<dim,spacedim>(*this);
55 }
56 
57 
58 
59 template <int dim, int spacedim>
60 std::string
62 {
63  std::ostringstream namebuf;
64  namebuf << "FE_Nothing<" << dim << ">(";
65  if (this->n_components() > 1)
66  namebuf << this->n_components();
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  (void)zero_dof_message;
88  Assert(false,ExcMessage(zero_dof_message));
89  return 0;
90 }
91 
92 
93 
94 template <int dim, int spacedim>
97  const Mapping<dim,spacedim> &/*mapping*/,
98  const Quadrature<dim> &/*quadrature*/,
100 {
101  // Create a default data object. Normally we would then
102  // need to resize things to hold the appropriate numbers
103  // of dofs, but in this case all data fields are empty.
106  return data;
107 }
108 
109 
110 
111 template <int dim, int spacedim>
112 void
116  const Quadrature<dim> &,
117  const Mapping<dim,spacedim> &,
119  const ::internal::FEValues::MappingRelatedData<dim, spacedim> &,
122 {
123  // leave data fields empty
124 }
125 
126 
127 
128 template <int dim, int spacedim>
129 void
132  const unsigned int ,
133  const Quadrature<dim-1> &,
134  const Mapping<dim,spacedim> &,
136  const ::internal::FEValues::MappingRelatedData<dim, spacedim> &,
139 {
140  // leave data fields empty
141 }
142 
143 
144 
145 template <int dim, int spacedim>
146 void
149  const unsigned int ,
150  const unsigned int ,
151  const Quadrature<dim-1> &,
152  const Mapping<dim,spacedim> &,
154  const ::internal::FEValues::MappingRelatedData<dim, spacedim> &,
157 {
158  // leave data fields empty
159 }
160 
161 
162 
163 template <int dim, int spacedim>
164 bool
166 {
167  return dominate;
168 }
169 
170 
171 template <int dim, int spacedim>
175 {
176  // if FE_Nothing does not dominate, there are no requirements
177  if (!dominate)
178  {
180  }
181  // if it does and the other is FE_Nothing, either can dominate
182  else if (dynamic_cast<const FE_Nothing<dim>*>(&fe) != 0)
183  {
185  }
186  // otherwise we dominate whatever fe is provided
187  else
188  {
190  }
191 }
192 
193 
194 template <int dim, int spacedim>
195 std::vector<std::pair<unsigned int, unsigned int> >
198 {
199  // the FE_Nothing has no
200  // degrees of freedom, so there
201  // are no equivalencies to be
202  // recorded
203  return std::vector<std::pair<unsigned int, unsigned int> > ();
204 }
205 
206 
207 template <int dim, int spacedim>
208 std::vector<std::pair<unsigned int, unsigned int> >
211 {
212  // the FE_Nothing has no
213  // degrees of freedom, so there
214  // are no equivalencies to be
215  // recorded
216  return std::vector<std::pair<unsigned int, unsigned int> > ();
217 }
218 
219 
220 template <int dim, int spacedim>
221 std::vector<std::pair<unsigned int, unsigned int> >
224 {
225  // the FE_Nothing has no
226  // degrees of freedom, so there
227  // are no equivalencies to be
228  // recorded
229  return std::vector<std::pair<unsigned int, unsigned int> > ();
230 }
231 
232 
233 template <int dim, int spacedim>
234 bool
237 {
238  return true;
239 }
240 
241 
242 template <int dim, int spacedim>
243 void
246  FullMatrix<double> &interpolation_matrix) const
247 {
248  // since this element has no face dofs, the
249  // interpolation matrix is necessarily empty
250  (void)interpolation_matrix;
251 
252  Assert (interpolation_matrix.m() == 0,
253  ExcDimensionMismatch (interpolation_matrix.m(),
254  0));
255  Assert (interpolation_matrix.n() == 0,
256  ExcDimensionMismatch (interpolation_matrix.m(),
257  0));
258 }
259 
260 
261 template <int dim, int spacedim>
262 void
265  const unsigned int /*index*/,
266  FullMatrix<double> &interpolation_matrix) const
267 {
268  // since this element has no face dofs, the
269  // interpolation matrix is necessarily empty
270 
271  (void)interpolation_matrix;
272  Assert (interpolation_matrix.m() == 0,
273  ExcDimensionMismatch (interpolation_matrix.m(),
274  0));
275  Assert (interpolation_matrix.n() == 0,
276  ExcDimensionMismatch (interpolation_matrix.m(),
277  0));
278 }
279 
280 
281 
282 // explicit instantiations
283 #include "fe_nothing.inst"
284 
285 
286 DEAL_II_NAMESPACE_CLOSE
287 
bool is_dominating() const
Definition: fe_nothing.cc:165
size_type m() const
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const
Definition: fe_nothing.cc:75
virtual double shape_value(const unsigned int i, const Point< dim > &p) const
Definition: fe_nothing.cc:84
STL namespace.
static ::ExceptionBase & ExcMessage(std::string arg1)
size_type n() const
#define Assert(cond, exc)
Definition: exceptions.h:313
UpdateFlags
virtual void get_face_interpolation_matrix(const FiniteElement< dim, spacedim > &source_fe, FullMatrix< double > &interpolation_matrix) const
Definition: fe_nothing.cc:245
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
Abstract base class for mapping classes.
Definition: dof_tools.h:46
virtual FiniteElement< dim, spacedim > * clone() const
Definition: fe_nothing.cc:52
virtual bool hp_constraints_are_implemented() const
Definition: fe_nothing.cc:236
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_line_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
Definition: fe_nothing.cc:210
virtual std::string get_name() const
Definition: fe_nothing.cc:61
virtual void get_subface_interpolation_matrix(const FiniteElement< dim, spacedim > &source_fe, const unsigned int index, FullMatrix< double > &interpolation_matrix) const
Definition: fe_nothing.cc:264
FE_Nothing(const unsigned int n_components=1, const bool dominate=false)
Definition: fe_nothing.cc:31
virtual FiniteElementDomination::Domination compare_for_face_domination(const FiniteElement< dim, spacedim > &fe_other) const
Definition: fe_nothing.cc:174
unsigned int n_components(const DoFHandler< dim, spacedim > &dh)
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_quad_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
Definition: fe_nothing.cc:223
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_vertex_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
Definition: fe_nothing.cc:197
virtual FiniteElement< dim, spacedim >::InternalDataBase * get_data(const UpdateFlags update_flags, const Mapping< dim, spacedim > &mapping, const Quadrature< dim > &quadrature, ::internal::FEValues::FiniteElementRelatedData< dim, spacedim > &output_data) const
Definition: fe_nothing.cc:96