mirror of
https://github.com/CloudCompare/PoissonRecon.git
synced 2026-08-29 08:34:27 +08:00
Ability to choose the number of threads (the 'threads' parameter was ignored!)
This commit is contained in:
@@ -47,13 +47,20 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
PoissonReconLib::Parameters::Parameters()
|
||||
int PoissonReconLib::Parameters::GetMaxThreadCount()
|
||||
{
|
||||
#ifdef WITH_OPENMP
|
||||
threads = omp_get_num_procs();
|
||||
return omp_get_num_procs();
|
||||
#else
|
||||
return std::thread::hardware_concurrency();
|
||||
#endif
|
||||
}
|
||||
|
||||
PoissonReconLib::Parameters::Parameters()
|
||||
: threads(GetMaxThreadCount())
|
||||
{
|
||||
}
|
||||
|
||||
template <typename _Real>
|
||||
class Vertex : public PointData<_Real>
|
||||
{
|
||||
@@ -714,9 +721,9 @@ bool PoissonReconLib::Reconstruct( const Parameters& params,
|
||||
}
|
||||
|
||||
#ifdef WITH_OPENMP
|
||||
ThreadPool::Init((ThreadPool::ParallelType)(int)ThreadPool::OPEN_MP, std::thread::hardware_concurrency());
|
||||
ThreadPool::Init((ThreadPool::ParallelType)(int)ThreadPool::OPEN_MP, params.threads);
|
||||
#else
|
||||
ThreadPool::Init((ThreadPool::ParallelType)(int)ThreadPool::THREAD_POOL, std::thread::hardware_concurrency());
|
||||
ThreadPool::Init((ThreadPool::ParallelType)(int)ThreadPool::THREAD_POOL, params.threads);
|
||||
#endif
|
||||
|
||||
PointStream<float> pointStream(inCloud);
|
||||
|
||||
@@ -31,6 +31,9 @@ public:
|
||||
//! Default initializer
|
||||
Parameters();
|
||||
|
||||
//! Returns the maximum number of threads
|
||||
static int GetMaxThreadCount();
|
||||
|
||||
//! Boundary types
|
||||
enum BoundaryType { FREE, DIRICHLET, NEUMANN };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user