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