thread safe ExtrusionFace :: CalcProj

This commit is contained in:
mhochsteger@cerbsim.com 2022-03-07 20:59:00 +01:00
parent 262fec4601
commit 679942033e

View File

@ -141,16 +141,21 @@ namespace netgen
void ExtrusionFace :: CalcProj(const Point<3> & point3d, Point<2> & point2d, void ExtrusionFace :: CalcProj(const Point<3> & point3d, Point<2> & point2d,
int & seg, double & t) const int & seg, double & t) const
{ {
if (Dist2 (point3d, latest_point3d) < static mutex set_latest_point;
1e-25 * Dist2(path->GetSpline(0).StartPI(), path->GetSpline(0).EndPI()))
auto eps = 1e-25 * Dist2(path->GetSpline(0).StartPI(), path->GetSpline(0).EndPI());
if (Dist2 (point3d, latest_point3d) < eps)
{ {
point2d = latest_point2d; std::lock_guard<std::mutex> guard(set_latest_point);
seg = latest_seg; if (Dist2 (point3d, latest_point3d) < eps)
t = latest_t; {
return; point2d = latest_point2d;
seg = latest_seg;
t = latest_t;
return;
}
} }
latest_point3d = point3d;
double cutdist = -1; double cutdist = -1;
@ -214,11 +219,13 @@ namespace netgen
point2d = testpoint2d; point2d = testpoint2d;
t = thist; t = thist;
seg = i; seg = i;
latest_seg = i;
latest_t = t;
latest_point2d = point2d;
} }
} }
std::lock_guard<std::mutex> guard(set_latest_point);
latest_seg = seg;
latest_t = t;
latest_point2d = point2d;
latest_point3d = point3d;
} }
double ExtrusionFace :: CalcProj(const Point<3> & point3d, Point<2> & point2d, double ExtrusionFace :: CalcProj(const Point<3> & point3d, Point<2> & point2d,