49 bool 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())
98 void 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());
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);
295 void 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)
341 const polyMesh&
mesh,
342 const meshSearch& searchEngine,
348 sampledSet(
name,
mesh, searchEngine, axis),
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const scalar tol
Tolerance when comparing points relative to difference between.
Macros for easy insertion into run-time selection tables.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Holds list of sampling points which is filled at construction time. Various implementations of this b...
A class for handling words, derived from Foam::string.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
defineTypeNameAndDebug(combustionModel, 0)
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
faceOnlySet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const word &axis, const point &start, const point &end)
Construct from components.
vector point
Point is a vector.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Mesh consisting of general polyhedral cells.
List< pointIndexHit > intersections(const point &pStart, const point &pEnd) const
Find all intersections of boundary within segment pStart .. pEnd.