33 template<
class TrackCloudType>
36 TrackCloudType&
cloud,
38 const scalar trackFraction
41 typename TrackCloudType::particleType&
p =
42 static_cast<typename TrackCloudType::particleType&
>(*this);
43 typename TrackCloudType::particleType::trackingData& ttd =
44 static_cast<typename TrackCloudType::particleType::trackingData&
>(td);
48 label origFacei =
face();
49 label patchi =
patch();
53 if (
face() != origFacei)
60 if (isA<processorPolyPatch>(
patch))
62 p.hitProcessorPatch(
cloud, ttd);
64 else if (isA<wallPolyPatch>(
patch))
66 p.hitWallPatch(
cloud, ttd);
78 template<
class TrackCloudType>
81 TrackCloudType&
cloud,
107 scalar trackFraction = 0.0;
109 if (!td.isWallPatch_[tetFace()])
113 const edge meshEdge(currentEdge());
117 if (
mesh().isInternalFace(tetFace()))
128 tetIndices nbrTi(nbrCelli, tetFace(), tetPt());
130 const bool posVol = (nbrTi.
tet(
mesh()).
mag() > 0);
131 const vector path(endPosition - localPosition_);
138 this->
cell() = nbrCelli;
139 patchInteraction(
cloud, td, trackFraction);
145 crossEdgeConnectedFace(meshEdge);
146 patchInteraction(
cloud, td, trackFraction);
153 crossEdgeConnectedFace(meshEdge);
154 patchInteraction(
cloud, td, trackFraction);
162 if (
mesh().isInternalFace(tetFace()))
165 <<
"Can only track on boundary faces."
166 <<
" Face:" << tetFace()
171 const triFace tri(currentTetIndices().faceTriIs(
mesh(),
false));
174 point projectedEndPosition = endPosition;
176 const bool posVol = (currentTetIndices().tet(
mesh()).mag() > 0);
181 projectedEndPosition =
182 localPosition_ - (endPosition - localPosition_);
186 const vector d(endPosition - localPosition_);
187 const scalar magD(
mag(d));
188 if (magD > ROOTVSMALL)
193 meshBb.inflate(ROOTSMALL);
196 projectedEndPosition = localPosition_ -
meshBb.mag()*d/magD;
201 bool ok =
meshBb.intersects
203 projectedEndPosition,
204 localPosition_ - projectedEndPosition,
205 projectedEndPosition,
213 projectedEndPosition = intPt;
221 projectedEndPosition -= ((projectedEndPosition - basePt)&
n)*
n;
225 bool doTrack =
false;
226 if (meshEdgeStart_ == -1 && diagEdge_ == -1)
235 doTrack = isTriAlongTrack(
n, projectedEndPosition);
243 trackFraction = trackFaceTri(
n, projectedEndPosition, triEdgei);
251 return trackFraction;
254 const tetIndices ti(currentTetIndices());
267 const label fp0 = trif[0];
271 if (trif[1] ==
f.fcIndex(fp0))
275 meshEdgeStart_ = fp0;
277 crossEdgeConnectedFace(currentEdge());
278 patchInteraction(cloud, td, trackFraction);
280 else if (trif[1] ==
f.rcIndex(fp0))
288 meshEdgeStart_ =
f.rcIndex(fp0);
290 crossEdgeConnectedFace(currentEdge());
291 patchInteraction(cloud, td, trackFraction);
296 diagEdge_ = trif[1] - fp0;
299 diagEdge_ +=
f.size();
306 else if (triEdgei == 1)
310 meshEdgeStart_ = trif[1];
312 crossEdgeConnectedFace(currentEdge());
313 patchInteraction(cloud, td, trackFraction);
317 if (trif[2] ==
f.rcIndex(fp0))
321 meshEdgeStart_ = trif[2];
323 crossEdgeConnectedFace(currentEdge());
324 patchInteraction(cloud, td, trackFraction);
326 else if (trif[2] ==
f.fcIndex(fp0))
333 meshEdgeStart_ = fp0;
335 crossEdgeConnectedFace(currentEdge());
336 patchInteraction(cloud, td, trackFraction);
342 diagEdge_ = trif[2] - fp0;
345 diagEdge_ +=
f.size();
357 if (meshEdgeStart_ != -1)
360 crossEdgeConnectedFace(currentEdge());
362 patchInteraction(cloud, td, trackFraction);
376 return trackFraction;
380 template<
class TrackCloudType>
383 TrackCloudType&
cloud,
388 td.switchProcessor =
true;
397 if (meshEdgeStart_ != -1)
399 meshEdgeStart_ =
f.size() - meshEdgeStart_-1;
404 diagEdge_ =
f.size() - diagEdge_;
409 template<
class TrackCloudType>
418 template<
class TrackCloudType>
428 IOField<point> localPosition
432 c.checkFieldIOobject(
c, localPosition);
434 IOField<label> meshEdgeStart
438 c.checkFieldIOobject(
c, meshEdgeStart);
440 IOField<label> diagEdge
444 c.checkFieldIOobject(
c, diagEdge);
447 for (wallBoundedParticle&
p :
c)
449 p.localPosition_ = localPosition[i];
450 p.meshEdgeStart_ = meshEdgeStart[i];
451 p.diagEdge_ = diagEdge[i];
458 template<
class TrackCloudType>
465 IOField<point> localPosition
470 IOField<label> meshEdgeStart
475 IOField<label> diagEdge
482 for (
const wallBoundedParticle&
p :
c)
484 localPosition[i] =
p.localPosition_;
485 meshEdgeStart[i] =
p.meshEdgeStart_;
486 diagEdge[i] =
p.diagEdge_;
491 localPosition.write();
492 meshEdgeStart.write();