From: David Wells Date: Sun, 28 Jan 2018 23:50:45 +0000 (-0500) Subject: Improve a check for the mapping degree. X-Git-Tag: v9.0.0-rc1~464^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e1122b14aa175c27f5db232d8491610edbebfda;p=dealii.git Improve a check for the mapping degree. --- diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 283c612b6a..6eef34a4b5 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -128,10 +128,11 @@ namespace GridTools const Mapping &mapping) { // get the degree of the mapping if possible. if not, just assume 1 - const unsigned int mapping_degree - = (dynamic_cast*>(&mapping) != nullptr ? - dynamic_cast*>(&mapping)->get_degree() : - 1); + unsigned int mapping_degree = 1; + if (const auto *p = dynamic_cast*>(&mapping)) + mapping_degree = p->get_degree(); + else if (const auto *p = dynamic_cast*>(&mapping)) + mapping_degree = p->get_degree(); // then initialize an appropriate quadrature formula const QGauss quadrature_formula (mapping_degree + 1);