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