Skip to content
Snippets Groups Projects
Commit 542645a4 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

workaround ANN (not thread safe?) - should move to flann

parent 84470f6d
No related branches found
No related tags found
No related merge requests found
...@@ -1921,6 +1921,9 @@ class AttractorAnisoCurveField : public Field { ...@@ -1921,6 +1921,9 @@ class AttractorAnisoCurveField : public Field {
if(update_needed) if(update_needed)
update(); update();
double xyz[3] = { x, y, z }; double xyz[3] = { x, y, z };
#if defined(_OPENMP)
#pragma omp critical
#endif
kdtree->annkSearch(xyz, 1, index, dist); kdtree->annkSearch(xyz, 1, index, dist);
double d = sqrt(dist[0]); double d = sqrt(dist[0]);
double lTg = d < dMin ? lMinTangent : d > dMax ? lMaxTangent : double lTg = d < dMin ? lMinTangent : d > dMax ? lMaxTangent :
...@@ -1938,6 +1941,9 @@ class AttractorAnisoCurveField : public Field { ...@@ -1938,6 +1941,9 @@ class AttractorAnisoCurveField : public Field {
if(update_needed) if(update_needed)
update(); update();
double xyz[3] = { X, Y, Z }; double xyz[3] = { X, Y, Z };
#if defined(_OPENMP)
#pragma omp critical
#endif
kdtree->annkSearch(xyz, 1, index, dist); kdtree->annkSearch(xyz, 1, index, dist);
double d = sqrt(dist[0]); double d = sqrt(dist[0]);
return std::max(d, 0.05); return std::max(d, 0.05);
...@@ -2168,6 +2174,9 @@ class AttractorField : public Field ...@@ -2168,6 +2174,9 @@ class AttractorField : public Field
double xyz[3]; double xyz[3];
getCoord(X, Y, Z, xyz[0], xyz[1], xyz[2], ge); getCoord(X, Y, Z, xyz[0], xyz[1], xyz[2], ge);
#if defined(_OPENMP)
#pragma omp critical
#endif
kdtree->annkSearch(xyz, 1, index, dist); kdtree->annkSearch(xyz, 1, index, dist);
return sqrt(dist[0]); return sqrt(dist[0]);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment