46 bool Foam::faceOnlySet::trackToBoundary
48 passiveParticleCloud& particleCloud,
49 passiveParticle& singleParticle,
50 const scalar smallDist,
51 DynamicList<point>& samplingPts,
52 DynamicList<label>& samplingCells,
53 DynamicList<label>& samplingFaces,
54 DynamicList<scalar>& samplingCurveDist
57 particle::TrackingData<passiveParticleCloud> trackData(particleCloud);
59 const point& trackPt = singleParticle.position();
63 point oldPoint = trackPt;
65 singleParticle.trackToFace(end_, trackData);
67 if (singleParticle.face() != -1 &&
mag(oldPoint - trackPt) > smallDist)
70 samplingPts.append(trackPt);
71 samplingCells.append(singleParticle.cell());
72 samplingFaces.append(singleParticle.face());
73 samplingCurveDist.append(
mag(trackPt - start_));
76 if (
mag(trackPt - end_) < smallDist)
81 else if (singleParticle.onBoundary())
90 void Foam::faceOnlySet::calcSamples
92 DynamicList<point>& samplingPts,
93 DynamicList<label>& samplingCells,
94 DynamicList<label>& samplingFaces,
95 DynamicList<label>& samplingSegments,
96 DynamicList<scalar>& samplingCurveDist
100 if (
mag(end_ - start_) < SMALL)
103 <<
"Incorrect sample specification :" 104 <<
" start equals end point." <<
endl 105 <<
" start:" << start_
110 const vector offset = (end_ - start_);
111 const vector normOffset = offset/
mag(offset);
112 const vector smallVec = tol*offset;
113 const scalar smallDist =
mag(smallVec);
116 const bool oldMoving =
const_cast<polyMesh&
>(
mesh()).moving(
false);
117 passiveParticleCloud particleCloud(
mesh());
126 point bPoint(GREAT, GREAT, GREAT);
131 bPoint = bHits[0].hitPoint();
132 bFacei = bHits[0].index();
137 label trackCelli = -1;
138 label trackFacei = -1;
160 if (trackCelli == -1)
172 if (trackFacei == -1)
175 trackFacei = findNearFace(trackCelli, trackPt, smallDist);
192 label startSegmentI = 0;
199 if (trackFacei != -1)
202 samplingPts.append(trackPt);
203 samplingCells.append(trackCelli);
204 samplingFaces.append(trackFacei);
205 samplingCurveDist.append(
mag(trackPt - start_));
209 passiveParticle singleParticle
216 bool reachedBoundary = trackToBoundary
228 for (
label i = samplingPts.size() - 1; i >= startSegmentI; --i)
230 samplingSegments.append(segmentI);
233 if (!reachedBoundary)
241 bool foundValidB =
false;
243 while (bHitI < bHits.size())
246 (bHits[bHitI].hitPoint() - singleParticle.position())
255 if (dist > smallDist)
267 if (!foundValidB || bHitI == bHits.size() - 1)
274 trackFacei = bHits[bHitI].index();
275 trackPt = pushIn(bHits[bHitI].hitPoint(), trackFacei);
276 trackCelli = getBoundaryCell(trackFacei);
280 startSegmentI = samplingPts.size();
283 const_cast<polyMesh&
>(
mesh()).moving(oldMoving);
287 void Foam::faceOnlySet::genSamples()
290 DynamicList<point> samplingPts;
291 DynamicList<label> samplingCells;
292 DynamicList<label> samplingFaces;
293 DynamicList<label> samplingSegments;
294 DynamicList<scalar> samplingCurveDist;
305 samplingPts.shrink();
306 samplingCells.shrink();
307 samplingFaces.shrink();
308 samplingSegments.shrink();
309 samplingCurveDist.shrink();
357 start_(dict.
lookup(
"start")),
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< pointIndexHit > intersections(const point &pStart, const point &pEnd) const
Find all intersections of boundary within segment pStart .. pEnd.
const double e
Elementary charge.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Vector< scalar > vector
A scalar version of the templated Vector.
Macros for easy insertion into run-time selection tables.
Holds list of sampling points which is filled at construction time. Various implementations of this b...
A class for handling words, derived from string.
virtual ~faceOnlySet()
Destructor.
static const scalar tol
Tolerance when comparing points relative to difference between.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
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.
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.