Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
fe_q_iso_q1.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2000 - 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 
17 #include <deal.II/base/quadrature_lib.h>
18 #include <deal.II/base/std_cxx14/memory.h>
19 
20 #include <deal.II/fe/fe_dgq.h>
21 #include <deal.II/fe/fe_nothing.h>
22 #include <deal.II/fe/fe_q_iso_q1.h>
23 
24 #include <deal.II/lac/vector.h>
25 
26 #include <sstream>
27 #include <vector>
28 
29 DEAL_II_NAMESPACE_OPEN
30 
31 
32 
33 template <int dim, int spacedim>
34 FE_Q_iso_Q1<dim, spacedim>::FE_Q_iso_Q1(const unsigned int subdivisions)
35  : FE_Q_Base<
36  TensorProductPolynomials<dim, Polynomials::PiecewisePolynomial<double>>,
37  dim,
38  spacedim>(
39  TensorProductPolynomials<dim, Polynomials::PiecewisePolynomial<double>>(
40  Polynomials::generate_complete_Lagrange_basis_on_subdivisions(
41  subdivisions,
42  1)),
43  FiniteElementData<dim>(this->get_dpo_vector(subdivisions),
44  1,
45  subdivisions,
46  FiniteElementData<dim>::H1),
47  std::vector<bool>(1, false))
48 {
49  Assert(subdivisions > 0,
50  ExcMessage("This element can only be used with a positive number of "
51  "subelements"));
52 
53  QTrapez<1> trapez;
54  QIterated<1> points(trapez, subdivisions);
55 
56  this->initialize(points.get_points());
57 }
58 
59 
60 
61 template <int dim, int spacedim>
62 std::string
64 {
65  // note that the FETools::get_fe_by_name function depends on the
66  // particular format of the string this function returns, so they have to be
67  // kept in sync
68 
69  std::ostringstream namebuf;
70  namebuf << "FE_Q_iso_Q1<" << Utilities::dim_string(dim, spacedim) << ">("
71  << this->degree << ")";
72  return namebuf.str();
73 }
74 
75 
76 
77 template <int dim, int spacedim>
78 void
81  const std::vector<Vector<double>> &support_point_values,
82  std::vector<double> & nodal_values) const
83 {
84  AssertDimension(support_point_values.size(),
85  this->get_unit_support_points().size());
86  AssertDimension(support_point_values.size(), nodal_values.size());
87  AssertDimension(this->dofs_per_cell, nodal_values.size());
88 
89  for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
90  {
91  AssertDimension(support_point_values[i].size(), 1);
92 
93  nodal_values[i] = support_point_values[i](0);
94  }
95 }
96 
97 
98 
99 template <int dim, int spacedim>
100 std::unique_ptr<FiniteElement<dim, spacedim>>
102 {
103  return std_cxx14::make_unique<FE_Q_iso_Q1<dim, spacedim>>(*this);
104 }
105 
106 
107 
108 template <int dim, int spacedim>
111  const FiniteElement<dim, spacedim> &fe_other,
112  const unsigned int codim) const
113 {
114  Assert(codim <= dim, ExcImpossibleInDim(dim));
115  (void)codim;
116 
117  // vertex/line/face domination
118  // (if fe_other is derived from FE_DGQ)
119  // ------------------------------------
120  if (codim > 0)
121  if (dynamic_cast<const FE_DGQ<dim, spacedim> *>(&fe_other) != nullptr)
122  // there are no requirements between continuous and discontinuous elements
124 
125  // vertex/line/face domination
126  // (if fe_other is not derived from FE_DGQ)
127  // & cell domination
128  // ----------------------------------------
129  if (const FE_Q_iso_Q1<dim, spacedim> *fe_q_iso_q1_other =
130  dynamic_cast<const FE_Q_iso_Q1<dim, spacedim> *>(&fe_other))
131  {
132  // different behavior as in FE_Q: as FE_Q_iso_Q1(2) is not a subspace of
133  // FE_Q_iso_Q1(3), need that the element degrees are multiples of each
134  // other
135  if (this->degree < fe_q_iso_q1_other->degree &&
136  fe_q_iso_q1_other->degree % this->degree == 0)
138  else if (this->degree == fe_q_iso_q1_other->degree)
140  else if (this->degree > fe_q_iso_q1_other->degree &&
141  this->degree % fe_q_iso_q1_other->degree == 0)
143  else
145  }
146  else if (const FE_Nothing<dim> *fe_nothing =
147  dynamic_cast<const FE_Nothing<dim> *>(&fe_other))
148  {
149  if (fe_nothing->is_dominating())
151  else
152  // the FE_Nothing has no degrees of freedom and it is typically used
153  // in a context where we don't require any continuity along the
154  // interface
156  }
157 
158  Assert(false, ExcNotImplemented());
160 }
161 
162 
163 // explicit instantiations
164 #include "fe_q_iso_q1.inst"
165 
166 DEAL_II_NAMESPACE_CLOSE
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
Definition: fe_q_iso_q1.cc:80
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1567
const std::vector< Point< dim > > & get_points() const
Definition: fe_dgq.h:109
STL namespace.
virtual std::string get_name() const override
Definition: fe_q_iso_q1.cc:63
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
#define Assert(cond, exc)
Definition: exceptions.h:1407
std::string dim_string(const int dim, const int spacedim)
Definition: utilities.cc:457
virtual std::unique_ptr< FiniteElement< dim, spacedim > > clone() const override
Definition: fe_q_iso_q1.cc:101
FE_Q_iso_Q1(const unsigned int n_subdivisions)
Definition: fe_q_iso_q1.cc:34
static ::ExceptionBase & ExcNotImplemented()
virtual FiniteElementDomination::Domination compare_for_domination(const FiniteElement< dim, spacedim > &fe_other, const unsigned int codim=0) const override final
Definition: fe_q_iso_q1.cc:110