58 for (
int i = 0; i < pTraits<Type>::nComponents; ++i)
77 const wordRes& filters
80 if (!filters.empty() && !filters.match(
name))
88 writePropertyName<Type>(
os,
name, delim);
102 const Field<Type>&
values,
105 const wordRes& filters
108 if (!filters.empty() && !filters.match(
name))
123 writePropertyName<Type>(
os, tag, delim);
139 template<
class TrackCloudType>
142 const bool valid =
c.size();
146 const bool haveFile = procIO.typeHeaderOk<IOField<label>>(
true);
148 IOField<label> origProcId(procIO, valid && haveFile);
149 c.checkFieldIOobject(
c, origProcId);
151 IOField<label> origId
156 c.checkFieldIOobject(
c, origId);
159 for (particle&
p :
c)
161 p.origProc_ = origProcId[i];
162 p.origId_ = origId[i];
169 template<
class TrackCloudType>
172 const label np =
c.size();
173 const bool valid = np;
175 if (writeLagrangianCoordinates)
177 IOPosition<TrackCloudType> ioP(
c);
180 else if (!writeLagrangianPositions)
183 <<
"Must select coordinates and/or positions" <<
nl
188 if (writeLagrangianPositions)
190 IOPosition<TrackCloudType> ioP
198 IOField<label> origProc
203 IOField<label> origId
210 for (
const particle&
p :
c)
212 origProc[i] =
p.origProc_;
213 origId[i] =
p.origId_;
218 origProc.write(valid);
223 template<
class CloudType>
230 const label np =
c.size();
231 const label newNp = (positionPtr ? positionPtr->size() : 0);
234 for (label i = newNp; i < np; ++i)
236 parcelType*
p =
c.last();
238 c.deleteParticle(*
p);
243 const auto& position = *positionPtr;
245 const auto& origProcId = cloud::lookupIOField<label>(
"origProc", obr);
246 const auto& origId = cloud::lookupIOField<label>(
"origId", obr);
249 for (label i = np; i < newNp; ++i)
251 c.addParticle(
new parcelType(
c.pMesh(), position[i], -1));
255 for (particle&
p :
c)
257 p.origProc_ = origProcId[i];
258 p.origId_ = origId[i];
263 p.relocate(position[i]);
272 template<
class CloudType>
275 const label np =
c.size();
277 auto& origProc = cloud::createIOField<label>(
"origProc", np, obr);
278 auto& origId = cloud::createIOField<label>(
"origId", np, obr);
279 auto& position = cloud::createIOField<point>(
"position", np, obr);
282 for (
const particle&
p :
c)
284 origProc[i] =
p.origProc_;
285 origId[i] =
p.origId_;
286 position[i] =
p.position();
293 template<
class TrackCloudType>
296 const vector& displacement,
297 TrackCloudType& cloud,
301 typename TrackCloudType::particleType&
p =
302 static_cast<typename TrackCloudType::particleType&
>(*this);
303 typename TrackCloudType::particleType::trackingData& ttd =
304 static_cast<typename TrackCloudType::particleType::trackingData&
>(td);
310 else if (onInternalFace())
314 else if (onBoundaryFace())
316 changeToMasterPatch();
318 if (!
p.hitPatch(cloud, ttd))
320 const polyPatch&
patch = mesh_.boundaryMesh()[
p.patch()];
322 if (isA<wedgePolyPatch>(
patch))
324 p.hitWedgePatch(cloud, ttd);
326 else if (isA<symmetryPlanePolyPatch>(
patch))
328 p.hitSymmetryPlanePatch(cloud, ttd);
330 else if (isA<symmetryPolyPatch>(
patch))
332 p.hitSymmetryPatch(cloud, ttd);
334 else if (isA<cyclicPolyPatch>(
patch))
336 p.hitCyclicPatch(cloud, ttd);
338 else if (isA<cyclicACMIPolyPatch>(
patch))
340 p.hitCyclicACMIPatch(cloud, ttd, displacement);
342 else if (isA<cyclicAMIPolyPatch>(
patch))
344 p.hitCyclicAMIPatch(cloud, ttd, displacement);
346 else if (isA<processorPolyPatch>(
patch))
348 p.hitProcessorPatch(cloud, ttd);
350 else if (isA<wallPolyPatch>(
patch))
352 p.hitWallPatch(cloud, ttd);
356 td.keepParticle =
false;
363 template<
class TrackCloudType>
367 const scalar fraction,
368 TrackCloudType& cloud,
378 template<
class TrackCloudType>
385 template<
class TrackCloudType>
389 <<
"Hitting a wedge patch should not be possible."
392 hitSymmetryPatch(
cloud, td);
396 template<
class TrackCloudType>
399 TrackCloudType&
cloud,
403 hitSymmetryPatch(
cloud, td);
407 template<
class TrackCloudType>
412 transformProperties(
I - 2.0*nf*nf);
416 template<
class TrackCloudType>
422 const label receiveFacei = receiveCpp.
whichFace(facei_);
426 celli_ = mesh_.faceOwner()[facei_];
428 tetPti_ = mesh_.faces()[tetFacei_].size() - 1 - tetPti_;
440 : receiveCpp.
forwardT()[receiveFacei]
442 transformProperties(
T);
452 transformProperties(-
s);
457 template<
class TrackCloudType>
462 const vector& displacement
467 const cyclicAMIPolyPatch& cpp =
468 static_cast<const cyclicAMIPolyPatch&
>(mesh_.boundaryMesh()[
patch()]);
469 const cyclicAMIPolyPatch& receiveCpp = cpp.
neighbPatch();
470 const label sendFacei = cpp.
whichFace(facei_);
471 const label receiveFacei = cpp.pointFace(sendFacei, displacement,
pos);
473 if (receiveFacei < 0)
477 td.keepParticle =
false;
479 <<
"Particle lost across " << cyclicAMIPolyPatch::typeName
480 <<
" patches " << cpp.name() <<
" and " << receiveCpp.name()
481 <<
" at position " <<
pos <<
endl;
485 facei_ = tetFacei_ = receiveFacei + receiveCpp.start();
488 vector displacementT = displacement;
489 cpp.reverseTransformDirection(displacementT, sendFacei);
495 const vector dispDir = cpp.fraction()*displacementT;
496 stepFraction_ += cpp.fraction();
501 mesh_.faceOwner()[facei_],
503 "Particle crossed between " + cyclicAMIPolyPatch::typeName +
504 " patches " + cpp.
name() +
" and " + receiveCpp.name() +
505 " to a location outside of the mesh."
513 if (!receiveCpp.parallel())
517 receiveCpp.forwardT().size() == 1
518 ? receiveCpp.forwardT()[0]
519 : receiveCpp.forwardT()[receiveFacei]
521 transformProperties(
T);
523 else if (receiveCpp.separated())
527 (receiveCpp.separation().size() == 1)
528 ? receiveCpp.separation()[0]
529 : receiveCpp.separation()[receiveFacei]
531 transformProperties(-
s);
556 template<
class TrackCloudType>
559 TrackCloudType& cloud,
561 const vector& displacement
564 const cyclicACMIPolyPatch& cpp =
565 static_cast<const cyclicACMIPolyPatch&
>(mesh_.boundaryMesh()[
patch()]);
567 const label localFacei = cpp.whichFace(facei_);
571 const scalar mask = cpp.mask()[localFacei];
572 bool couple = mask >= 1 - cpp.tolerance();
573 bool nonOverlap = mask <= cpp.tolerance();
578 if (!couple && !nonOverlap)
581 couple = cpp.pointFace(localFacei, displacement,
pos) >= 0;
582 nonOverlap = !couple;
587 hitCyclicAMIPatch(cloud, td, displacement);
593 tetFacei_ = facei_ = cpp.nonOverlapPatch().start() + localFacei;
594 hitFace(displacement,
cloud, td);
599 template<
class TrackCloudType>
604 template<
class TrackCloudType>