From 5e1122b14aa175c27f5db232d8491610edbebfda Mon Sep 17 00:00:00 2001 From: David Wells Date: Sun, 28 Jan 2018 18:50:45 -0500 Subject: [PATCH] Improve a check for the mapping degree. --- source/grid/grid_tools.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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); -- 2.39.5