This commit is contained in:
Thomas Krijnen
2020-07-22 12:25:24 +02:00
parent 416640891f
commit 4f1aca8ceb
+21 -17
View File
@@ -246,7 +246,13 @@ namespace IfcGeom {
typedef P Precision; typedef P Precision;
typedef PP PlacementPrecision; typedef PP PlacementPrecision;
boost::optional<bool> initialization_outcome_;
bool initialize() { bool initialize() {
if (initialization_outcome_) {
return *initialization_outcome_;
}
try { try {
initUnits(); initUnits();
} catch (const std::exception& e) { } catch (const std::exception& e) {
@@ -364,27 +370,25 @@ namespace IfcGeom {
if (representations->size() == 0) { if (representations->size() == 0) {
Logger::Warning("No representations encountered, aborting"); Logger::Warning("No representations encountered, aborting");
return false; initialization_outcome_ = false;
}
representation_iterator = representations->begin();
ifcproducts.reset();
done = 0;
total = representations->size();
if (num_threads_ != 1) {
collect();
process_concurrently();
return all_processed_elements_.size();
} else { } else {
if (!create()) { representation_iterator = representations->begin();
return false; ifcproducts.reset();
done = 0;
total = representations->size();
if (num_threads_ != 1) {
collect();
process_concurrently();
initialization_outcome_ = !all_processed_elements_.empty();
} else {
initialization_outcome_ = create();
} }
} }
return true; return *initialization_outcome_;
} }
void collect() { void collect() {