mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 13:52:23 +00:00
IfcGeomIterator: optimize filtering by performing it prior to geometry reuse inspections.
Improves the iteration speed immensely, especially on very large files when only a fraction of the content is wanted to be converted.
This commit is contained in:
committed by
Thomas Krijnen
parent
58759cf365
commit
fbc0215ef1
@@ -416,6 +416,18 @@ namespace IfcGeom {
|
|||||||
if (!ifcproducts) {
|
if (!ifcproducts) {
|
||||||
ifcproducts = IfcSchema::IfcProduct::list::ptr(new IfcSchema::IfcProduct::list);
|
ifcproducts = IfcSchema::IfcProduct::list::ptr(new IfcSchema::IfcProduct::list);
|
||||||
IfcSchema::IfcProduct::list::ptr unfiltered_products = kernel.products_represented_by(representation);
|
IfcSchema::IfcProduct::list::ptr unfiltered_products = kernel.products_represented_by(representation);
|
||||||
|
// Filter the products based on the set of entities and/or names being included or excluded for processing.
|
||||||
|
for (IfcSchema::IfcProduct::list::it jt = unfiltered_products->begin(); jt != unfiltered_products->end(); ++jt) {
|
||||||
|
IfcSchema::IfcProduct* prod = *jt;
|
||||||
|
if (boost::all(filters_, filter_match(prod))) {
|
||||||
|
ifcproducts->push(prod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ifcproducts->size() == 0) {
|
||||||
|
_nextShape();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
geometry_reuse_ok_for_current_representation_ = reuse_ok_(unfiltered_products);
|
geometry_reuse_ok_for_current_representation_ = reuse_ok_(unfiltered_products);
|
||||||
|
|
||||||
@@ -450,14 +462,6 @@ namespace IfcGeom {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter the products based on the set of entities and/or names being included or excluded for processing.
|
|
||||||
for (IfcSchema::IfcProduct::list::it jt = unfiltered_products->begin(); jt != unfiltered_products->end(); ++jt) {
|
|
||||||
IfcSchema::IfcProduct* prod = *jt;
|
|
||||||
if (boost::all(filters_, filter_match(prod))) {
|
|
||||||
ifcproducts->push(prod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ifcproduct_iterator = ifcproducts->begin();
|
ifcproduct_iterator = ifcproducts->begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user