46 bool Foam::polyLineSet::trackToBoundary
48 passiveParticleCloud& particleCloud,
49 passiveParticle& singleParticle,
51 DynamicList<point>& samplingPts,
52 DynamicList<label>& samplingCells,
53 DynamicList<label>& samplingFaces,
54 DynamicList<scalar>& samplingCurveDist
57 particle::TrackingData<passiveParticleCloud> trackData(particleCloud);
62 const vector offset = sampleCoords_[sampleI+1] - sampleCoords_[sampleI];
63 const scalar smallDist =
mag(tol*offset);
65 singleParticle.track(offset, 0);
66 const point trackPt = singleParticle.position();
68 if (singleParticle.onBoundaryFace())
74 mag(trackPt - sampleCoords_[sampleI+1])
82 samplingPts.append(trackPt);
83 samplingCells.append(singleParticle.cell());
84 samplingFaces.append(singleParticle.face());
87 samplingCurveDist.append(1.0*(sampleI+1));
93 samplingPts.append(trackPt);
94 samplingCells.append(singleParticle.cell());
95 samplingFaces.append(-1);
99 mag(trackPt - sampleCoords_[sampleI])
100 /
mag(sampleCoords_[sampleI+1] - sampleCoords_[sampleI]);
101 samplingCurveDist.append(sampleI + dist);
106 if (sampleI == sampleCoords_.size() - 1)
117 void Foam::polyLineSet::calcSamples
119 DynamicList<point>& samplingPts,
120 DynamicList<label>& samplingCells,
121 DynamicList<label>& samplingFaces,
122 DynamicList<label>& samplingSegments,
123 DynamicList<scalar>& samplingCurveDist
127 if (sampleCoords_.size() < 2)
130 <<
"Incorrect sample specification. Too few points:" 133 point oldPoint = sampleCoords_[0];
134 for (
label sampleI = 1; sampleI < sampleCoords_.size(); sampleI++)
136 if (
mag(sampleCoords_[sampleI] - oldPoint) < SMALL)
139 <<
"Incorrect sample specification." 140 <<
" Point " << sampleCoords_[sampleI-1]
141 <<
" at position " << sampleI-1
142 <<
" and point " << sampleCoords_[sampleI]
143 <<
" at position " << sampleI
146 oldPoint = sampleCoords_[sampleI];
150 const bool oldMoving =
const_cast<polyMesh&
>(
mesh()).moving(
false);
151 passiveParticleCloud particleCloud(
mesh());
157 label startSegmentI = 0;
161 point lastSample(GREAT, GREAT, GREAT);
166 label trackCelli = -1;
167 label trackFacei = -1;
172 sampleCoords_[sampleI+1] - sampleCoords_[sampleI];
173 const scalar smallDist =
mag(tol*offset);
179 sampleCoords_[sampleI],
180 sampleCoords_[sampleI+1]
183 point bPoint(GREAT, GREAT, GREAT);
188 bPoint = bHits[0].hitPoint();
189 bFacei = bHits[0].index();
197 sampleCoords_[sampleI],
207 if (isSample && (
mag(lastSample - trackPt) > smallDist))
217 samplingPts.append(trackPt);
218 samplingCells.append(trackCelli);
219 samplingFaces.append(trackFacei);
224 mag(trackPt - sampleCoords_[sampleI])
225 /
mag(sampleCoords_[sampleI+1] - sampleCoords_[sampleI]);
226 samplingCurveDist.append(sampleI + dist);
228 lastSample = trackPt;
231 if (trackCelli == -1)
236 }
while ((trackCelli == -1) && (sampleI < sampleCoords_.size() - 1));
238 if (sampleI == sampleCoords_.size() - 1)
251 passiveParticle singleParticle
258 bool bReached = trackToBoundary
270 for (
label i = samplingPts.size() - 1; i >= startSegmentI; --i)
272 samplingSegments.append(segmentI);
282 lastSample = singleParticle.position();
288 if (sampleI == sampleCoords_.size() - 1)
298 startSegmentI = samplingPts.size();
301 const_cast<polyMesh&
>(
mesh()).moving(oldMoving);
305 void Foam::polyLineSet::genSamples()
308 DynamicList<point> samplingPts;
309 DynamicList<label> samplingCells;
310 DynamicList<label> samplingFaces;
311 DynamicList<label> samplingSegments;
312 DynamicList<scalar> samplingCurveDist;
323 samplingPts.shrink();
324 samplingCells.shrink();
325 samplingFaces.shrink();
326 samplingSegments.shrink();
327 samplingCurveDist.shrink();
352 sampleCoords_(sampleCoords)
372 sampleCoords_(dict.
lookup(
"points"))
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.
virtual ~polyLineSet()
Destructor.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Vector< scalar > vector
A scalar version of the templated Vector.
Macros for easy insertion into run-time selection tables.
static const scalar tol
Tolerance when comparing points relative to difference between.
Holds list of sampling points which is filled at construction time. Various implementations of this b...
A class for handling words, derived from string.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
vector point
Point is a vector.
dimensioned< scalar > mag(const dimensioned< Type > &)
polyLineSet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const word &axis, const List< point > &samplePoints)
Construct from components.
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.