]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Improve a check for the mapping degree.
authorDavid Wells <wellsd2@rpi.edu>
Sun, 28 Jan 2018 23:50:45 +0000 (18:50 -0500)
committerDavid Wells <wellsd2@rpi.edu>
Sat, 3 Feb 2018 18:22:43 +0000 (13:22 -0500)
source/grid/grid_tools.cc

index 283c612b6a63c1843f625a2b2134b74beba77a48..6eef34a4b55619323fd8fc8b55047aaa8f72a304 100644 (file)
@@ -128,10 +128,11 @@ namespace GridTools
           const Mapping<dim,spacedim> &mapping)
   {
     // get the degree of the mapping if possible. if not, just assume 1
-    const unsigned int mapping_degree
-      = (dynamic_cast<const MappingQ<dim,spacedim>*>(&mapping) != nullptr ?
-         dynamic_cast<const MappingQ<dim,spacedim>*>(&mapping)->get_degree() :
-         1);
+    unsigned int mapping_degree = 1;
+    if (const auto *p = dynamic_cast<const MappingQGeneric<dim,spacedim>*>(&mapping))
+      mapping_degree = p->get_degree();
+    else if (const auto *p = dynamic_cast<const MappingQ<dim,spacedim>*>(&mapping))
+      mapping_degree = p->get_degree();
 
     // then initialize an appropriate quadrature formula
     const QGauss<dim> quadrature_formula (mapping_degree + 1);

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.