109 using namespace Foam;
115 #define InfoOrPout (::debug ? Pout : Info.stream()) 121 getNewHandler(
const boolUList& useProc,
const bool verbose =
true)
128 if (::
debug && handler)
130 Pout<<
"Allocated " << handler().info()
145 handler = getNewHandler(useProc);
159 masterTimeDirs = localTimeDirs;
165 for (
const instant& t : masterTimeDirs)
167 if (!localTimeDirs.contains(t))
191 const bool decompose,
193 const word& readTimeName,
233 readPath = readHandler().dirPath
236 IOobject(
"uniform", readTimeName, readDb),
253 if (!readPath.empty())
256 <<
"Detected additional non-decomposed files in " 314 Pout<<
" readPath :" << readPath <<
endl;
315 Pout<<
" writePath :" << writePath <<
endl;
359 label maxProcCells = 0;
360 label maxProcFaces = 0;
361 label totProcFaces = 0;
362 label maxProcPatches = 0;
363 label totProcPatches = 0;
367 const label nLocalCells = globalCells.
localSize(proci);
368 const label nBndFaces = globalBoundaryFaces.localSize(proci);
371 <<
"Processor " << proci;
375 InfoOrPout<<
" (empty)" <<
endl;
381 <<
" Number of cells = " << nLocalCells <<
endl;
384 label nProcFaces = 0;
385 const labelList& nei = patchNeiProcNo[proci];
387 forAll(patchNeiProcNo[proci], i)
390 <<
" Number of faces shared with processor " 391 << patchNeiProcNo[proci][i] <<
" = " 392 << patchSize[proci][i] <<
nl;
394 nProcFaces += patchSize[proci][i];
399 <<
" Number of processor patches = " << nei.
size() <<
nl 400 <<
" Number of processor faces = " << nProcFaces <<
nl 401 <<
" Number of boundary faces = " 402 << nBndFaces-nProcFaces <<
endl;
405 maxProcCells =
max(maxProcCells, nLocalCells);
406 totProcFaces += nProcFaces;
407 totProcPatches += nei.
size();
408 maxProcFaces =
max(maxProcFaces, nProcFaces);
409 maxProcPatches =
max(maxProcPatches, nei.
size());
416 <<
"Number of processor faces = " << (totProcFaces/2) <<
nl 417 <<
"Max number of cells = " << maxProcCells;
419 if (maxProcCells != globalCells.totalSize())
424 <<
" (" << 100.0*(maxProcCells-avgValue)/avgValue
425 <<
"% above average " << avgValue <<
')';
429 InfoOrPout<<
"Max number of processor patches = " << maxProcPatches;
435 <<
" (" << 100.0*(maxProcPatches-avgValue)/avgValue
436 <<
"% above average " << avgValue <<
')';
440 InfoOrPout<<
"Max number of faces between processors = " << maxProcFaces;
446 <<
" (" << 100.0*(maxProcFaces-avgValue)/avgValue
447 <<
"% above average " << avgValue <<
')';
454 void writeDecomposition
478 <<
"Writing wanted cell distribution to volScalarField " <<
name 479 <<
" for postprocessing purposes." <<
nl <<
endl;
499 procCells[celli] = decomp[celli];
502 procCells.correctBoundaryConditions();
507 void determineDecomposition
510 const Time& baseRunTime,
512 const bool decompose,
515 const bool writeCellDist,
537 <<
"You have selected decomposition method \"" 538 << decomposer.type() <<
"\n" 539 <<
" which does not synchronise decomposition across" 540 " processor patches.\n" 541 " You might want to select a decomposition method" 542 " that is aware of this. Continuing...." <<
endl;
551 <<
"Setting caseName to " << baseRunTime.
caseName()
552 <<
" to read decomposeParDict" <<
endl;
558 if (method.
found(
"weightField"))
575 cellWeights = weights.internalField();
587 <<
"Restoring caseName" <<
endl;
595 const label oldNumProcs =
606 <<
"Setting caseName to " << baseRunTime.
caseName()
607 <<
" to write undecomposed cellDist" <<
endl;
611 writeDecomposition(
"cellDist",
mesh, decomp);
612 InfoOrPout<<
"Restoring caseName" <<
endl;
621 writeDecomposition(
"cellDist",
mesh, decomp);
631 template<
class CoupledPatchType,
class GeoField>
632 void correctCoupledBoundaryConditions(
fvMesh&
mesh)
636 fld.boundaryFieldRef().template evaluateCoupled<CoupledPatchType>();
646 const Time& baseRunTime,
650 const bool doReadFields,
651 const bool decompose,
653 const bool overwrite,
656 const label nDestProcs,
726 if (volMeshOnProc.
found(
false))
731 subsetterPtr().subMesh().init(
true);
732 subsetterPtr().subMesh().globalData();
733 subsetterPtr().subMesh().tetBasePtIs();
734 subsetterPtr().subMesh().geometricD();
742 <<
"Setting caseName to " << baseRunTime.
caseName()
743 <<
" to read IOobjects" <<
endl;
764 <<
"Restoring caseName" <<
endl;
771 <<
" mesh:" <<
mesh.objectRegistry::objectRelPath()
772 <<
" have objects:" << objects.
names() <<
endl;
776 (void)objects.
erase(
"cellDist");
787 #undef doFieldReading 788 #define doFieldReading(Storage) \ 790 fieldsDistributor::readFields \ 792 volMeshOnProc, readHandler, mesh, subsetterPtr, \ 798 doFieldReading(volScalarFields);
799 doFieldReading(volVectorFields);
800 doFieldReading(volSphereTensorFields);
801 doFieldReading(volSymmTensorFields);
802 doFieldReading(volTensorFields);
805 doFieldReading(surfScalarFields);
806 doFieldReading(surfVectorFields);
807 doFieldReading(surfSphereTensorFields);
808 doFieldReading(surfSymmTensorFields);
809 doFieldReading(surfTensorFields);
812 doFieldReading(dimScalarFields);
813 doFieldReading(dimVectorFields);
814 doFieldReading(dimSphereTensorFields);
815 doFieldReading(dimSymmTensorFields);
816 doFieldReading(dimTensorFields);
821 #undef doFieldReading 822 #define doFieldReading(Storage) \ 824 fieldsDistributor::readFields \ 826 volMeshOnProc, readHandler, oldPointMesh, \ 827 subsetterPtr, objects, Storage, \ 830 nPointFields += Storage.size(); \ 833 doFieldReading(pointScalarFields);
834 doFieldReading(pointVectorFields);
835 doFieldReading(pointSphTensorFields);
836 doFieldReading(pointSymmTensorFields);
837 doFieldReading(pointTensorFields);
838 #undef doFieldReading 853 pointDistributor.saveMeshPoints();
902 refDataPtr().sync(
io);
916 InfoOrPout<<
"After distribution:" <<
endl;
922 #undef doCorrectCoupled 923 #define doCorrectCoupled(FieldType) \ 924 correctCoupledBoundaryConditions<processorFvPatch, FieldType>(mesh); 931 #undef doCorrectCoupled 944 pointDistributor.resetTarget(newPointMesh, distMap());
946 pointDistributor.distributeAndStore(pointScalarFields);
947 pointDistributor.distributeAndStore(pointVectorFields);
948 pointDistributor.distributeAndStore(pointSphTensorFields);
949 pointDistributor.distributeAndStore(pointSymmTensorFields);
950 pointDistributor.distributeAndStore(pointTensorFields);
992 <<
"Setting caseName to " << baseRunTime.
caseName()
993 <<
" to write reconstructed mesh (and fields)." <<
endl;
996 const label oldNumProcs
998 const_cast<fileOperation&>(
fileHandler()).nProcs(nDestProcs)
1006 InfoOrPout<<
"Restoring caseName" <<
endl;
1019 const label oldNumProcs
1021 const_cast<fileOperation&>(
fileHandler()).nProcs(nDestProcs)
1031 <<
"Written redistributed mesh to " 1075 auto& refData = refDataPtr();
1092 refData.distribute(distMap());
1102 const label oldNumProcs
1104 const_cast<fileOperation&>(
fileHandler()).nProcs(nDestProcs)
1108 <<
"Setting caseName to " << baseRunTime.
caseName()
1109 <<
" to write reconstructed refinement data." <<
endl;
1116 InfoOrPout<<
"Restoring caseName" <<
endl;
1126 const label oldNumProcs
1128 const_cast<fileOperation&>(
fileHandler()).nProcs(nDestProcs)
1199 int main(
int argc,
char *argv[])
1203 "Redistribute decomposed mesh and fields according" 1204 " to the decomposeParDict settings.\n" 1205 "Optionally run in decompose/reconstruct mode" 1221 "Additional verbosity. (Can be used multiple times for debugging)" 1225 "Test without writing the decomposition. " 1226 "Changes -cellDist to only write volScalarField." 1232 "Write cell distribution as a labelList - for use with 'manual' " 1233 "decomposition method or as a volScalarField for post-processing." 1238 "Only reconstruct new times (i.e. that do not exist already)" 1242 "Additional verbosity. (Can be used multiple times)" 1247 "Suppress finiteArea mesh/field handling",
1275 const bool hasDistributedFiles(
fileHandler().distributed());
1288 const bool writeCellDist =
args.
found(
"cellDist");
1290 const bool newTimes =
args.
found(
"newTimes");
1293 const bool doFiniteArea = !
args.
found(
"no-finite-area");
1294 bool decompose =
args.
found(
"decompose");
1295 bool overwrite =
args.
found(
"overwrite");
1299 const wordRes selectedLagrangianFields;
1305 <<
": This utility can only be run parallel" 1312 <<
"Cannot specify both -decompose and -reconstruct" 1324 Info<<
"Additional debugging enabled" <<
nl <<
endl;
1365 InfoOrPout<<
"Decomposing case (like decomposePar)" 1370 InfoOrPout<<
"Reconstructing case (like reconstructParMesh)" 1378 InfoOrPout<<
"Switching to exact matching for " 1380 <<
" processor directories" 1388 InfoOrPout<<
"Switching to matching any " 1399 <<
"Added implicit -overwrite for decompose/reconstruct modes" 1417 if (hasDistributedFiles)
1419 InfoOrPout<<
"Detected multiple roots i.e. non-nfs running" 1435 InfoOrPout<<
"Removing existing processor directory:" 1447 <<
"No processor directories; switching on decompose mode" 1458 <<
"Switching to exact matching for " 1460 <<
" processor directories" 1474 InfoOrPout<<
"Creating time directories on all processors" 1515 if (hasDistributedFiles)
1517 InfoOrPout<<
"Creating time directories for undecomposed Time" 1518 <<
" on all processors" <<
nl <<
endl;
1523 InfoOrPout<<
"Create undecomposed database" <<
nl <<
endl;
1545 for (
const instant& t : baseTimeDirs)
1547 masterTimeDirSet.
insert(t.name());
1575 if (timeDirs.
empty())
1578 <<
"No times selected" 1589 <<
"Reconstructing mesh and addressing" <<
nl <<
endl;
1606 <<
"Reconstructing mesh:" 1609 bool areaMeshDetected =
false;
1616 baseRunTime.
setTime(timeDirs[timeI], timeI);
1658 volMeshInstance/volMeshSubDir,
1663 newHandler(volMeshOnProc, volMeshReadHandler);
1670 areaMeshInstance/areaMeshSubDir,
1673 areaMeshDetected = areaMeshOnProc.found(
true);
1675 if (areaMeshOnProc == volMeshOnProc)
1677 if (volMeshReadHandler)
1680 areaMeshReadHandler.
ref(volMeshReadHandler.
ref());
1685 newHandler(areaMeshOnProc, areaMeshReadHandler);
1698 bool haveVolAddressing =
false;
1719 "faceProcAddressing",
1729 faceProcAddressing.headerOk()
1730 && faceProcAddressing.size() == faces.size()
1736 haveVolAddressing =
true;
1739 bool haveAreaAddressing =
false;
1760 "faceProcAddressing",
1768 haveAreaAddressing =
1770 faceProcAddressing.headerOk()
1774 else if (areaMeshDetected)
1777 haveAreaAddressing =
true;
1785 bool volMeshHaveUndecomposed =
false;
1786 bool areaMeshHaveUndecomposed =
false;
1791 <<
"Checking " << baseRunTime.
caseName()
1792 <<
" for undecomposed volume and area meshes..." 1812 volMeshHaveUndecomposed = facesIO.headerOk();
1829 areaMeshHaveUndecomposed = labelsIO.headerOk();
1835 ).nProcs(oldNumProcs);
1842 volMeshHaveUndecomposed,
1843 areaMeshHaveUndecomposed
1850 << volMeshHaveUndecomposed <<
"] : " 1851 << volMeshInstance <<
nl 1853 << areaMeshHaveUndecomposed <<
"] : " 1854 << areaMeshInstance <<
nl 1861 !volMeshHaveUndecomposed
1866 <<
"No undecomposed mesh. Creating from: " 1867 << volMeshInstance <<
endl;
1869 if (areaMeshHaveUndecomposed)
1871 areaMeshHaveUndecomposed =
false;
1873 <<
"Also ignore any undecomposed area mesh" 1892 InfoOrPout<<
nl <<
"Reconstructing mesh" <<
nl <<
endl;
1895 const label nDestProcs(1);
1898 redistributeAndWrite
1929 areaMeshOnProc.found(
true)
1932 !areaMeshHaveUndecomposed
1938 <<
"Loading area mesh from " 1939 << areaMeshInstance <<
endl;
1941 InfoOrPout<<
" getting volume mesh support" <<
endl;
1961 baseMeshPtr().facesInstance(),
2027 <<
"Setting caseName to " << baseRunTime.
caseName()
2028 <<
" to write reconstructed area mesh." <<
endl;
2034 areaBaseMeshPtr().write();
2037 InfoOrPout<<
"Restoring caseName" <<
endl;
2041 ).nProcs(oldNumProcs);
2069 <<
"Reconstructing fields" <<
nl <<
endl;
2072 baseRunTime.
setTime(timeDirs[0], 0);
2080 InfoOrPout<<
"Reading undecomposed mesh (on master)" <<
endl;
2121 Pout<<
"Undecomposed mesh :" 2122 <<
" instance:" << baseMeshPtr().facesInstance()
2123 <<
" nCells:" << baseMeshPtr().nCells()
2124 <<
" nFaces:" << baseMeshPtr().nFaces()
2125 <<
" nPoints:" << baseMeshPtr().nPoints()
2129 InfoOrPout<<
"Reading local, decomposed mesh" <<
endl;
2135 baseMeshPtr().facesInstance(),
2150 if (areaMeshDetected)
2169 baseMeshPtr().facesInstance(),
2194 areaBaseMeshPtr().facesInstance(),
2232 auto fvDistributorPtr =
2245 auto pointFieldDistributorPtr =
2264 <<
" Detected initial mesh motion;" 2265 <<
" reconstructing points" <<
nl 2267 fvDistributorPtr().reconstructPoints();
2274 if (newTimes && masterTimeDirSet.
found(timeDirs[timeI].name()))
2277 <<
"Skipping time " << timeDirs[timeI].name()
2284 baseRunTime.
setTime(timeDirs[timeI], timeI);
2295 <<
" Detected mesh motion; reconstructing points" 2297 fvDistributorPtr().reconstructPoints();
2306 <<
" Detected topology change;" 2307 <<
" reconstructing addressing" <<
nl <<
endl;
2314 baseMeshPtr.
clear();
2339 Pout<<
"Undecomposed mesh :" 2340 <<
" nCells:" << baseMeshPtr().nCells()
2341 <<
" nFaces:" << baseMeshPtr().nFaces()
2342 <<
" nPoints:" << baseMeshPtr().nPoints()
2353 fvDistributorPtr.reset
2368 pointFieldDistributorPtr.reset
2380 lagrangianDistributorPtr.
reset();
2385 <<
" Discarding finite-area addressing" 2386 <<
" (TODO)" <<
nl <<
endl;
2388 areaBaseMeshPtr.
reset();
2389 areaMeshPtr.
reset();
2390 faDistributor.
reset();
2391 areaDistMap.
clear();
2401 .distributeAllFields(objects, selectedFields);
2405 pointFieldDistributorPtr()
2406 .distributeAllFields(objects, selectedFields);
2412 lagrangianDistributorPtr,
2416 selectedLagrangianFields
2423 .distributeAllFields(objects, selectedFields);
2456 baseMeshPtr().time()
2483 <<
"Setting time to that of master or undecomposed case : " 2484 << masterTime <<
endl;
2486 baseRunTime.
setTime(masterTime, 0);
2509 << (decompose ?
"Decomposing" :
"Redistributing")
2523 bool volMeshHaveUndecomposed =
true;
2524 bool areaMeshHaveUndecomposed = doFiniteArea;
2531 <<
"Checking undecomposed mesh in case: " 2558 if (
"constant" == areaMeshMasterInstance)
2565 areaMeshMasterInstance/areaMeshSubDir,
2571 if (areaMeshOnProc.empty() || !areaMeshOnProc[0])
2573 areaMeshHaveUndecomposed =
false;
2585 << volMeshHaveUndecomposed <<
"] : " 2586 << volMeshMasterInstance <<
nl 2588 << areaMeshHaveUndecomposed <<
"] : " 2589 << areaMeshMasterInstance <<
nl 2593 InfoOrPout<<
"Restoring caseName" <<
endl;
2602 volMeshHaveUndecomposed,
2603 areaMeshHaveUndecomposed,
2604 volMeshMasterInstance,
2605 areaMeshMasterInstance
2627 volMeshMasterInstance/volMeshSubDir,
2633 newHandler(volMeshOnProc, volMeshReadHandler);
2656 areaMeshHaveUndecomposed;
2663 areaMeshMasterInstance/areaMeshSubDir,
2669 if (areaMeshOnProc == volMeshOnProc)
2671 if (volMeshReadHandler)
2674 areaMeshReadHandler.
ref(volMeshReadHandler.
ref());
2679 newHandler(areaMeshOnProc, areaMeshReadHandler);
2696 volMeshMasterInstance/volMeshSubDir,
2707 Info<<
"Per processor faces dirs:" <<
nl 2715 if (!volMeshOnProc[proci])
2717 Info<<
" [missing]";
2735 areaMeshMasterInstance/areaMeshSubDir,
2746 Info<<
"Per processor faceLabels dirs:" <<
nl 2754 if (!areaMeshOnProc[proci])
2756 Info<<
" [missing]";
2771 <<
"Setting caseName to " << baseRunTime.
caseName()
2772 <<
" to read undecomposed mesh" <<
endl;
2782 volMeshMasterInstance,
2803 ? areaMeshHaveUndecomposed
2804 : areaMeshOnProc.
found(
true)
2813 areaMeshMasterInstance,
2828 InfoOrPout<<
"Restoring caseName" <<
endl;
2841 determineDecomposition
2860 if (!writeHandler && nDestProcs <
fileHandler().nProcs())
2863 isWriteProc.slice(0, nDestProcs) =
true;
2866 << isWriteProc <<
"]" <<
nl 2868 newHandler(isWriteProc, writeHandler);
2882 areaMeshReadHandler,
2883 areaMeshMasterInstance,
2893 <<
"Setting caseName to " << baseRunTime.
caseName()
2894 <<
" to read lagrangian" <<
endl;
2917 selectedLagrangianFields
2923 InfoOrPout<<
"Restoring caseName" <<
endl;
2950 volMeshMasterInstance,
2957 lagrangianDistributorPtr,
2990 <<
"Setting caseName to " << baseRunTime.
caseName()
2991 <<
" to write reconstructed mesh (and fields)." 2998 areaProcMeshPtr->
write();
3001 InfoOrPout<<
"Restoring caseName" <<
endl;
3005 ).nProcs(oldNumProcs);
3022 areaProcMeshPtr->
thisDb(),
3030 areaProcMeshPtr->
write();
3047 <<
"Written redistributed mesh to " 3058 areaFields.redistributeAndWrite(distributor,
true);
3066 defaultHandler.
ref(writeHandler.
ref());
3083 (decompose ? baseRunTime.
caseName() : proc0CaseName),
3094 defaultHandler.
ref(writeHandler.
ref());
3110 (decompose ? baseRunTime.
caseName() : proc0CaseName),
3117 InfoOrPout<<
"End\n" <<
endl;
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
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...
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")
A class for handling file names.
readOption readOpt() const noexcept
Get the read option.
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.
static int nProcsFilter() noexcept
Return collated 'processorsDDD' filtering.
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.
bool found(const Key &key) const
Same as contains()
static void unset(bool verbose=false)
Deactivate SIGFPE handler and NaN memory initialisation.
const word & regionName() const
The mesh region name or word::null if polyMesh::defaultRegion.
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create a new MeshObject. Registered with typeName.
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 List 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")
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool found(const T &val, label pos=0) const
Same as contains()
wordList names() const
The unsorted names of the IOobjects.
static bool & parRun() noexcept
Test if this a parallel run.
void clear() noexcept
Same as reset(nullptr)
bool erase(iterator &iter)
Erase entry specified by given iterator and delete the allocated pointer.
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 the rootPath.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler()
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
labelList findIndices(const ListType &input, typename ListType::const_reference val, label start=0)
Linear search to find all occurrences of given element.
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)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
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
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
A IOmapDistributePolyMesh wrapper for using referenced external data.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
labelList faceLabels(nFaceLabels)
Distributor/redistributor for point fields, uses a two (or three) stage construction.
static word processorsBaseDir
Return the processors directory name (usually "processors")
decompositionMethod & decomposer() const
Return demand-driven decomposition method.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for managing references or pointers (no reference counting)
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
True if this is a processor case.
An encapsulation of filesystem-related operations.
UPtrList< Type > sorted()
Return sorted list of objects with a class satisfying isA<Type> or isType<Type> (with Strict) ...
static void broadcast(Type &value, const label comm=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all communicator ranks. Does nothing in non-paral...
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 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. ...
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). It 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.
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 expressions::valueTypeCode::INVALID.
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in time.
void masterMeshInstance(const IOobject &io, fileName &facesInstance, fileName &pointsInstance)
Determine master faces 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)
const functionObjectList & functionObjects() const noexcept
Return the list of function objects.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
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. ...
static constexpr int masterNo() noexcept
Relative rank for the master process - is always 0.
const word & system() const noexcept
Return system name.
static int verbose_
Output verbosity when writing.
Reading is optional [identical to LAZY_READ].
Simple container to manage read/write, redistribute finiteArea fields.
const fileName & globalCaseName() const noexcept
Return global case name.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
Miscellaneous file handling for meshes.
static const word null
An empty word.
A List of wordRe with additional matching capabilities.
Finite area area (element) fields.
const globalMeshData & globalData() const
Return parallel info (demand-driven)
label localSize(const label proci) const
Size of proci data.
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.
MeshObject wrapper of decompositionMethod.
static word controlDictName
The default control dictionary name (normally "controlDict")
const dictionary & controlDict() const noexcept
Return read access to the controlDict dictionary.
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...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
void reconstructLagrangian(autoPtr< parLagrangianDistributor > &distributorPtr, const fvMesh &baseMesh, const fvMesh &mesh, const mapDistributePolyMesh &distMap, const wordRes &selectedFields)
static void addVerboseOption(const string &usage="", bool advanced=false)
Enable a 'verbose' bool option, with usage information.
virtual bool write(const bool writeOnProc=true) const
Write mesh.
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.
T * get() noexcept
Return pointer without nullptr checking.
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.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
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 autoPtr< fileOperation > New(const word &handlerType, bool verbose=false)
Select fileHandler-type. Uses defaultFileHandler if the handlerType is empty.
static label commWorld() noexcept
Communicator for all ranks (respecting any local worlds)
messageStream Warning
Warning stream (stdout output on master, null elsewhere), with additional 'FOAM Warning' header text...
static void broadcasts(const label comm, Type &arg1, Args &&... args)
Broadcast multiple items to all communicator ranks. Does nothing in non-parallel. ...
static instantList findTimes(const fileName &directory, const word &constantDirName="constant")
Search a given directory for valid time directories.
fileName path() const
Return the full path to the (processor local) case.
int neighbProcNo() const noexcept
Return neighbour processor number.
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))
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)
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.
#define WarningInFunction
Report a warning using Foam::Warning.
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
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.
fileName meshDir() const
Return the local mesh directory (dbDir()/meshSubDir)
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Mesh data needed to do the Finite Area discretisation.
Automatically write from objectRegistry::writeObject()
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 ...
Reading is optional [identical to READ_IF_PRESENT].
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.
static const fileOperation & fileHandler()
Return the current file handler. Will create the default file handler if necessary.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Registry of regIOobjects.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Switch runTimeModifiable() const noexcept
Supports re-reading.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
Foam::argList args(argc, argv)
A IOList wrapper for writing external data.
Defines the attributes of an object for which implicit objectRegistry management is supported...
int verbose() const noexcept
Return the verbose flag.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Do not request registration (bool: false)
bool found(const word &optName) const
Return true if the named option is found.
PtrList< unmappedPassivePositionParticleCloud > readLagrangian(const fvMesh &mesh, const wordList &cloudNames, const boolUList &haveClouds, const wordRes &selectedFields)
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.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights=scalarField::null()) const
Return the wanted processor number for every coordinate, using uniform or specified point weights...
static autoPtr< fileOperation > NewUncollated()
The commonly used uncollatedFileOperation.
static constexpr const zero Zero
Global zero (0)