Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Is CGAL::Orthogonal_k_neighbor_search thread-safe?

Subject: CGAL users discussion list

List archive

[cgal-discuss] Is CGAL::Orthogonal_k_neighbor_search thread-safe?


Chronological Thread 
  • From: Antonio Carlos Pereira de Azambuja <>
  • To:
  • Subject: [cgal-discuss] Is CGAL::Orthogonal_k_neighbor_search thread-safe?
  • Date: Thu, 12 Feb 2015 11:53:07 -0200

Hi,

I am using CGAL to solve nearest neighbor search in 4 dimensional.

I would like to know if I can build a single kdtree object and perform parallel searches in each thread of an OMP loop. Each thread has its own search object. The problem could be illustrated by the draft code below:

int main(void)
{

    // create a kdTree from a point cloud
    CGAL::Orthogonal_k_neighbor_search<Traits>::Tree   *kdTree;
    kdTree = new CGAL::Orthogonal_k_neighbor_search<Traits>::Tree( points.begin(), points.end() )
    .
    .
    .
    // perform several searches in an OMP loop  
#pragma omp parallel .....
   for (counter =0; ....)
  {
     .
     .
     CGAL::Cartesian_d<FT>::Point_d query(......); // define a query point
     CGAL::Orthogonal_k_neighbor_search<Traits>      search( *kdTree, query, 1);
     .
     .
  } //end for
}//end main


Thanks in advance for any help.
-- Antonio Azambuja



Archive powered by MHonArc 2.6.18.

Top of Page