]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use consistent exception name for FE_Q of degree 0. 2556/head
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 26 Apr 2016 12:42:42 +0000 (14:42 +0200)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 26 Apr 2016 12:42:42 +0000 (14:42 +0200)
include/deal.II/fe/fe_q_base.h
source/fe/fe_q.cc
source/fe/fe_q_base.cc
tests/fe/fe_q_01.output

index 601189dea15fdb7d5ba30ac14461d7410be6f7f7..6d03628a2770038886746ae59d22c0859ea7c8e0 100644 (file)
@@ -267,6 +267,17 @@ public:
   compare_for_face_domination (const FiniteElement<dim,spacedim> &fe_other) const;
   //@}
 
+  /**
+   * Attempt to construct an FE_Q object of degree 0
+   *
+   * @ingroup Exceptions
+   */
+  DeclExceptionMsg (ExcFEQCannotHaveDegree0,
+                    "FE_Q can only be used for polynomial degrees "
+                    "greater than zero. If you want an element of polynomial "
+                    "degree zero, then it cannot be continuous and you "
+                    "will want to use FE_DGQ<dim>(0).");
+
 protected:
   /**
    * Only for internal use. Its full name is @p get_dofs_per_object_vector
index a4c969dee57945e4198668a1c4670df3d3df1911..343d5f58397d9f96340cdf24af6cfecfe55721fd 100644 (file)
@@ -25,17 +25,17 @@ DEAL_II_NAMESPACE_OPEN
 
 namespace
 {
+  template <int dim, int spacedim>
   std::vector<Point<1> >
   get_QGaussLobatto_points (const unsigned int degree)
   {
     if (degree > 0)
       return QGaussLobatto<1>(degree+1).get_points();
     else
-      AssertThrow(false,
-                  ExcMessage ("FE_Q can only be used for polynomial degrees "
-                              "greater than zero. If you want an element of polynomial "
-                              "degree zero, then it cannot be continuous and you "
-                              "will want to use FE_DGQ<dim>(0)."));
+      {
+        typedef FE_Q_Base<TensorProductPolynomials<dim>, dim, spacedim> FEQ;
+        AssertThrow(false, typename FEQ::ExcFEQCannotHaveDegree0());
+      }
     return std::vector<Point<1> >();
   }
 }
@@ -46,13 +46,13 @@ template <int dim, int spacedim>
 FE_Q<dim,spacedim>::FE_Q (const unsigned int degree)
   :
   FE_Q_Base<TensorProductPolynomials<dim>, dim, spacedim>
-  (TensorProductPolynomials<dim>(Polynomials::generate_complete_Lagrange_basis(get_QGaussLobatto_points(degree))),
+  (TensorProductPolynomials<dim>(Polynomials::generate_complete_Lagrange_basis(get_QGaussLobatto_points<dim,spacedim>(degree))),
    FiniteElementData<dim>(this->get_dpo_vector(degree),
                           1, degree,
                           FiniteElementData<dim>::H1),
    std::vector<bool> (1, false))
 {
-  this->initialize(get_QGaussLobatto_points(degree));
+  this->initialize(get_QGaussLobatto_points<dim,spacedim>(degree));
 }
 
 
@@ -67,12 +67,6 @@ FE_Q<dim,spacedim>::FE_Q (const Quadrature<1> &points)
                            FiniteElementData<dim>::H1),
     std::vector<bool> (1, false))
 {
-  const unsigned int degree = points.size()-1;
-  (void)degree;
-  Assert (degree > 0,
-          ExcMessage ("This element can only be used for polynomial degrees "
-                      "at least zero"));
-
   this->initialize(points.get_points());
 }
 
index a521c6c5b8a748b0820edc4dbb8b2a8ff557d79c..dcb28803f227ded9d8eec8e9aff45d52b974d722 100644 (file)
@@ -1118,12 +1118,12 @@ face_to_cell_index (const unsigned int face_index,
 
 template <class PolynomialType, int dim, int spacedim>
 std::vector<unsigned int>
-FE_Q_Base<PolynomialType,dim,spacedim>::get_dpo_vector(const unsigned int deg)
+FE_Q_Base<PolynomialType,dim,spacedim>::get_dpo_vector(const unsigned int degree)
 {
-  AssertThrow(deg>0,ExcMessage("FE_Q needs to be of degree > 0."));
+  AssertThrow(degree>0, ExcFEQCannotHaveDegree0());
   std::vector<unsigned int> dpo(dim+1, 1U);
   for (unsigned int i=1; i<dpo.size(); ++i)
-    dpo[i]=dpo[i-1]*(deg-1);
+    dpo[i]=dpo[i-1]*(degree-1);
   return dpo;
 }
 
index a776d6f09a778b437a7ab4a598193c8991d36db1..158d3d7463c8f210b019a2c578ad4e337ed5d971 100644 (file)
@@ -1,2 +1,2 @@
 
-DEAL::ExcMessage("FE_Q needs to be of degree > 0.")
+DEAL::ExcFEQCannotHaveDegree0()

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.