Reference documentation for deal.II version 8.5.1
fe_q_iso_q1.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2000 - 2016 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/fe/fe_q_iso_q1.h>
19 #include <deal.II/fe/fe_nothing.h>
20 
21 #include <vector>
22 #include <sstream>
23 
24 DEAL_II_NAMESPACE_OPEN
25 
26 
27 
28 
29 
30 template <int dim, int spacedim>
31 FE_Q_iso_Q1<dim,spacedim>::FE_Q_iso_Q1 (const unsigned int subdivisions)
32  :
33  FE_Q_Base<TensorProductPolynomials<dim,Polynomials::PiecewisePolynomial<double> >, dim, spacedim> (
34  TensorProductPolynomials<dim,Polynomials::PiecewisePolynomial<double> >
35  (Polynomials::generate_complete_Lagrange_basis_on_subdivisions(subdivisions, 1)),
36  FiniteElementData<dim>(this->get_dpo_vector(subdivisions),
37  1, subdivisions,
38  FiniteElementData<dim>::H1),
39  std::vector<bool> (1, false))
40 {
41  Assert (subdivisions > 0,
42  ExcMessage ("This element can only be used with a positive number of "
43  "subelements"));
44 
45  QTrapez<1> trapez;
46  QIterated<1> points (trapez, subdivisions);
47 
48  this->initialize(points.get_points());
49 }
50 
51 
52 
53 template <int dim, int spacedim>
54 std::string
56 {
57  // note that the FETools::get_fe_by_name function depends on the
58  // particular format of the string this function returns, so they have to be
59  // kept in sync
60 
61  std::ostringstream namebuf;
62  namebuf << "FE_Q_iso_Q1<"
63  << Utilities::dim_string(dim,spacedim)
64  << ">(" << this->degree << ")";
65  return namebuf.str();
66 }
67 
68 
69 
70 template <int dim, int spacedim>
73 {
74  return new FE_Q_iso_Q1<dim,spacedim>(*this);
75 }
76 
77 
78 
79 template <int dim, int spacedim>
83 {
84  if (const FE_Q_iso_Q1<dim,spacedim> *fe_q_iso_q1_other
85  = dynamic_cast<const FE_Q_iso_Q1<dim,spacedim>*>(&fe_other))
86  {
87  // different behavior as in FE_Q: as FE_Q_iso_Q1(2) is not a subspace of
88  // FE_Q_iso_Q1(3), need that the element degrees are multiples of each
89  // other
90  if (this->degree < fe_q_iso_q1_other->degree &&
91  fe_q_iso_q1_other->degree % this->degree == 0)
93  else if (this->degree == fe_q_iso_q1_other->degree)
95  else if (this->degree > fe_q_iso_q1_other->degree &&
96  this->degree % fe_q_iso_q1_other->degree == 0)
98  else
100  }
101  else if (const FE_Nothing<dim> *fe_nothing = dynamic_cast<const FE_Nothing<dim>*>(&fe_other))
102  {
103  if (fe_nothing->is_dominating())
104  {
106  }
107  else
108  {
109  // the FE_Nothing has no degrees of freedom and it is typically used in
110  // a context where we don't require any continuity along the interface
112  }
113  }
114 
115  Assert (false, ExcNotImplemented());
117 }
118 
119 
120 // explicit instantiations
121 #include "fe_q_iso_q1.inst"
122 
123 DEAL_II_NAMESPACE_CLOSE
const std::vector< Point< dim > > & get_points() const
STL namespace.
static ::ExceptionBase & ExcMessage(std::string arg1)
virtual FiniteElement< dim, spacedim > * clone() const
Definition: fe_q_iso_q1.cc:72
#define Assert(cond, exc)
Definition: exceptions.h:313
std::string dim_string(const int dim, const int spacedim)
Definition: utilities.cc:161
FE_Q_iso_Q1(const unsigned int n_subdivisions)
Definition: fe_q_iso_q1.cc:31
virtual std::string get_name() const
Definition: fe_q_iso_q1.cc:55
static ::ExceptionBase & ExcNotImplemented()
virtual FiniteElementDomination::Domination compare_for_face_domination(const FiniteElement< dim, spacedim > &fe_other) const
Definition: fe_q_iso_q1.cc:82