OcctNoCleanTriangulation CacheShapes PermissiveShapeReuse setting; Cgal conditional copy during triangulation; occt cheaper check for triangulation existance #6712

This commit is contained in:
Thomas Krijnen
2025-05-18 22:14:22 +02:00
parent 404bf13a18
commit 439f9c14ce
8 changed files with 161 additions and 32 deletions
+19 -2
View File
@@ -22,6 +22,16 @@
using namespace ifcopenshell::geometry;
bool ifcopenshell::geometry::kernels::AbstractKernel::convert(const taxonomy::ptr item, IfcGeom::ConversionResults& results) {
if (settings_.get<settings::CacheShapes>().get()) {
auto it = cache_.find(item);
if (it != cache_.end()) {
results = it->second;
Logger::Notice("Cache hit #" + std::to_string(item->instance->as<IfcUtil::IfcBaseEntity>()->id()) +
" -> #" + std::to_string(it->first->instance->as<IfcUtil::IfcBaseEntity>()->id()));
return true;
}
}
auto with_exception_handling = [&](auto fn) {
try {
return fn();
@@ -44,11 +54,18 @@ bool ifcopenshell::geometry::kernels::AbstractKernel::convert(const taxonomy::pt
}
};
bool res;
if (propagate_exceptions) {
return without_exception_handling(process_with_upgrade);
res = without_exception_handling(process_with_upgrade);
} else {
return with_exception_handling(process_with_upgrade);
res = with_exception_handling(process_with_upgrade);
}
if (settings_.get<settings::CacheShapes>().get() && res) {
cache_.insert({ item, results });
}
return res;
}
const Settings& ifcopenshell::geometry::kernels::AbstractKernel::settings() const