Reference documentation for deal.II version 9.3.3
\(\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>
22
23#include <deal.II/lac/vector.h>
24
25#include <memory>
26#include <sstream>
27#include <vector>
28
30
31
32
33template <int dim, int spacedim>
34FE_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
58template <int dim, int spacedim>
59std::string
61{
62 // note that the FETools::get_fe_by_name function depends on the
63 // particular format of the string this function returns, so they have to be
64 // kept in sync
65
66 std::ostringstream namebuf;
67 namebuf << "FE_Q_iso_Q1<" << Utilities::dim_string(dim, spacedim) << ">("
68 << this->degree << ")";
69 return namebuf.str();
70}
71
72
73
74template <int dim, int spacedim>
75void
78 const std::vector<Vector<double>> &support_point_values,
79 std::vector<double> & nodal_values) const
80{
81 AssertDimension(support_point_values.size(),
82 this->get_unit_support_points().size());
83 AssertDimension(support_point_values.size(), nodal_values.size());
84 AssertDimension(this->n_dofs_per_cell(), nodal_values.size());
85
86 for (unsigned int i = 0; i < this->n_dofs_per_cell(); ++i)
87 {
88 AssertDimension(support_point_values[i].size(), 1);
89
90 nodal_values[i] = support_point_values[i](0);
91 }
92}
93
94
95
96template <int dim, int spacedim>
97std::unique_ptr<FiniteElement<dim, spacedim>>
99{
100 return std::make_unique<FE_Q_iso_Q1<dim, spacedim>>(*this);
101}
102
103
104
105template <int dim, int spacedim>
108 const FiniteElement<dim, spacedim> &fe_other,
109 const unsigned int codim) const
110{
111 Assert(codim <= dim, ExcImpossibleInDim(dim));
112 (void)codim;
113
114 // vertex/line/face domination
115 // (if fe_other is derived from FE_DGQ)
116 // ------------------------------------
117 if (codim > 0)
118 if (dynamic_cast<const FE_DGQ<dim, spacedim> *>(&fe_other) != nullptr)
119 // there are no requirements between continuous and discontinuous elements
121
122 // vertex/line/face domination
123 // (if fe_other is not derived from FE_DGQ)
124 // & cell domination
125 // ----------------------------------------
126 if (const FE_Q_iso_Q1<dim, spacedim> *fe_q_iso_q1_other =
127 dynamic_cast<const FE_Q_iso_Q1<dim, spacedim> *>(&fe_other))
128 {
129 // different behavior as in FE_Q: as FE_Q_iso_Q1(2) is not a subspace of
130 // FE_Q_iso_Q1(3), need that the element degrees are multiples of each
131 // other
132 if (this->degree < fe_q_iso_q1_other->degree &&
133 fe_q_iso_q1_other->degree % this->degree == 0)
135 else if (this->degree == fe_q_iso_q1_other->degree)
137 else if (this->degree > fe_q_iso_q1_other->degree &&
138 this->degree % fe_q_iso_q1_other->degree == 0)
140 else
142 }
143 else if (const FE_Nothing<dim> *fe_nothing =
144 dynamic_cast<const FE_Nothing<dim> *>(&fe_other))
145 {
146 if (fe_nothing->is_dominating())
148 else
149 // the FE_Nothing has no degrees of freedom and it is typically used
150 // in a context where we don't require any continuity along the
151 // interface
153 }
154
155 Assert(false, ExcNotImplemented());
157}
158
159
160// explicit instantiations
161#include "fe_q_iso_q1.inst"
162
Definition: fe_dgq.h:111
void initialize(const std::vector< Point< 1 > > &support_points_1d)
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:107
virtual std::string get_name() const override
Definition: fe_q_iso_q1.cc:60
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:77
virtual std::unique_ptr< FiniteElement< dim, spacedim > > clone() const override
Definition: fe_q_iso_q1.cc:98
FE_Q_iso_Q1(const unsigned int n_subdivisions)
Definition: fe_q_iso_q1.cc:34
const std::vector< Point< dim > > & get_points() const
Definition: vector.h:110
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:402
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:403
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
Definition: exceptions.h:1465
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1622
static ::ExceptionBase & ExcMessage(std::string arg1)
std::vector< unsigned int > get_dpo_vector(const unsigned int degree)
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:558
STL namespace.