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
100 DynamicList<point>& samplingPts,
101 DynamicList<label>& samplingCells,
102 DynamicList<label>& samplingFaces,
103 DynamicList<label>& samplingSegments,
104 DynamicList<scalar>& samplingCurveDist
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);
125 passiveParticleCloud particleCloud(
mesh());
128 List<pointIndexHit> bHits = searchEngine().intersections
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)
176 const_cast<polyMesh&
>(
mesh()).moving(oldMoving);
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_));
217 passiveParticle singleParticle
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();
291 const_cast<polyMesh&
>(
mesh()).moving(oldMoving);
295void Foam::faceOnlySet::genSamples()
298 DynamicList<point> samplingPts;
299 DynamicList<label> samplingCells;
300 DynamicList<label> samplingFaces;
301 DynamicList<label> samplingSegments;
302 DynamicList<scalar> samplingCurveDist;
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)
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Sample on faces along a specified path.
static const scalar tol
Tolerance when comparing points relative to difference between.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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)