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

Function trackToBoundary

src/sampling/sampledSet/polyLine/polyLineSet.C:46–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45
46bool Foam::polyLineSet::trackToBoundary
47(
48 passiveParticleCloud& particleCloud,
49 passiveParticle& singleParticle,
50 label& sampleI,
51 DynamicList<point>& samplingPts,
52 DynamicList<label>& samplingCells,
53 DynamicList<label>& samplingFaces,
54 DynamicList<scalar>& samplingCurveDist
55) const
56{
57 particle::TrackingData<passiveParticleCloud> trackData(particleCloud);
58
59 while (true)
60 {
61 // Local geometry info
62 const vector offset = sampleCoords_[sampleI+1] - sampleCoords_[sampleI];
63 const scalar smallDist = mag(tol*offset);
64
65 singleParticle.track(offset, 0);
66 const point trackPt = singleParticle.position();
67
68 if (singleParticle.onBoundaryFace())
69 {
70 //Info<< "trackToBoundary : reached boundary"
71 // << " trackPt:" << trackPt << endl;
72 if
73 (
74 mag(trackPt - sampleCoords_[sampleI+1])
75 < smallDist
76 )
77 {
78 // Reached samplePt on boundary
79 //Info<< "trackToBoundary : boundary. also sampling."
80 // << " trackPt:" << trackPt << " sampleI+1:" << sampleI+1
81 // << endl;
82 samplingPts.append(trackPt);
83 samplingCells.append(singleParticle.cell());
84 samplingFaces.append(singleParticle.face());
85
86 // trackPt is at sampleI+1
87 samplingCurveDist.append(1.0*(sampleI+1));
88 }
89 return true;
90 }
91
92 // Reached samplePt in cell
93 samplingPts.append(trackPt);
94 samplingCells.append(singleParticle.cell());
95 samplingFaces.append(-1);
96
97 // Convert trackPt to fraction inbetween sampleI and sampleI+1
98 scalar dist =
99 mag(trackPt - sampleCoords_[sampleI])
100 / mag(sampleCoords_[sampleI+1] - sampleCoords_[sampleI]);
101 samplingCurveDist.append(sampleI + dist);
102
103 // go to next samplePt

Callers 1

calcSamplesFunction · 0.70

Calls 8

trackDataClass · 0.85
onBoundaryFaceMethod · 0.80
magClass · 0.50
positionMethod · 0.45
appendMethod · 0.45
cellMethod · 0.45
faceMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected