提交 8062acdf 编写于 作者: F Florian Hubner

Fix vector initialization in NormalEstimationOMP

The vectors nn_indices and nn_dists in
NormalEstimationOMP::computeFeatures must be initialized to the correct
size. They are initialized at the beginning of the function but the
OpenMP parallel for loop basically generates a new pair of vectors for
each thread. These vectors are initialized with the default constructor
which means that they have zero size.
To fix this I used 'firstprivate' for the vectors instead of 'private'
this causes that the copy constructor is called instead of the default
constructor.
上级 88262aaf
......@@ -71,7 +71,7 @@ pcl::NormalEstimationOMP<PointInT, PointOutT>::computeFeature (PointCloudOut &ou
if (input_->is_dense)
{
#ifdef _OPENMP
#pragma omp parallel for shared (output) private (nn_indices, nn_dists) num_threads(threads_)
#pragma omp parallel for shared (output) firstprivate (nn_indices, nn_dists) num_threads(threads_)
#endif
// Iterating over the entire index vector
for (std::ptrdiff_t idx = 0; idx < static_cast<std::ptrdiff_t> (indices_->size ()); ++idx)
......@@ -98,7 +98,7 @@ pcl::NormalEstimationOMP<PointInT, PointOutT>::computeFeature (PointCloudOut &ou
else
{
#ifdef _OPENMP
#pragma omp parallel for shared (output) private (nn_indices, nn_dists) num_threads(threads_)
#pragma omp parallel for shared (output) firstprivate (nn_indices, nn_dists) num_threads(threads_)
#endif
// Iterating over the entire index vector
for (std::ptrdiff_t idx = 0; idx < static_cast<std::ptrdiff_t> (indices_->size ()); ++idx)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册