48bool Foam::polyLineSet::trackToBoundary
50 passiveParticleCloud& particleCloud,
51 passiveParticle& singleParticle,
53 DynamicList<point>& samplingPts,
54 DynamicList<label>& samplingCells,
55 DynamicList<label>& samplingFaces,
56 DynamicList<scalar>& samplingCurveDist
62 const vector offset = sampleCoords_[sampleI+1] - sampleCoords_[sampleI];
63 const scalar smallDist =
mag(
tol*offset);
65 singleParticle.track(offset, 0);
66 const point trackPt = singleParticle.position();
68 if (singleParticle.onBoundaryFace())
74 mag(trackPt - sampleCoords_[sampleI+1])
82 samplingPts.append(trackPt);
83 samplingCells.append(singleParticle.cell());
84 samplingFaces.append(singleParticle.face());
87 samplingCurveDist.append(1.0*(sampleI+1));
93 samplingPts.append(trackPt);
94 samplingCells.append(singleParticle.cell());
95 samplingFaces.append(-1);
99 mag(trackPt - sampleCoords_[sampleI])
100 /
mag(sampleCoords_[sampleI+1] - sampleCoords_[sampleI]);
101 samplingCurveDist.append(sampleI + dist);
106 if (sampleI == sampleCoords_.size() - 1)
117void Foam::polyLineSet::calcSamples
119 DynamicList<point>& samplingPts,
120 DynamicList<label>& samplingCells,
121 DynamicList<label>& samplingFaces,
122 DynamicList<label>& samplingSegments,
123 DynamicList<scalar>& samplingCurveDist
127 if (sampleCoords_.size() < 2)
130 <<
"Incorrect sample specification. Too few points:"
133 point oldPoint = sampleCoords_[0];
134 for (label sampleI = 1; sampleI < sampleCoords_.size(); ++sampleI)
136 if (
mag(sampleCoords_[sampleI] - oldPoint) < SMALL)
139 <<
"Incorrect sample specification."
140 <<
" Point " << sampleCoords_[sampleI-1]
141 <<
" at position " << sampleI-1
142 <<
" and point " << sampleCoords_[sampleI]
143 <<
" at position " << sampleI
146 oldPoint = sampleCoords_[sampleI];
150 const bool oldMoving =
const_cast<polyMesh&
>(
mesh()).moving(
false);
151 passiveParticleCloud particleCloud(
mesh());
157 label startSegmentI = 0;
161 point lastSample(GREAT, GREAT, GREAT);
166 label trackCelli = -1;
167 label trackFacei = -1;
172 sampleCoords_[sampleI+1] - sampleCoords_[sampleI];
173 const scalar smallDist =
mag(tol*offset);
177 List<pointIndexHit> bHits = searchEngine().intersections
179 sampleCoords_[sampleI],
180 sampleCoords_[sampleI+1]
183 point bPoint(GREAT, GREAT, GREAT);
188 bPoint = bHits[0].hitPoint();
189 bFacei = bHits[0].index();
197 sampleCoords_[sampleI],
207 if (isSample && (
mag(lastSample - trackPt) > smallDist))
217 samplingPts.append(trackPt);
218 samplingCells.append(trackCelli);
219 samplingFaces.append(trackFacei);
224 mag(trackPt - sampleCoords_[sampleI])
225 /
mag(sampleCoords_[sampleI+1] - sampleCoords_[sampleI]);
226 samplingCurveDist.append(sampleI + dist);
228 lastSample = trackPt;
231 if (trackCelli == -1)
236 }
while ((trackCelli == -1) && (sampleI < sampleCoords_.size() - 1));
238 if (sampleI == sampleCoords_.size() - 1)
251 passiveParticle singleParticle
258 bool bReached = trackToBoundary
270 for (label i = samplingPts.size() - 1; i >= startSegmentI; --i)
272 samplingSegments.append(segmentI);
282 lastSample = singleParticle.position();
288 if (sampleI == sampleCoords_.size() - 1)
298 startSegmentI = samplingPts.size();
301 const_cast<polyMesh&
>(
mesh()).moving(oldMoving);
305void Foam::polyLineSet::genSamples()
308 DynamicList<point> samplingPts;
309 DynamicList<label> samplingCells;
310 DynamicList<label> samplingFaces;
311 DynamicList<label> samplingSegments;
312 DynamicList<scalar> samplingCurveDist;
323 samplingPts.shrink();
324 samplingCells.shrink();
325 samplingFaces.shrink();
326 samplingSegments.shrink();
327 samplingCurveDist.shrink();
332 std::move(samplingPts),
333 std::move(samplingCells),
334 std::move(samplingFaces),
335 std::move(samplingSegments),
336 std::move(samplingCurveDist)
358 sampleCoords_(sampleCoords)
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
Sample along poly line defined by a list of points (knots)
Mesh consisting of general polyhedral cells.
Holds list of sampling points which is filled at construction time. Various implementations of this b...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
messageStream Info
Information stream (stdout output on master, null elsewhere)
vector point
Point is a vector.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)