Go to the documentation of this file.
46 const point& currentPt,
48 const scalar smallDist,
53 bool pointFound =
false;
55 const vector normOffset = offset/
mag(offset);
60 for (; sampleI < nPoints_; sampleI++)
62 scalar
s = (samplePt - currentPt) & normOffset;
91 const vector offset = (end_ - start_)/(nPoints_ - 1);
92 const vector smallVec = tol*offset;
93 const scalar smallDist =
mag(smallVec);
103 if (!nextSample(trackPt, offset, smallDist, samplePt, sampleI))
108 Pout<<
"trackToBoundary : Reached end : samplePt now:"
109 << samplePt <<
" sampleI now:" << sampleI <<
endl;
114 if (
mag(samplePt - trackPt) < smallDist)
119 Pout<<
"trackToBoundary : samplePt corresponds to trackPt : "
120 <<
" trackPt:" << trackPt <<
" samplePt:" << samplePt
124 samplingPts.
append(trackPt);
127 samplingCurveDist.
append(
mag(trackPt - start_));
130 if (!nextSample(trackPt, offset, smallDist, samplePt, sampleI))
135 Pout<<
"trackToBoundary : Reached end : "
136 <<
" samplePt now:" << samplePt
137 <<
" sampleI now:" << sampleI
148 Pout<<
"Searching along trajectory from "
149 <<
" trackPt:" << trackPt
150 <<
" trackCellI:" << singleParticle.
cell()
151 <<
" to:" << samplePt <<
endl;
154 point oldPos = trackPt;
159 singleParticle.
track(samplePt, trackData);
163 Pout<<
"Result of tracking "
164 <<
" trackPt:" << trackPt
165 <<
" trackCellI:" << singleParticle.
cell()
166 <<
" trackFaceI:" << singleParticle.
face()
167 <<
" onBoundary:" << singleParticle.
onBoundary()
168 <<
" samplePt:" << samplePt
169 <<
" smallDist:" << smallDist
176 && (
mag(trackPt - oldPos) < smallDist)
182 if (
mag(trackPt - samplePt) < smallDist)
187 samplingPts.
append(trackPt);
189 samplingFaces.
append(facei);
190 samplingCurveDist.
append(
mag(trackPt - start_));
198 samplingPts.
append(trackPt);
201 samplingCurveDist.
append(
mag(trackPt - start_));
218 if ((nPoints_ < 2) || (
mag(end_ - start_) < SMALL))
221 <<
"Incorrect sample specification. Either too few points or"
222 <<
" start equals end point." <<
endl
223 <<
"nPoints:" << nPoints_
224 <<
" start:" << start_
229 const vector offset = (end_ - start_)/(nPoints_ - 1);
230 const vector normOffset = offset/
mag(offset);
231 const vector smallVec = tol*offset;
232 const scalar smallDist =
mag(smallVec);
235 const bool oldMoving =
const_cast<polyMesh&
>(
mesh()).moving(
false);
245 point bPoint(GREAT, GREAT, GREAT);
250 bPoint = bHits[0].hitPoint();
251 bFaceI = bHits[0].index();
257 label trackCellI = -1;
258 label trackFaceI = -1;
273 if (trackCellI == -1)
286 samplingPts.
append(start_);
287 samplingCells.
append(trackCellI);
288 samplingFaces.
append(trackFaceI);
289 samplingCurveDist.
append(0.0);
300 label startSegmentI = 0;
303 point samplePt = start_;
313 bool reachedBoundary = trackToBoundary
326 for (
label i = samplingPts.size() - 1; i >= startSegmentI; --i)
328 samplingSegments.
append(segmentI);
332 if (!reachedBoundary)
336 Pout<<
"calcSamples : Reached end of samples: "
337 <<
" samplePt now:" << samplePt
338 <<
" sampleI now:" << sampleI
345 bool foundValidB =
false;
347 while (bHitI < bHits.
size())
350 (bHits[bHitI].hitPoint() - singleParticle.
position())
355 Pout<<
"Finding next boundary : "
356 <<
"bPoint:" << bHits[bHitI].hitPoint()
357 <<
" tracking:" << singleParticle.
position()
362 if (dist > smallDist)
382 trackPt = pushIn(bPoint, trackFaceI);
383 trackCellI = getBoundaryCell(trackFaceI);
387 startSegmentI = samplingPts.size();
415 samplingSegments.
shrink();
416 samplingCurveDist.
shrink();
Holds list of sampling points which is filled at construction time. Various implementations of this b...
bool onBoundary() const
Is the particle on the boundary/(or outside the domain)?
label & face()
Return current face particle is on otherwise -1.
A class for handling words, derived from string.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
scalar & stepFraction()
Return the fraction of time-step completed.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< scalar > mag(const dimensioned< Type > &)
List< pointIndexHit > intersections(const point &pStart, const point &pEnd) const
Find all intersections of boundary within segment pStart .. pEnd.
Mesh consisting of general polyhedral cells.
label & cell()
Return current cell particle is in.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
A Cloud of passive particles.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Macros for easy insertion into run-time selection tables.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void setSamples(const List< point > &samplingPts, const labelList &samplingCells, const labelList &samplingFaces, const labelList &samplingSegments, const scalarList &samplingCurveDist)
Sets sample data.
prefixOSstream Pout(cout, "Pout")
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label track(const vector &endPosition, TrackData &td)
Track particle to end of trajectory.
label readLabel(Istream &is)
const vector & position() const
Return current particle position.
void size(const label)
Override size to be inconsistent with allocated storage.
defineTypeNameAndDebug(combustionModel, 0)
word name(const complex &)
Return a string representation of a complex.