Go to the documentation of this file.
35 Foam::parLagrangianRedistributor::parLagrangianRedistributor
37 const fvMesh& srcMesh,
38 const fvMesh& tgtMesh,
39 const label nSrcCells,
40 const mapDistributePolyMesh& distMap
47 const mapDistribute& cellMap = distMap_.
cellMap();
51 cellMap.reverseDistribute(nSrcCells, destinationProcID_);
53 destinationCell_ =
identity(tgtMesh_.nCells());
54 cellMap.reverseDistribute(nSrcCells, destinationCell_);
66 List<wordList>& objectNames
92 for (
const fileName& localCloudName : localCloudDirs)
95 IOobjectList localObjs
102 bool isCloud =
false;
103 if (localObjs.erase(
"coordinates"))
107 if (localObjs.erase(
"positions"))
116 const label cloudi =
cloudNames.find(localCloudName);
118 objectNames[cloudi] = localObjs.sortedNames();
134 passivePositionParticleCloud& lpi
139 const label oldLpi = lpi.size();
150 List<IDLList<passivePositionParticle>> particleTransferLists
159 for (passivePositionParticle& ppi : lpi)
161 const label destProcI = destinationProcID_[ppi.cell()];
162 const label destCellI = destinationCell_[ppi.cell()];
164 ppi.cell() = destCellI;
165 destProc[particleI++] = destProcI;
166 particleTransferLists[destProcI].
append(lpi.remove(&ppi));
175 forAll(particleTransferLists, procI)
179 if (particleTransferLists[procI].size())
181 UOPstream particleStream(procI, pBufs);
182 particleStream << particleTransferLists[procI];
190 pBufs.finishedSends(allNTrans);
201 passivePositionParticleCloud lagrangianPositions
205 IDLList<passivePositionParticle>()
212 const label nRec = allNTrans[procI];
219 UIPstream particleStream(procI, pBufs);
222 IDLList<passivePositionParticle> newParticles
225 passivePositionParticle::iNew(tgtMesh_)
228 for (passivePositionParticle& newp : newParticles)
230 lagrangianPositions.addParticle(newParticles.remove(&newp));
235 if (lagrangianPositions.size())
238 IOPosition<passivePositionParticleCloud>
246 IOPosition<passivePositionParticleCloud>
259 const fileName oldCoords
261 IOPosition<passivePositionParticleCloud>
269 const fileName oldPos
271 IOPosition<passivePositionParticleCloud>
290 nsTransPs[sendProcI] = subMap[sendProcI].size();
296 label constructSize = 0;
297 forAll(constructMap, procI)
306 map[i] = constructSize++;
315 std::move(constructMap)
327 passivePositionParticleCloud lpi(srcMesh_,
cloudName,
false);
329 return redistributeLagrangianPositions(lpi);
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
List< label > labelList
A List of labels.
static const word prefix
The prefix to local: lagrangian.
const word cloudName(propsDict.get< word >("cloud"))
virtual const fileName & dbDir() const
Override the objectRegistry dbDir for a single-region case.
static word timeName(const scalar t, const int precision=precision_)
void combineReduce(const List< UPstream::commsStruct > &comms, T &Value, const CombineOp &cop, const int tag, const label comm)
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
void append(const T &val)
Append an element at the end of the list.
static bool writeLagrangianPositions
#define forAll(list, i)
Loop across all elements in list.
const mapDistribute & cellMap() const
Cell distribute map.
List< word > wordList
A List of words.
static void findClouds(const fvMesh &, wordList &cloudNames, List< wordList > &objectNames)
Find all clouds (on all processors) and for each cloud all.
fileName timePath() const
Return current time path.
autoPtr< mapDistributeBase > redistributeLagrangianPositions(passivePositionParticleCloud &cloud) const
Redistribute and write lagrangian positions.
const wordList cloudNames(cloudFields.sortedToc())
static void combineGather(const List< commsStruct > &comms, T &Value, const CombineOp &cop, const int tag, const label comm)
List< fileName > fileNameList
A List of fileNames.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
List< labelList > labelListList
A List of labelList.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
const Time & time() const
Return the top-level database.
Various functions to operate on Lists.
void setSize(const label newSize)
Alias for resize(const label)
labelListList invertOneToMany(const label len, const labelUList &map)
Invert one-to-many map. Unmapped elements will be size 0.
fileNameList readDir(const fileName &directory, const fileName::Type type=fileName::FILE, const bool filtergz=true, const bool followLink=true)
Read a directory and return the entries as a fileName List.
static void combineScatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
static label nProcs(const label communicator=worldComm)
Number of processes in parallel run, and 1 for serial run.