31 #include "passivePositionParticleCloud.H" 42 const fvMesh& srcMesh,
43 const fvMesh& tgtMesh,
44 const label nSrcCells,
45 const mapDistributePolyMesh& distMap
52 const mapDistribute& cellMap = distMap_.
cellMap();
56 cellMap.reverseDistribute(nSrcCells, destinationProcID_);
59 cellMap.reverseDistribute(nSrcCells, destinationCell_);
71 List<wordList>& objectNames
85 cloudNames.setSize(localCloudDirs.size());
88 cloudNames[i] = localCloudDirs[i];
96 objectNames.resize(cloudNames.size());
98 for (
const fileName& localCloudName : localCloudDirs)
101 IOobjectList localObjs
108 bool isCloud =
false;
109 if (localObjs.erase(
"coordinates"))
113 if (localObjs.erase(
"positions"))
122 const label cloudi = cloudNames.find(localCloudName);
124 objectNames[cloudi] = localObjs.sortedNames();
129 for (
wordList& objNames : objectNames)
140 passivePositionParticleCloud& lpi
145 const label oldLpi = lpi.size();
155 List<IDLList<passivePositionParticle>> particleTransferLists
164 for (passivePositionParticle& ppi : lpi)
166 const label destProcI = destinationProcID_[ppi.cell()];
167 const label destCellI = destinationCell_[ppi.cell()];
169 ppi.cell() = destCellI;
170 destProc[particleI++] = destProcI;
171 particleTransferLists[destProcI].
append(lpi.remove(&ppi));
180 forAll(particleTransferLists, procI)
184 if (particleTransferLists[procI].size())
186 UOPstream particleStream(procI, pBufs);
187 particleStream << particleTransferLists[procI];
194 pBufs.finishedSends();
205 passivePositionParticleCloud lagrangianPositions
209 IDLList<passivePositionParticle>()
213 for (
const int proci : pBufs.allProcs())
218 if (pBufs.recvDataCount(proci))
220 UIPstream particleStream(proci, pBufs);
223 IDLList<passivePositionParticle> newParticles
226 passivePositionParticle::iNew(tgtMesh_)
229 for (passivePositionParticle& newp : newParticles)
231 lagrangianPositions.addParticle(newParticles.remove(&newp));
236 if (lagrangianPositions.size())
239 IOPosition<passivePositionParticleCloud>
247 IOPosition<passivePositionParticleCloud>
260 const fileName oldCoords
262 IOPosition<passivePositionParticleCloud>
270 const fileName oldPos
272 IOPosition<passivePositionParticleCloud>
293 label constructSize = 0;
296 forAll(constructMap, proci)
298 const label len = recvSizes[proci];
299 constructMap[proci] =
identity(len, constructSize);
300 constructSize += len;
307 std::move(constructMap)
319 passivePositionParticleCloud lpi(srcMesh_,
cloudName,
false);
321 return distributeLagrangianPositions(lpi);
static void findClouds(const fvMesh &, wordList &cloudNames, List< wordList > &objectNames)
Find all clouds (on all processors) and for each cloud all the objects. Result will be synchronised o...
static int verbose_
Output verbosity when writing.
fileName timePath() const
Return current time path.
void append(const T &val)
Append an element at the end of the list.
virtual const fileName & dbDir() const
Override the objectRegistry dbDir for a single-region case.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
const Time & time() const
Return the top-level database.
List< labelList > labelListList
List of labelList.
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run. ...
labelListList invertOneToMany(const label len, const labelUList &map)
Invert one-to-many map. Unmapped elements will be size 0.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
const word cloudName(propsDict.get< word >("cloud"))
void sort(UList< T > &list)
Sort the list.
const mapDistribute & cellMap() const noexcept
Cell distribute map.
static void combineReduce(const List< commsStruct > &comms, T &value, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) applying cop to inplace combine value from different processors...
static word timeName(const scalar t, const int precision=precision_)
Return time name of given scalar time formatted with the given precision.
parLagrangianDistributor(const parLagrangianDistributor &)=delete
No copy construct.
List< word > wordList
List of word.
static bool writeLagrangianPositions
Write particle positions file (v1706 format and earlier) Default is true (disable in etc/controlDict)...
label nCells() const noexcept
Number of mesh cells.
static void exchangeSizes(const labelUList &sendProcs, const labelUList &recvProcs, const Container &sendBufs, labelList &sizes, const label tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Helper: exchange sizes of sendBufs for specified send/recv ranks.
"nonBlocking" : (MPI_Isend, MPI_Irecv)
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
List< label > labelList
A List of labels.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
List< fileName > fileNameList
List of fileName.
fileNameList readDir(const fileName &directory, const fileName::Type type=fileName::Type::FILE, const bool filtergz=true, const bool followLink=true)
Read a directory and return the entries as a fileName List.
autoPtr< mapDistributeBase > distributeLagrangianPositions(passivePositionParticleCloud &cloud) const
Redistribute and write lagrangian positions.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
static const word prefix
The prefix to local: lagrangian.