diff --git a/ContextBasedFeature.cpp b/ContextBasedFeature.cpp index b8b4625..6cd2762 100644 --- a/ContextBasedFeature.cpp +++ b/ContextBasedFeature.cpp @@ -194,7 +194,7 @@ bool ContextBasedFeature::prepare( const CorePoints& corePoints, bool cancelled = false; #ifndef _DEBUG #if defined(_OPENMP) -#pragma omp parallel for num_threads(omp_get_max_threads()) +#pragma omp parallel for num_threads(std::max(1, omp_get_max_threads() - 2)) #endif #endif for (int i = 0; i < static_cast(pointCount); ++i) diff --git a/ContextBasedFeature.h b/ContextBasedFeature.h index 622dfad..2b46f8e 100644 --- a/ContextBasedFeature.h +++ b/ContextBasedFeature.h @@ -75,7 +75,6 @@ namespace masc , kNN(p_kNN) , ctxClassLabel(p_ctxClassLabel) , sf(nullptr) - // , sfWasAlreadyExisting(false) { scale = p_scale; } @@ -104,7 +103,5 @@ namespace masc int ctxClassLabel; //! The computed scalar CCCoreLib::ScalarField* sf; - //! Whether the SF pre-exists - // bool sfWasAlreadyExisting; }; } diff --git a/NeighborhoodFeature.h b/NeighborhoodFeature.h index 8518f65..cf3b517 100644 --- a/NeighborhoodFeature.h +++ b/NeighborhoodFeature.h @@ -151,8 +151,6 @@ namespace masc : type(p_type) , sf1(nullptr) , sf2(nullptr) - // , sf1WasAlreadyExisting(false) - // , sf2WasAlreadyExisting(false) { } diff --git a/PointFeature.cpp b/PointFeature.cpp index 7851a02..248d4d8 100644 --- a/PointFeature.cpp +++ b/PointFeature.cpp @@ -418,14 +418,13 @@ static bool ComputeMathOpWithNearestNeighbor( const CorePoints& corePoints, ccLog::Print(logMessage); CCCoreLib::NormalizedProgress nProgress(progressCb, pointCount); - QMutex mutex; double meanNeighborhoodSize = 0; int tenth = pointCount / 10; error.clear(); bool cancelled = false; #ifndef _DEBUG #if defined(_OPENMP) -#pragma omp parallel for +#pragma omp parallel for num_threads(std::max(1, omp_get_max_threads() - 2)) #endif #endif for (int i = 0; i < static_cast(pointCount); ++i) @@ -473,9 +472,7 @@ static bool ComputeMathOpWithNearestNeighbor( const CorePoints& corePoints, if (progressCb) { - mutex.lock(); cancelled = !nProgress.oneStep(); - mutex.unlock(); if (cancelled) { //process cancelled by the user diff --git a/PointFeature.h b/PointFeature.h index f8cc20b..84fba0e 100644 --- a/PointFeature.h +++ b/PointFeature.h @@ -148,9 +148,6 @@ namespace masc , field2(nullptr) , statSF1(nullptr) , statSF2(nullptr) - // , statSF1WasAlreadyExisting(false) - // , statSF2WasAlreadyExisting(false) - //, keepStatSF2(false) { //auomatically set the right source for specific features switch (type) diff --git a/confusionmatrix.cpp b/confusionmatrix.cpp index 2f1b2f9..a6a3527 100644 --- a/confusionmatrix.cpp +++ b/confusionmatrix.cpp @@ -32,8 +32,8 @@ QColor getColor(double value, double r1, double g1, double b1) return QColor(r, g, b); } -ConfusionMatrix::ConfusionMatrix(const std::vector &actual, const std::vector &predicted) : - ui(new Ui::ConfusionMatrix) +ConfusionMatrix::ConfusionMatrix(const std::vector &actual, const std::vector &predicted) + : ui(new Ui::ConfusionMatrix) { ui->setupUi(this); this->setWindowFlag(Qt::WindowStaysOnTopHint); diff --git a/q3DMASCClassifier.cpp b/q3DMASCClassifier.cpp index 092da90..f52ad79 100644 --- a/q3DMASCClassifier.cpp +++ b/q3DMASCClassifier.cpp @@ -211,7 +211,7 @@ bool Classifier::classify( const Feature::Source::Set& featureSources, #ifndef _DEBUG #if defined(_OPENMP) -#pragma omp parallel for +#pragma omp parallel for num_threads(omp_get_max_threads() - 2) #endif #endif for (int i = 0; i < static_cast(cloud->size()); ++i) diff --git a/q3DMASCTools.cpp b/q3DMASCTools.cpp index 976bae1..7ceb73f 100644 --- a/q3DMASCTools.cpp +++ b/q3DMASCTools.cpp @@ -1235,7 +1235,7 @@ bool Tools::PrepareFeatures(const CorePoints& corePoints, Feature::Set& features #ifndef _DEBUG #if defined(_OPENMP) -#pragma omp parallel for +#pragma omp parallel for num_threads(std::max(1, omp_get_max_threads() - 2)) #endif #endif for (int i = 0; i < static_cast(pointCount); ++i)