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
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);
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);
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)
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();
305void Foam::polyLineSet::genSamples()
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)
351 const polyMesh&
mesh,
352 const meshSearch& searchEngine,
354 const List<point>& sampleCoords
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 vector of objects of type <T> that resizes itself as necessary to accept the new objects.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool get(const label i) const
const word & axis() const
The sort axis name.
const word & name() const noexcept
The coord-set name.
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.
A Cloud of passive particles.
Sample along poly line defined by a list of points (knots).
static const scalar tol
Tolerance when comparing points relative to difference between start and end points.
polyLineSet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const word &axis, const List< point > &samplePoints)
Construct from components.
Mesh consisting of general polyhedral cells.
Holds list of sampling points which is filled at construction time. Various implementations of this b...
const meshSearch & searchEngine() const noexcept
sampledSet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const coordSet::coordFormat axisType)
Construct from components.
const polyMesh & mesh() const noexcept
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.
Namespace for handling debugging switches.
messageStream Info
Information stream (stdout output on master, null elsewhere).
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
vector point
Point is a vector.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)