31 #include "passivePositionParticleCloud.H" 43 const fvMesh& srcMesh,
44 const fvMesh& tgtMesh,
45 const label nSrcCells,
46 const mapDistributePolyMesh& distMap
53 const mapDistribute& cellMap = distMap_.
cellMap();
57 cellMap.reverseDistribute(nSrcCells, destinationProcID_);
60 cellMap.reverseDistribute(nSrcCells, destinationCell_);
73 List<wordList>& objectNames
105 cloudNames.resize_nocopy(localCloudDirs.size());
108 cloudNames[i] = localCloudDirs[i];
115 const label nClouds = cloudNames.size();
118 haveClouds.resize_nocopy(nClouds);
121 for (
const fileName& localCloudName : localCloudDirs)
123 const label cloudi = cloudNames.find(localCloudName);
126 haveClouds[cloudi] =
true;
131 objectNames.resize_nocopy(nClouds);
133 for (label cloudi = 0; cloudi < nClouds; ++cloudi)
135 objectNames[cloudi].clear();
137 if (!haveClouds[cloudi])
continue;
141 IOobjectList localObjs
149 bool isCloud =
false;
150 if (localObjs.erase(
"coordinates"))
154 if (localObjs.erase(
"positions"))
162 objectNames[cloudi] = localObjs.sortedNames();
167 for (
wordList& objNames : objectNames)
178 passivePositionParticleCloud& lpi
192 List<IDLList<passivePositionParticle>> particleTransferLists
201 for (passivePositionParticle& ppi : lpi)
203 const label destProcI = destinationProcID_[ppi.cell()];
204 const label destCellI = destinationCell_[ppi.cell()];
206 ppi.cell() = destCellI;
207 destProc[particleI++] = destProcI;
208 particleTransferLists[destProcI].
append(lpi.remove(&ppi));
217 forAll(particleTransferLists, procI)
221 if (particleTransferLists[procI].size())
223 UOPstream particleStream(procI, pBufs);
224 particleStream << particleTransferLists[procI];
231 pBufs.finishedSends();
244 passivePositionParticleCloud lagrangianPositions
252 for (
const int proci : pBufs.allProcs())
257 if (pBufs.recvDataCount(proci))
259 UIPstream particleStream(proci, pBufs);
262 IDLList<passivePositionParticle> newParticles
265 passivePositionParticle::iNew(tgtMesh_)
268 for (passivePositionParticle& newp : newParticles)
270 lagrangianPositions.addParticle(newParticles.remove(&newp));
275 const bool writeOnProc = lagrangianPositions.size();
280 IOPosition<passivePositionParticleCloud>
283 ).
write(writeOnProc);
288 IOPosition<passivePositionParticleCloud>
292 ).
write(writeOnProc);
344 const bool oldDistributed =
352 passivePositionParticleCloud lpi(srcMesh_,
cloudName,
false);
355 handler.distributed(oldDistributed);
358 return distributeLagrangianPositions(lpi);
static int verbose_
Output verbosity when writing.
void append(const T &val)
Append an element at the end of the list.
static bool & parRun() noexcept
Test if this a parallel run.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler()
Ignore writing from objectRegistry::writeObject()
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.
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
#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. ...
static void findClouds(const fvMesh &, wordList &cloudNames, boolList &haveClouds, List< wordList > &objectNames)
Find all clouds (on all processors) and for each cloud all the objects. Result will be synchronised o...
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), works like std::iota() but returning a...
const word cloudName(propsDict.get< word >("cloud"))
void sort(UList< T > &list)
Sort the list.
static const word null
An empty word.
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 int cacheLevel() noexcept
Return cache level.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value 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.
"nonBlocking" : (MPI_Isend, MPI_Irecv)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
List< label > labelList
A List of labels.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
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.
List< bool > boolList
A List of bools.
Do not request registration (bool: false)
autoPtr< mapDistributeBase > distributeLagrangianPositions(passivePositionParticleCloud &cloud) const
Redistribute and write lagrangian positions.
static const word prefix
The prefix to local: lagrangian.