Skip to content

Commit

Permalink
ISSUE #571 default to 4 threads, make num threads configurable throug…
Browse files Browse the repository at this point in the history
…h ENV var
  • Loading branch information
carmenfan committed Apr 26, 2022
1 parent 8f25319 commit db46e5b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion ifcUtils/repo_ifc_utils_geometry_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,23 @@ bool repo::ifcUtility::SCHEMA_NS::GeometryHandler::retrieveGeometry(
IfcParse::IfcFile ifcfile(file);
auto itSettings = createSettings();

IfcGeom::Iterator<double> contextIterator(itSettings, &ifcfile);
char* value = getenv("REPO_NUM_THREADS");

int nThreads = 0;
try {
if (value && strlen(value) > 0) {
nThreads = std::stoi(value);
}
}
catch (...) {
//do nothing.
}

nThreads = nThreads ? nThreads : 4;

repoInfo << "Initialising Geom iterator with " << nThreads << "...";

IfcGeom::Iterator<double> contextIterator(itSettings, &ifcfile, nThreads);

try {
if (!contextIterator.initialize()) {
Expand Down

0 comments on commit db46e5b

Please sign in to comment.