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 point trackPt = singleParticle.position();
63 point oldPoint = trackPt;
65 singleParticle.trackToFace(end_ - start_, 0, trackData);
67 trackPt = singleParticle.position();
69 if (singleParticle.face() != -1 &&
mag(oldPoint - trackPt) > smallDist)
72 samplingPts.append(trackPt);
73 samplingCells.append(singleParticle.cell());
74 samplingFaces.append(singleParticle.face());
75 samplingCurveDist.append(
mag(trackPt - start_));
78 if (
mag(trackPt - end_) < smallDist)
83 else if (singleParticle.onBoundaryFace())
92 void Foam::faceOnlySet::calcSamples
94 DynamicList<point>& samplingPts,
95 DynamicList<label>& samplingCells,
96 DynamicList<label>& samplingFaces,
97 DynamicList<label>& samplingSegments,
98 DynamicList<scalar>& samplingCurveDist
102 if (
mag(end_ - start_) < SMALL)
105 <<
"Incorrect sample specification :" 106 <<
" start equals end point." <<
endl 107 <<
" start:" << start_
112 const vector offset = (end_ - start_);
113 const vector normOffset = offset/
mag(offset);
114 const vector smallVec = tol*offset;
115 const scalar smallDist =
mag(smallVec);
118 const bool oldMoving =
const_cast<polyMesh&
>(
mesh()).moving(
false);
119 passiveParticleCloud particleCloud(
mesh());
128 point bPoint(GREAT, GREAT, GREAT);
133 bPoint = bHits[0].hitPoint();
134 bFacei = bHits[0].index();
139 label trackCelli = -1;
140 label trackFacei = -1;
162 if (trackCelli == -1)
171 const_cast<polyMesh&
>(
mesh()).moving(oldMoving);
175 if (trackFacei == -1)
178 trackFacei = findNearFace(trackCelli, trackPt, smallDist);
195 label startSegmentI = 0;
202 if (trackFacei != -1)
205 samplingPts.append(trackPt);
206 samplingCells.append(trackCelli);
207 samplingFaces.append(trackFacei);
208 samplingCurveDist.append(
mag(trackPt - start_));
212 passiveParticle singleParticle
219 bool reachedBoundary = trackToBoundary
231 for (
label i = samplingPts.size() - 1; i >= startSegmentI; --i)
233 samplingSegments.append(segmentI);
236 if (!reachedBoundary)
244 bool foundValidB =
false;
246 while (bHitI < bHits.size())
249 (bHits[bHitI].hitPoint() - singleParticle.position())
258 if (dist > smallDist)
270 if (!foundValidB || bHitI == bHits.size() - 1)
277 trackFacei = bHits[bHitI].index();
278 trackPt = pushIn(bHits[bHitI].hitPoint(), trackFacei);
279 trackCelli = getBoundaryCell(trackFacei);
283 startSegmentI = samplingPts.size();
286 const_cast<polyMesh&
>(
mesh()).moving(oldMoving);
290 void Foam::faceOnlySet::genSamples()
293 DynamicList<point> samplingPts;
294 DynamicList<label> samplingCells;
295 DynamicList<label> samplingFaces;
296 DynamicList<label> samplingSegments;
297 DynamicList<scalar> samplingCurveDist;
308 samplingPts.shrink();
309 samplingCells.shrink();
310 samplingFaces.shrink();
311 samplingSegments.shrink();
312 samplingCurveDist.shrink();
360 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)
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.
List< pointIndexHit > intersections(const point &pStart, const point &pEnd) const
Find all intersections of boundary within segment pStart .. pEnd.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.