Skip to content

Commit ffa282a

Browse files
Stinkfist0aothms
authored andcommitted
IfcGeomIterator: check the filtered products, not unfiltered ones, for reusability. Speeds up things significantly and also fixes geometry reusability in many cases.
1 parent fbc0215 commit ffa282a

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/ifcgeom/IfcGeomIterator.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -405,18 +405,17 @@ namespace IfcGeom {
405405
for (;;) {
406406
IfcSchema::IfcRepresentation* representation;
407407

408-
// Have we reached the end of our list of representations?
409408
if ( representation_iterator == representations->end() ) {
410409
representations.reset();
411-
return 0;
410+
return 0; // reached the end of our list of representations
412411
}
413412
representation = *representation_iterator;
414413

415-
// Has the list of IfcProducts for this representation been initialized?
416414
if (!ifcproducts) {
415+
// Init. the list of filtered IfcProducts for this representation
417416
ifcproducts = IfcSchema::IfcProduct::list::ptr(new IfcSchema::IfcProduct::list);
418417
IfcSchema::IfcProduct::list::ptr unfiltered_products = kernel.products_represented_by(representation);
419-
// Filter the products based on the set of entities and/or names being included or excluded for processing.
418+
// Include only the desired products for processing.
420419
for (IfcSchema::IfcProduct::list::it jt = unfiltered_products->begin(); jt != unfiltered_products->end(); ++jt) {
421420
IfcSchema::IfcProduct* prod = *jt;
422421
if (boost::all(filters_, filter_match(prod))) {
@@ -429,7 +428,7 @@ namespace IfcGeom {
429428
continue;
430429
}
431430

432-
geometry_reuse_ok_for_current_representation_ = reuse_ok_(unfiltered_products);
431+
geometry_reuse_ok_for_current_representation_ = reuse_ok_(ifcproducts);
433432

434433
IfcSchema::IfcRepresentationMap::list::ptr maps = representation->RepresentationMap();
435434

@@ -447,13 +446,12 @@ namespace IfcGeom {
447446
}
448447
}
449448

449+
// Check if this represenation has (or will be) processed as part its mapped representation
450450
bool representation_processed_as_mapped_item = false;
451-
452-
IfcSchema::IfcRepresentation* representation_mapped_to = kernel.representation_mapped_to(representation);
451+
IfcSchema::IfcRepresentation* representation_mapped_to = kernel.representation_mapped_to(representation);
453452
if (representation_mapped_to) {
454-
// Check if this representation has (or will be) processed as part its mapped representation
455-
representation_processed_as_mapped_item = ok_mapped_representations->contains(representation_mapped_to) ||
456-
reuse_ok_(kernel.products_represented_by(representation_mapped_to));
453+
representation_processed_as_mapped_item = geometry_reuse_ok_for_current_representation_ ||
454+
ok_mapped_representations->contains(representation_mapped_to);
457455
}
458456

459457
if (representation_processed_as_mapped_item) {

0 commit comments

Comments
 (0)