MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / update

Method update

src/meshTools/algorithms/PointEdgeWave/pointEdgePointI.H:33–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31// Update this with w2 if w2 nearer to pt.
32template<class TrackingData>
33inline bool Foam::pointEdgePoint::update
34(
35 const point& pt,
36 const pointEdgePoint& w2,
37 const scalar tol,
38 TrackingData& td
39)
40{
41 scalar dist2 = magSqr(pt - w2.origin());
42
43 if (!valid(td))
44 {
45 // current not yet set so use any value
46 distSqr_ = dist2;
47 origin_ = w2.origin();
48
49 return true;
50 }
51
52 scalar diff = distSqr_ - dist2;
53
54 if (diff < 0)
55 {
56 // already nearer to pt
57 return false;
58 }
59
60 if ((diff < SMALL) || ((distSqr_ > SMALL) && (diff/distSqr_ < tol)))
61 {
62 // don't propagate small changes
63 return false;
64 }
65 else
66 {
67 // update with new values
68 distSqr_ = dist2;
69 origin_ = w2.origin();
70
71 return true;
72 }
73}
74
75
76// Update this with w2 (information on same point)

Callers

nothing calls this directly

Calls 3

validFunction · 0.85
magSqrFunction · 0.50
distSqrMethod · 0.45

Tested by

no test coverage detected