49bool Foam::faceOnlySet::trackToBoundary
51 passiveParticleCloud& particleCloud,
52 passiveParticle& singleParticle,
53 const scalar smallDist,
54 DynamicList<point>& samplingPts,
55 DynamicList<label>& samplingCells,
56 DynamicList<label>& samplingFaces,
57 DynamicList<scalar>& samplingCurveDist
60 const vector offset = (end_ - start_);
62 particle::trackingData
td(particleCloud);
64 point trackPt = singleParticle.position();
68 point oldPoint = trackPt;
70 singleParticle.trackToAndHitFace(end_ - start_, 0, particleCloud,
td);
72 trackPt = singleParticle.position();
74 if (singleParticle.face() != -1 &&
mag(oldPoint - trackPt) > smallDist)
77 samplingPts.append(trackPt);
78 samplingCells.append(singleParticle.cell());
79 samplingFaces.append(singleParticle.face());
80 samplingCurveDist.append(
mag(trackPt - start_));
83 if (-smallDist < ((trackPt - end_) & offset))
89 else if (singleParticle.onBoundaryFace())
98void Foam::faceOnlySet::calcSamples
108 if (
mag(end_ - start_) < SMALL)
111 <<
"Incorrect sample specification :"
112 <<
" start equals end point." <<
endl
113 <<
" start:" << start_
118 const vector offset = (end_ - start_);
119 const vector normOffset = offset/
mag(offset);
120 const vector smallVec = tol*offset;
121 const scalar smallDist =
mag(smallVec);
124 const bool oldMoving =
const_cast<polyMesh&
>(
mesh()).moving(
false);
134 point bPoint(GREAT, GREAT, GREAT);
139 bPoint = bHits[0].hitPoint();
140 bFacei = bHits[0].index();
145 label trackCelli = -1;
146 label trackFacei = -1;
168 if (trackCelli == -1)
180 if (trackFacei == -1)
183 trackFacei = findNearFace(trackCelli, trackPt, smallDist);
200 label startSegmentI = 0;
207 if (trackFacei != -1)
210 samplingPts.append(trackPt);
211 samplingCells.append(trackCelli);
212 samplingFaces.append(trackFacei);
213 samplingCurveDist.append(
mag(trackPt - start_));
224 bool reachedBoundary = trackToBoundary
236 for (label i = samplingPts.size() - 1; i >= startSegmentI; --i)
238 samplingSegments.append(segmentI);
241 if (!reachedBoundary)
249 bool foundValidB =
false;
251 while (bHitI < bHits.size())
254 (bHits[bHitI].hitPoint() - singleParticle.position())
263 if (dist > smallDist)
275 if (!foundValidB || bHitI == bHits.size() - 1)
282 trackFacei = bHits[bHitI].index();
283 trackPt = pushIn(bHits[bHitI].hitPoint(), trackFacei);
284 trackCelli = getBoundaryCell(trackFacei);
288 startSegmentI = samplingPts.size();
295void Foam::faceOnlySet::genSamples()
313 samplingPts.shrink();
314 samplingCells.shrink();
315 samplingFaces.shrink();
316 samplingSegments.shrink();
317 samplingCurveDist.shrink();
322 std::move(samplingPts),
323 std::move(samplingCells),
324 std::move(samplingFaces),
325 std::move(samplingSegments),
326 std::move(samplingCurveDist)
341 const polyMesh&
mesh,
342 const meshSearch& searchEngine,
348 sampledSet(
name,
mesh, searchEngine, axis),
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,...
Sample on faces along a specified path.
const point & start() const
const point & end() const
static const scalar tol
Tolerance when comparing points relative to difference between.
faceOnlySet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const word &axis, const point &start, const point &end)
Construct from components.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
A Cloud of passive particles.
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.
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
Namespace for handling debugging switches.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)