115 using namespace Foam;
133 masterTimeDirs = localTimeDirs;
141 for (
const instant& t : masterTimeDirs)
143 if (!localTimeDirs.found(t))
163 const bool decompose,
165 const word& readTimeName,
171 const IOobject readIO(
"uniform", readTimeName, readDb);
182 if (!readPath.empty())
184 Info<<
"Detected additional non-decomposed files in " 213 Pout<<
" readPath :" << readPath <<
endl;
214 Pout<<
" writePath :" << writePath <<
endl;
215 Pout<<
" currentPath:" << currentPath <<
endl;
218 if (readPath == writePath)
223 if (currentPath.empty())
228 fh.
cp(readPath, writePath);
236 fh.
cp(readPath, writePath);
245 if (isA<fileOperations::collatedFileOperation>(fh))
251 fh.
cp(readPath, writePath);
258 fh.
cp(readPath, writePath);
293 label maxProcCells = 0;
294 label maxProcFaces = 0;
295 label totProcFaces = 0;
296 label maxProcPatches = 0;
297 label totProcPatches = 0;
301 const label nLocalCells = globalCells.
localSize(proci);
302 const label nBndFaces = globalBoundaryFaces.localSize(proci);
305 <<
"Processor " << proci;
315 <<
" Number of cells = " << nLocalCells <<
endl;
318 label nProcFaces = 0;
319 const labelList& nei = patchNeiProcNo[proci];
321 forAll(patchNeiProcNo[proci], i)
323 Info<<
" Number of faces shared with processor " 324 << patchNeiProcNo[proci][i] <<
" = " 325 << patchSize[proci][i] <<
nl;
327 nProcFaces += patchSize[proci][i];
331 Info<<
" Number of processor patches = " << nei.
size() <<
nl 332 <<
" Number of processor faces = " << nProcFaces <<
nl 333 <<
" Number of boundary faces = " 334 << nBndFaces-nProcFaces <<
endl;
337 maxProcCells =
max(maxProcCells, nLocalCells);
338 totProcFaces += nProcFaces;
339 totProcPatches += nei.
size();
340 maxProcFaces =
max(maxProcFaces, nProcFaces);
341 maxProcPatches =
max(maxProcPatches, nei.
size());
347 <<
"Number of processor faces = " << (totProcFaces/2) <<
nl 348 <<
"Max number of cells = " << maxProcCells;
350 if (maxProcCells != globalCells.totalSize())
354 Info<<
" (" << 100.0*(maxProcCells-avgValue)/avgValue
355 <<
"% above average " << avgValue <<
')';
359 Info<<
"Max number of processor patches = " << maxProcPatches;
364 Info<<
" (" << 100.0*(maxProcPatches-avgValue)/avgValue
365 <<
"% above average " << avgValue <<
')';
369 Info<<
"Max number of faces between processors = " << maxProcFaces;
374 Info<<
" (" << 100.0*(maxProcFaces-avgValue)/avgValue
375 <<
"% above average " << avgValue <<
')';
382 void writeDecomposition
404 cellDecomposition.write();
406 Info<<
"Writing wanted cell distribution to volScalarField " <<
name 407 <<
" for postprocessing purposes." <<
nl <<
endl;
422 zeroGradientFvPatchScalarField::typeName
427 procCells[celli] = decomp[celli];
430 procCells.correctBoundaryConditions();
435 void determineDecomposition
437 const Time& baseRunTime,
439 const bool decompose,
442 const bool writeCellDist,
460 <<
"You have selected decomposition method \"" 461 << decomposer.type() <<
"\n" 462 <<
" which does not synchronise decomposition across" 463 " processor patches.\n" 464 " You might want to select a decomposition method" 465 " that is aware of this. Continuing...." <<
endl;
474 <<
" to read decomposeParDict" <<
endl;
480 if (method.
found(
"weightField"))
496 cellWeights = weights.internalField();
504 Info<<
"Restoring caseName" <<
endl;
520 <<
" to write undecomposed cellDist" <<
endl;
524 writeDecomposition(
"cellDist",
mesh, decomp);
525 Info<<
"Restoring caseName" <<
endl;
534 writeDecomposition(
"cellDist",
mesh, decomp);
542 template<
class CoupledPatchType,
class GeoField>
543 void correctCoupledBoundaryConditions(
fvMesh&
mesh)
547 fld.boundaryFieldRef().template evaluateCoupled<CoupledPatchType>();
556 const Time& baseRunTime,
560 const bool doReadFields,
561 const bool decompose,
563 const bool overwrite,
566 const label nDestProcs,
632 if (volMeshOnProc.
found(
false))
654 <<
" mesh:" <<
mesh.objectRegistry::objectRelPath()
655 <<
" have objects:" << objects.
names() <<
endl;
659 auto iter = objects.find(
"cellDist");
674 #undef doFieldReading 675 #define doFieldReading(Storage) \ 677 fieldsDistributor::readFields \ 679 volMeshOnProc, mesh, subsetterPtr, objects, Storage \ 684 doFieldReading(volScalarFields);
685 doFieldReading(volVectorFields);
686 doFieldReading(volSphereTensorFields);
687 doFieldReading(volSymmTensorFields);
688 doFieldReading(volTensorFields);
691 doFieldReading(surfScalarFields);
692 doFieldReading(surfVectorFields);
693 doFieldReading(surfSphereTensorFields);
694 doFieldReading(surfSymmTensorFields);
695 doFieldReading(surfTensorFields);
698 doFieldReading(dimScalarFields);
699 doFieldReading(dimVectorFields);
700 doFieldReading(dimSphereTensorFields);
701 doFieldReading(dimSymmTensorFields);
702 doFieldReading(dimTensorFields);
707 #undef doFieldReading 708 #define doFieldReading(Storage) \ 710 fieldsDistributor::readFields \ 712 volMeshOnProc, oldPointMesh, subsetterPtr, objects, Storage, \ 715 nPointFields += Storage.size(); \ 718 doFieldReading(pointScalarFields);
719 doFieldReading(pointVectorFields);
720 doFieldReading(pointSphTensorFields);
721 doFieldReading(pointSymmTensorFields);
722 doFieldReading(pointTensorFields);
723 #undef doFieldReading 738 pointDistributor.saveMeshPoints();
749 Info<<
"After distribution:" <<
endl;
755 #undef doCorrectCoupled 756 #define doCorrectCoupled(FieldType) \ 757 correctCoupledBoundaryConditions<processorFvPatch, FieldType>(mesh); 764 #undef doCorrectCoupled 777 pointDistributor.resetTarget(newPointMesh, distMap());
779 pointDistributor.distributeAndStore(pointScalarFields);
780 pointDistributor.distributeAndStore(pointVectorFields);
781 pointDistributor.distributeAndStore(pointSphTensorFields);
782 pointDistributor.distributeAndStore(pointSymmTensorFields);
783 pointDistributor.distributeAndStore(pointTensorFields);
823 <<
" to write reconstructed mesh (and fields)." <<
endl;
831 Info<<
"Restoring caseName" <<
endl;
841 defaultHandler =
fileHandler(std::move(writeHandler));
848 writeHandler =
fileHandler(std::move(defaultHandler));
852 Info<<
"Written redistributed mesh to " 865 std::move(writeHandler)
909 refData.distribute(distMap());
922 <<
" to write reconstructed refinement data." <<
endl;
929 Info<<
"Restoring caseName" <<
endl;
1004 int main(
int argc,
char *argv[])
1008 "Redistribute decomposed mesh and fields according" 1009 " to the decomposeParDict settings.\n" 1010 "Optionally run in decompose/reconstruct mode" 1027 "Test without writing the decomposition. " 1028 "Changes -cellDist to only write volScalarField." 1034 "Write cell distribution as a labelList - for use with 'manual' " 1035 "decomposition method or as a volScalarField for post-processing." 1040 "Only reconstruct new times (i.e. that do not exist already)" 1044 "Additional verbosity. (Can be used multiple times)" 1049 "Suppress finiteArea mesh/field handling",
1072 != fileOperations::uncollatedFileOperation::typeName
1098 const bool writeCellDist =
args.
found(
"cellDist");
1100 const bool newTimes =
args.
found(
"newTimes");
1103 const bool doFiniteArea = !
args.
found(
"no-finite-area");
1104 bool decompose =
args.
found(
"decompose");
1105 bool overwrite =
args.
found(
"overwrite");
1126 const wordRes selectedLagrangianFields;
1131 Info<<
"Decomposing case (like decomposePar)" <<
nl <<
endl;
1135 <<
"Cannot specify both -decompose and -reconstruct" 1141 Info<<
"Reconstructing case (like reconstructParMesh)" <<
nl <<
endl;
1148 <<
"Working in -decompose or -reconstruct mode:" 1149 " automatically implies -overwrite" <<
nl <<
endl;
1155 <<
": This utility can only be run parallel" 1172 nfs = (roots.size() == 1);
1177 Info<<
"Detected multiple roots i.e. non-nfs running" 1190 Info<<
"Removing existing processor directory:" 1201 Info<<
"No processor directories; switching on decompose mode" 1217 Info<<
"Creating time directories on all processors" <<
nl <<
endl;
1240 Info<<
"Creating time directories for undecomposed Time" 1241 <<
" on all processors" <<
nl <<
endl;
1246 Info<<
"Create undecomposed database" <<
nl <<
endl;
1262 for (
const instant& t : baseTimeDirs)
1264 masterTimeDirSet.insert(t.name());
1293 if (timeDirs.
empty())
1296 <<
"No times selected" 1306 <<
"Reconstructing mesh and addressing" <<
nl <<
endl;
1319 bool areaMeshDetected =
false;
1326 baseRunTime.
setTime(timeDirs[timeI], timeI);
1368 volMeshInstance/volMeshSubDir,
1377 areaMeshInstance/areaMeshSubDir,
1381 areaMeshDetected = areaMeshOnProc.
found(
true);
1393 bool haveVolAddressing =
false;
1414 "faceProcAddressing",
1424 faceProcAddressing.headerOk()
1425 && faceProcAddressing.size() == faces.size()
1431 haveVolAddressing =
true;
1434 bool haveAreaAddressing =
false;
1455 "faceProcAddressing",
1463 haveAreaAddressing =
1465 faceProcAddressing.headerOk()
1466 && faceProcAddressing.size() == faceLabels.size()
1469 else if (areaMeshDetected)
1472 haveAreaAddressing =
true;
1480 bool volMeshHaveUndecomposed =
false;
1481 bool areaMeshHaveUndecomposed =
false;
1486 <<
" for undecomposed volume and area meshes..." 1505 volMeshHaveUndecomposed = facesIO.headerOk();
1522 areaMeshHaveUndecomposed = labelsIO.headerOk();
1531 volMeshHaveUndecomposed,
1532 areaMeshHaveUndecomposed
1537 Info<<
" volume mesh [" 1538 << volMeshHaveUndecomposed <<
"] : " 1539 << volMeshInstance <<
nl 1541 << areaMeshHaveUndecomposed <<
"] : " 1542 << areaMeshInstance <<
nl 1549 !volMeshHaveUndecomposed
1553 Info<<
"No undecomposed mesh. Creating from: " 1554 << volMeshInstance <<
endl;
1556 if (areaMeshHaveUndecomposed)
1558 areaMeshHaveUndecomposed =
false;
1559 Info<<
"Also ignore any undecomposed area mesh" 1581 const label nDestProcs(1);
1584 redistributeAndWrite
1586 std::move(writeHandler),
1614 areaMeshOnProc.
found(
true)
1617 !areaMeshHaveUndecomposed
1622 Info<<
"Loading area mesh from " 1623 << areaMeshInstance <<
endl;
1625 Info<<
" getting volume mesh support" <<
endl;
1645 baseMeshPtr().facesInstance(),
1698 Info<<
"Setting caseName to " << baseRunTime.
caseName()
1699 <<
" to write reconstructed area mesh." <<
endl;
1703 areaBaseMeshPtr().write();
1706 Info<<
"Restoring caseName" <<
endl;
1717 std::move(writeHandler),
1732 <<
"Reconstructing fields" <<
nl <<
endl;
1735 baseRunTime.
setTime(timeDirs[0], 0);
1743 Info<<
"Reading undecomposed mesh (on master)" <<
endl;
1759 Info<<
"Reading local, decomposed mesh" <<
endl;
1765 baseMeshPtr().facesInstance(),
1780 if (areaMeshDetected)
1800 areaBaseMeshPtr().facesInstance(),
1849 auto fvDistributorPtr =
1862 auto pointFieldDistributorPtr =
1879 Info<<
" Detected initial mesh motion;" 1880 <<
" reconstructing points" <<
nl 1882 fvDistributorPtr().reconstructPoints();
1889 if (newTimes && masterTimeDirSet.found(timeDirs[timeI].name()))
1891 Info<<
"Skipping time " << timeDirs[timeI].name()
1898 baseRunTime.
setTime(timeDirs[timeI], timeI);
1908 Info<<
" Detected mesh motion; reconstructing points" 1910 fvDistributorPtr().reconstructPoints();
1918 Info<<
" Detected topology change;" 1919 <<
" reconstructing addressing" <<
nl <<
endl;
1926 baseMeshPtr.
clear();
1946 fvDistributorPtr.reset
1961 pointFieldDistributorPtr.reset
1973 lagrangianDistributorPtr.
reset();
1977 Info<<
" Discarding finite-area addressing" 1978 <<
" (TODO)" <<
nl <<
endl;
1980 areaBaseMeshPtr.
reset();
1981 areaMeshPtr.reset();
1982 faDistributor.
reset();
1983 areaDistMap.
clear();
1994 .distributeAllFields(objects, selectedFields);
1998 pointFieldDistributorPtr()
1999 .distributeAllFields(objects, selectedFields);
2005 lagrangianDistributorPtr,
2009 selectedLagrangianFields
2015 .distributeAllFields(objects, selectedFields);
2038 baseMeshPtr().time()
2071 Info<<
"Setting time to that of master or undecomposed case : " 2072 << masterTime <<
endl;
2074 baseRunTime.
setTime(masterTime, 0);
2088 << (decompose ?
"Decomposing" :
"Redistributing")
2102 bool volMeshHaveUndecomposed =
true;
2103 bool areaMeshHaveUndecomposed = doFiniteArea;
2109 Info<<
"Checking undecomposed mesh in case: " 2135 if (
"constant" == areaMeshMasterInstance)
2142 areaMeshMasterInstance/areaMeshSubDir,
2148 if (areaMeshOnProc.
empty() || !areaMeshOnProc[0])
2150 areaMeshHaveUndecomposed =
false;
2159 Info<<
" volume mesh [" 2160 << volMeshHaveUndecomposed <<
"] : " 2161 << volMeshMasterInstance <<
nl 2163 << areaMeshHaveUndecomposed <<
"] : " 2164 << areaMeshMasterInstance <<
nl 2176 volMeshHaveUndecomposed,
2177 areaMeshHaveUndecomposed,
2178 volMeshMasterInstance,
2179 areaMeshMasterInstance
2191 volMeshMasterInstance/volMeshSubDir,
2200 areaMeshMasterInstance/areaMeshSubDir,
2217 volMeshMasterInstance/volMeshSubDir,
2228 Info<<
"Per processor faces dirs:" <<
nl 2236 if (!volMeshOnProc[proci])
2238 Info<<
" [missing]";
2256 areaMeshMasterInstance/areaMeshSubDir,
2267 Info<<
"Per processor faceLabels dirs:" <<
nl 2275 if (!areaMeshOnProc[proci])
2277 Info<<
" [missing]";
2291 Info<<
"Setting caseName to " << baseRunTime.
caseName()
2292 <<
" to read undecomposed mesh" <<
endl;
2303 volMeshMasterInstance,
2324 ? areaMeshHaveUndecomposed
2325 : areaMeshOnProc.
found(
true)
2334 areaMeshMasterInstance,
2352 Info<<
"Removing left-over empty processor directories" <<
nl;
2362 for (
const auto proci : procs)
2366 !volMeshOnProc[proci]
2367 && volMeshDir[proci] != volMeshDir[myProci]
2375 !areaMeshOnProc[proci]
2376 && areaMeshDir[proci] != areaMeshDir[myProci]
2385 if (proci != myProci)
2404 Info<<
"Restoring caseName" <<
endl;
2423 determineDecomposition
2473 areaMeshMasterInstance,
2492 selectedLagrangianFields
2506 std::move(writeHandler),
2522 volMeshMasterInstance,
2530 lagrangianDistributorPtr,
2562 Info<<
"Setting caseName to " << baseRunTime.
caseName()
2563 <<
" to write reconstructed mesh (and fields)." 2569 areaProcMeshPtr->
write();
2572 Info<<
"Restoring caseName" <<
endl;
2582 defaultHandler =
fileHandler(std::move(writeHandler));
2592 areaProcMeshPtr->
thisDb(),
2600 areaProcMeshPtr->
write();
2604 writeHandler =
fileHandler(std::move(defaultHandler));
2614 std::move(writeHandler)
2619 Info<<
"Written redistributed mesh to " 2629 areaFields.redistributeAndWrite(distributor,
true);
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
virtual fileName dirPath(const bool checkGlobal, const IOobject &io, const bool search=true) const =0
Search for a directory. checkGlobal : also check undecomposed.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addNote(const string ¬e)
Add extra notes for the usage information.
void size(const label n)
Older name for setAddressableSize.
boolList haveMeshFile(const Time &runTime, const fileName &meshPath, const word &meshFile="faces", const bool verbose=true)
Check for availability of specified mesh file (default: "faces")
fileName path() const
Return path.
A class for handling file names.
Inter-processor communication reduction functions.
virtual bool parallelAware() const =0
Is method parallel aware?
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable, so the various sorted methods should be used if traversing in parallel.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const fileName & facesInstance() const
Return the current instance directory for faces.
void off()
Switch the function objects off.
word findInstance(const fileName &dir, const word &name=word::null, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, const word &stopInstance=word::null) const
Return time instance (location) of dir that contains the file name (eg, used in reading mesh data)...
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
static void removeFiles(const polyMesh &)
Helper: remove all relevant files from mesh instance.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void unset(bool verbose=false)
Deactivate SIGFPE signal handler and NaN memory initialisation.
const word & regionName() const
The mesh region name or word::null if polyMesh::defaultRegion.
virtual bool write(const bool valid=true) const
Write mesh.
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
static rangeType allProcs(const label communicator=worldComm)
Range of process indices for all processes.
const fileName & caseName() const noexcept
Return case name.
const labelList & processorPatches() const noexcept
Return list of processor patch labels.
constexpr char nl
The newline '\n' character (0x0a)
int debugSwitch(const char *name, const int deflt=0)
Lookup debug switch or add default value.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
static label nDomains(const dictionary &decompDict, const word ®ionName="")
Return region-specific or top-level numberOfSubdomains entry.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
wordList names() const
The unsorted names of all objects.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights) const
Return the wanted processor number for every coordinate.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool found(const T &val, label pos=0) const
True if the value if found in the list.
static bool & parRun() noexcept
Test if this a parallel run.
void clear() noexcept
Same as reset(nullptr)
fileName relativePath(const fileName &input, const bool caseTag=false) const
Return the input relative to the globalPath by stripping off a leading value of the globalPath...
static unsigned int defaultPrecision() noexcept
Return the default precision.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
const fileName & rootPath() const noexcept
Return root path.
autoPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
void clear()
Reset to zero size, only retaining communicator(s)
Ignore writing from objectRegistry::writeObject()
Reading, reconstruct, redistribution of lagrangian fields.
const dimensionSet dimless
Dimensionless.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
static const decompositionModel & New(const polyMesh &mesh, const fileName &decompDictFile="", const dictionary *fallback=nullptr)
Read and register on mesh, optionally with alternative decomposeParDict path/name or with fallback co...
const Time & time() const
Return the top-level database.
static label worldComm
Default world communicator (all processors). May differ from globalComm if local worlds are in use...
A IOmapDistributePolyMesh wrapper for using referenced external data.
Distributor/redistributor for point fields, uses a two (or three) stage construction.
decompositionMethod & decomposer() const
Return demand-driven decomposition method.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
instantList select(const instantList ×) const
Select a list of Time values that are within the ranges.
virtual const objectRegistry & thisDb() const
Return reference to the mesh database.
bool processorCase() const noexcept
Return true if this is a processor case.
An encapsulation of filesystem-related operations.
static void broadcast(Type &value, const label comm=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all processes in communicator.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
Neighbour processor patch.
Mesh representing a set of points created from polyMesh.
#define forAll(list, i)
Loop across all elements in list.
void removeEmptyDirs(const fileName &path)
Remove empty directories from bottom up.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
static void allGatherList(List< T > &values, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Gather data, but keep individual values separate. Uses linear/tree communication. ...
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Foam::word regionName(Foam::polyMesh::defaultRegion)
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator) is 1 for serial run.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
bool returnReduceAnd(const bool value, const label comm=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
static void gatherList(const List< commsStruct > &comms, List< T > &values, const int tag, const label comm)
Gather data, but keep individual values separate. Uses the specified communication schedule...
const fileName & pointsInstance() const
Return the current instance directory for points.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
void setSize(const label n)
Alias for resize()
static int verbose_
Output verbosity when writing.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in time.
void removeFiles(const fileName &instanceDir) const
Remove all files from mesh instance.
Finite volume reconstructor for volume and surface fields.
void redistributeLagrangian(autoPtr< parLagrangianDistributor > &distributorPtr, const fvMesh &mesh, const label nOldCells, const mapDistributePolyMesh &distMap, PtrList< unmappedPassivePositionParticleCloud > &clouds)
A class for handling words, derived from Foam::string.
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
const Time & time() const noexcept
Return time registry.
int dryRun() const noexcept
Return the dry-run flag.
static word defaultRegion
Return the default region name.
Extract command arguments and options from the supplied argc and argv parameters. ...
List helper to append y unique elements onto the end of x.
const word & system() const noexcept
Return system name.
static int verbose_
Output verbosity when writing.
static void addVerboseOption(const string &usage, bool advanced=false)
Enable a 'verbose' bool option, with usage information.
Simple container to manage read/write, redistribute finiteArea fields.
Miscellaneous file handling for meshes.
static const word null
An empty word.
A List of wordRe with additional matching capabilities.
void removeEmptyDir(const fileName &path)
Remove empty directory.
Finite area area (element) fields.
const globalMeshData & globalData() const
Return parallel info.
static instantList selectIfPresent(Time &runTime, const argList &args)
If any time option provided return the set of times (as select0) otherwise return just the current ti...
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
Abstract base class for domain decomposition.
int neighbProcNo() const
Return neighbour processor number.
MeshObject wrapper of decompositionMethod.
fileName relativePath(const fileName &input, const bool caseTag=false) const
Return the input relative to the globalPath by stripping off a leading value of the globalPath...
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...
bool rmDir(const fileName &directory, const bool silent=false, const bool emptyOnly=false)
Remove a directory and its contents recursively,.
virtual bool cp(const fileName &src, const fileName &dst, const bool followLink=true) const =0
Copy, recursively if necessary, the source to the destination.
void reconstructLagrangian(autoPtr< parLagrangianDistributor > &distributorPtr, const fvMesh &baseMesh, const fvMesh &mesh, const mapDistributePolyMesh &distMap, const wordRes &selectedFields)
static word timeName(const scalar t, const int precision=precision_)
Return time name of given scalar time formatted with the given precision.
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
const word & constant() const noexcept
Return constant name.
int debug
Static debugging option.
const fileName & rootPath() const noexcept
Return root path.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
static void broadcasts(const label comm, Type &arg1, Args &&... args)
Broadcast multiple items to all processes in communicator.
fileName path() const
Return the full path to the (processor local) case.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void removeFiles(const fileName &instanceDir) const
Remove all files from mesh instance.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name...
static word meshSubDir
The mesh sub-directory name (usually "faMesh")
const fileName & facesInstance() const
Return the current instance directory for faces.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
static instantList findTimes(const fileName &directory, const word &constantName="constant")
Search a given directory for valid time directories.
PtrList< unmappedPassivePositionParticleCloud > readLagrangian(const fvMesh &mesh, const wordList &cloudNames, const wordRes &selectedFields)
instantList times() const
Search the case for valid time directories.
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
const functionObjectList & functionObjects() const
Return the list of function objects.
#define WarningInFunction
Report a warning using Foam::Warning.
const fileName & globalCaseName() const noexcept
Return global case name.
static List< int > & procID(const label communicator)
Process IDs within a given communicator.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label nCells() const noexcept
Number of mesh cells.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Mesh data needed to do the Finite Volume discretisation.
static bool master(const label communicator=worldComm)
Am I the master rank.
Mesh data needed to do the Finite Area discretisation.
Automatically write from objectRegistry::writeObject()
const dictionary & controlDict() const
Return read access to the controlDict dictionary.
messageStream Info
Information stream (stdout output on master, null elsewhere)
void removeProcAddressing(const faMesh &mesh)
Remove procAddressing.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Various for reading/decomposing/reconstructing/distributing refinement data.
T * get() noexcept
Return pointer to managed object without nullptr checking.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Mesh consisting of general polyhedral cells.
readUpdateState
Enumeration defining the state of the mesh after a read update.
Registry of regIOobjects.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
UPtrList< const regIOobject > sorted() const
Return sorted list of objects.
virtual bool write(const bool valid=true) const
Write using setting from DB.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
Foam::argList args(argc, argv)
Defines the attributes of an object for which implicit objectRegistry management is supported...
virtual fileName objectPath(const IOobject &io, const word &typeName) const
Generate disk file name for object. Opposite of filePath.
int verbose() const noexcept
Return the verbose flag.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
bool found(const word &optName) const
Return true if the named option is found.
static mapDistributePolyMesh distribute(const faMesh &oldMesh, const mapDistributePolyMesh &distMap, const polyMesh &tgtPolyMesh, autoPtr< faMesh > &newMeshPtr)
Distribute mesh according to the given (volume) mesh distribution.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
fileName globalPath() const
Return the full path to the global case.
static autoPtr< fileOperation > NewUncollated()
Static construct the commonly used uncollatedFileOperation.
label localSize() const
My local size.
static constexpr const zero Zero
Global zero (0)