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