From 005c17084b2f290651dddcb3db79d2bf869c4505 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 11 Sep 2024 18:24:24 +0500 Subject: [PATCH] dispatch_with_upgrade to use only upgrade types for optimization --- src/ifcgeom/AbstractKernel.h | 4 ++-- src/ifcgeom/taxonomy.h | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ifcgeom/AbstractKernel.h b/src/ifcgeom/AbstractKernel.h index f743d7c497..8c65643e24 100644 --- a/src/ifcgeom/AbstractKernel.h +++ b/src/ifcgeom/AbstractKernel.h @@ -105,7 +105,7 @@ namespace { template struct dispatch_with_upgrade { static bool dispatch(ifcopenshell::geometry::kernels::AbstractKernel* kernel, const ifcopenshell::geometry::taxonomy::ptr item, IfcGeom::ConversionResults& results) { - auto concrete_item = ifcopenshell::geometry::taxonomy::template dcast>(item); + auto concrete_item = ifcopenshell::geometry::taxonomy::template dcast>(item); if (concrete_item) { return kernel->convert_impl(concrete_item, results); } else { @@ -115,7 +115,7 @@ namespace { }; template <> - struct dispatch_with_upgrade { + struct dispatch_with_upgrade { static bool dispatch(ifcopenshell::geometry::kernels::AbstractKernel*, const ifcopenshell::geometry::taxonomy::ptr item, IfcGeom::ConversionResults&) { Logger::Error("No conversion with upgrade for " + std::to_string(item->kind())); return false; diff --git a/src/ifcgeom/taxonomy.h b/src/ifcgeom/taxonomy.h index 40e738d1d8..d2eae3813a 100644 --- a/src/ifcgeom/taxonomy.h +++ b/src/ifcgeom/taxonomy.h @@ -1066,6 +1066,7 @@ typedef item const* ptr; typedef std::tuple KindsTuple; typedef std::tuple CurvesTuple; typedef std::tuple SurfacesTuple; + typedef std::tuple UpgradesTuple; } struct type_by_kind { @@ -1089,6 +1090,13 @@ typedef item const* ptr; static const size_t max = std::tuple_size::value; }; + struct upgrades { + template + using type = typename std::tuple_element::type; + + static const size_t max = std::tuple_size::value; + }; + boost::optional loop_to_face_upgrade_impl(ptr item); template class loop_to_face_upgrade {