mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 21:40:33 +05:00
thread safe ExtrusionFace :: CalcProj
This commit is contained in:
parent
262fec4601
commit
679942033e
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user