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_q_iso_q1.cc
Go to the documentation of this file.
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 
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 
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>>(
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 
FE_DGQ
Definition: fe_dgq.h:112
FE_Nothing< dim >
FE_Q_iso_Q1::convert_generalized_support_point_values_to_dof_values
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
Polynomials
Definition: polynomial.h:41
FE_Q_iso_Q1::clone
virtual std::unique_ptr< FiniteElement< dim, spacedim > > clone() const override
Definition: fe_q_iso_q1.cc:101
StandardExceptions::ExcNotImplemented
static ::ExceptionBase & ExcNotImplemented()
FiniteElementData
Definition: fe_base.h:147
FE_Q_Base
Definition: fe_q_base.h:44
FE_Q_iso_Q1::FE_Q_iso_Q1
FE_Q_iso_Q1(const unsigned int n_subdivisions)
Definition: fe_q_iso_q1.cc:34
FE_Q_iso_Q1::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_q_iso_q1.cc:110
quadrature_lib.h
fe_nothing.h
FiniteElementDomination::either_element_can_dominate
@ either_element_can_dominate
Definition: fe_base.h:100
QIterated
Definition: quadrature.h:369
bool
FE_Q_iso_Q1
Definition: fe_q_iso_q1.h:113
FiniteElementDomination::no_requirements
@ no_requirements
Definition: fe_base.h:104
FE_Q_iso_Q1::get_name
virtual std::string get_name() const override
Definition: fe_q_iso_q1.cc:63
FiniteElementDomination::neither_element_dominates
@ neither_element_dominates
Definition: fe_base.h:96
FiniteElementDomination::other_element_dominates
@ other_element_dominates
Definition: fe_base.h:92
QTrapez
Definition: quadrature_lib.h:126
FiniteElementDomination::Domination
Domination
Definition: fe_base.h:83
StandardExceptions::ExcMessage
static ::ExceptionBase & ExcMessage(std::string arg1)
double
Utilities::dim_string
std::string dim_string(const int dim, const int spacedim)
Definition: utilities.cc:559
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
Polynomials::generate_complete_Lagrange_basis_on_subdivisions
std::vector< PiecewisePolynomial< double > > generate_complete_Lagrange_basis_on_subdivisions(const unsigned int n_subdivisions, const unsigned int base_degree)
Definition: polynomials_piecewise.cc:134
fe_dgq.h
TensorProductPolynomials
Definition: tensor_product_polynomials.h:74
AssertDimension
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1579
FE_Q_Base< TensorProductPolynomials< dim, Polynomials::PiecewisePolynomial< double > >, dim, dim >::initialize
void initialize(const std::vector< Point< 1 >> &support_points_1d)
Definition: fe_q_base.cc:425
FiniteElement
Definition: fe.h:648
Assert
#define Assert(cond, exc)
Definition: exceptions.h:1419
vector.h
StandardExceptions::ExcImpossibleInDim
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
FiniteElementDomination::this_element_dominates
@ this_element_dominates
Definition: fe_base.h:88
memory.h
Quadrature::get_points
const std::vector< Point< dim > > & get_points() const
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
Vector< double >
fe_q_iso_q1.h