Skip to content

Commit 2ba14ae

Browse files
committed
Fixing for tbb search
1 parent 0fa018f commit 2ba14ae

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

src/cpp/flann/algorithms/nn_index.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ class NNIndex : public IndexBase
469469
atomic_count = 0;
470470

471471
// Use auto partitioner to choose the optimal grainsize for dividing the query points
472-
flann::parallel_knnSearch2<Distance> parallel_knn(queries, indices, dists, knn, params, static_cast<Index*>(this), atomic_count);
472+
flann::parallel_knnSearch2<Distance> parallel_knn(queries, indices, dists, knn, params, this, atomic_count);
473473
tbb::parallel_for(tbb::blocked_range<size_t>(0,queries.rows),
474474
parallel_knn,
475475
tbb::auto_partitioner());
@@ -587,7 +587,7 @@ class NNIndex : public IndexBase
587587
atomic_count = 0;
588588

589589
// Use auto partitioner to choose the optimal grainsize for dividing the query points
590-
flann::parallel_radiusSearch<Distance> parallel_radius(queries, indices, dists, radius, params, static_cast<Index*>(this), atomic_count);
590+
flann::parallel_radiusSearch<Distance> parallel_radius(queries, indices, dists, radius, params, this, atomic_count);
591591
tbb::parallel_for(tbb::blocked_range<size_t>(0,queries.rows),
592592
parallel_radius,
593593
tbb::auto_partitioner());
@@ -703,7 +703,7 @@ class NNIndex : public IndexBase
703703
atomic_count = 0;
704704

705705
// Use auto partitioner to choose the optimal grainsize for dividing the query points
706-
flann::parallel_radiusSearch2<Distance> parallel_radius(queries, indices, dists, radius, params, static_cast<Index*>(this), atomic_count);
706+
flann::parallel_radiusSearch2<Distance> parallel_radius(queries, indices, dists, radius, params, this, atomic_count);
707707
tbb::parallel_for(tbb::blocked_range<size_t>(0,queries.rows),
708708
parallel_radius,
709709
tbb::auto_partitioner());

src/cpp/flann/tbb/bodies.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class parallel_knnSearch
5151
typedef typename Distance::ResultType DistanceType;
5252

5353
parallel_knnSearch(const Matrix<ElementType>& queries,
54-
Matrix<int>& indices,
54+
Matrix<size_t>& indices,
5555
Matrix<DistanceType>& distances,
5656
size_t knn,
5757
const SearchParams& params,
@@ -111,7 +111,7 @@ class parallel_knnSearch
111111
//! Matrix for storing the indices of the nearest neighbors
112112
//! \note no need for this to be a parallel container, each worker thread
113113
//! solely operates on its specified range!
114-
Matrix<int>& indices_;
114+
Matrix<size_t>& indices_;
115115

116116
//! Matrix for storing the distances to the nearest neighbors
117117
//! \note no need for this to be a parallel container, each worker thread
@@ -141,7 +141,7 @@ class parallel_knnSearch2
141141
typedef typename Distance::ResultType DistanceType;
142142

143143
parallel_knnSearch2(const Matrix<ElementType>& queries,
144-
std::vector< std::vector<int> >& indices,
144+
std::vector< std::vector<size_t> >& indices,
145145
std::vector<std::vector<DistanceType> >& distances,
146146
size_t knn,
147147
const SearchParams& params,
@@ -209,7 +209,7 @@ class parallel_knnSearch2
209209
//! Vector for storing the indices of the nearest neighbors
210210
//! \note no need for this to be a parallel container, each worker thread
211211
//! solely operates on its specified range!
212-
std::vector< std::vector<int> >& indices_;
212+
std::vector< std::vector<size_t> >& indices_;
213213

214214
//! Vector for storing the distances to the nearest neighbors
215215
//! \note no need for this to be a parallel container, each worker thread
@@ -249,7 +249,7 @@ class parallel_radiusSearch
249249
* (specified by the blocked_range parameter)
250250
*/
251251
parallel_radiusSearch(const Matrix<ElementType>& queries,
252-
Matrix<int>& indices,
252+
Matrix<size_t>& indices,
253253
Matrix<DistanceType>& distances,
254254
float radius,
255255
const SearchParams& params,
@@ -329,7 +329,7 @@ class parallel_radiusSearch
329329
//! Matrix for storing the indices of the nearest neighbors
330330
//! \note no need for this to be a parallel container, each worker thread
331331
//! solely operates on its specified range!
332-
Matrix<int>& indices_;
332+
Matrix<size_t>& indices_;
333333

334334
//! Matrix for storing the distances to the nearest neighbors
335335
//! \note no need for this to be a parallel container, each worker thread
@@ -369,7 +369,7 @@ class parallel_radiusSearch2
369369
* (specified by the blocked_range parameter)
370370
*/
371371
parallel_radiusSearch2(const Matrix<ElementType>& queries,
372-
std::vector< std::vector<int> >& indices,
372+
std::vector< std::vector<size_t> >& indices,
373373
std::vector<std::vector<DistanceType> >& distances,
374374
float radius,
375375
const SearchParams& params,
@@ -446,7 +446,7 @@ class parallel_radiusSearch2
446446
//! Vector for storing the indices of the nearest neighbors
447447
//! \note no need for this to be a parallel container, each worker thread
448448
//! solely operates on its specified range!
449-
std::vector< std::vector<int> >& indices_;
449+
std::vector< std::vector<size_t> >& indices_;
450450

451451
//! Vector for storing the distances to the nearest neighbors
452452
//! \note no need for this to be a parallel container, each worker thread

test/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ if (GTEST_FOUND AND HDF5_FOUND)
3636
add_definitions(-DTBB)
3737
flann_add_gtest(flann_multithreaded_test flann_multithreaded_test.cpp)
3838
target_link_libraries(flann_multithreaded_test ${TBB_LIBRARIES})
39-
target_link_libraries(flann_simple_test ${TBB_LIBRARIES})
4039
endif()
4140
target_link_libraries(flann_linear_test flann_cpp ${HDF5_LIBRARIES})
4241
target_link_libraries(flann_kdtree_test flann_cpp ${HDF5_LIBRARIES})

test/flann_multithreaded_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class FlannTest : public FLANNTestFixture {
6767
fflush(stdout);
6868
flann::load_from_file(data, "cloud.h5","dataset");
6969
flann::load_from_file(query,"cloud.h5","query");
70-
flann::load_from_file(match,"cloud.h5","indices");
70+
flann::load_from_file(match,"cloud.h5","match");
7171

7272
dists = flann::Matrix<float>(new float[query.rows*nn], query.rows, nn);
7373
indices = flann::Matrix<int>(new int[query.rows*nn], query.rows, nn);

0 commit comments

Comments
 (0)