110 using namespace Foam;
116 #define InfoOrPout (::debug ? Pout : Info.stream()) 122 getNewHandler(
const boolUList& useProc,
const bool verbose =
true)
129 if (::
debug && handler)
131 Pout<<
"Allocated " << handler().info()
146 handler = getNewHandler(useProc);
160 masterTimeDirs = localTimeDirs;
166 for (
const instant& t : masterTimeDirs)
168 if (!localTimeDirs.contains(t))
192 const bool decompose,
194 const word& readTimeName,
234 readPath = readHandler().dirPath
237 IOobject(
"uniform", readTimeName, readDb),
254 if (!readPath.empty())
257 <<
"Detected additional non-decomposed files in " 315 Pout<<
" readPath :" << readPath <<
endl;
316 Pout<<
" writePath :" << writePath <<
endl;
360 label maxProcCells = 0;
361 label maxProcFaces = 0;
362 label totProcFaces = 0;
363 label maxProcPatches = 0;
364 label totProcPatches = 0;
368 const label nLocalCells = globalCells.
localSize(proci);
369 const label nBndFaces = globalBoundaryFaces.localSize(proci);
372 <<
"Processor " << proci;
376 InfoOrPout<<
" (empty)" <<
endl;
382 <<
" Number of cells = " << nLocalCells <<
endl;
385 label nProcFaces = 0;
386 const labelList& nei = patchNeiProcNo[proci];
388 forAll(patchNeiProcNo[proci], i)
391 <<
" Number of faces shared with processor " 392 << patchNeiProcNo[proci][i] <<
" = " 393 << patchSize[proci][i] <<
nl;
395 nProcFaces += patchSize[proci][i];
400 <<
" Number of processor patches = " << nei.
size() <<
nl 401 <<
" Number of processor faces = " << nProcFaces <<
nl 402 <<
" Number of boundary faces = " 403 << nBndFaces-nProcFaces <<
endl;
406 maxProcCells =
max(maxProcCells, nLocalCells);
407 totProcFaces += nProcFaces;
408 totProcPatches += nei.
size();
409 maxProcFaces =
max(maxProcFaces, nProcFaces);
410 maxProcPatches =
max(maxProcPatches, nei.
size());
417 <<
"Number of processor faces = " << (totProcFaces/2) <<
nl 418 <<
"Max number of cells = " << maxProcCells;
420 if (maxProcCells != globalCells.totalSize())
425 <<
" (" << 100.0*(maxProcCells-avgValue)/avgValue
426 <<
"% above average " << avgValue <<
')';
430 InfoOrPout<<
"Max number of processor patches = " << maxProcPatches;
436 <<
" (" << 100.0*(maxProcPatches-avgValue)/avgValue
437 <<
"% above average " << avgValue <<
')';
441 InfoOrPout<<
"Max number of faces between processors = " << maxProcFaces;
447 <<
" (" << 100.0*(maxProcFaces-avgValue)/avgValue
448 <<
"% above average " << avgValue <<
')';
455 void writeDecomposition
479 <<
"Writing wanted cell distribution to volScalarField " <<
name 480 <<
" for postprocessing purposes." <<
nl <<
endl;
500 procCells[celli] = decomp[celli];
503 procCells.correctBoundaryConditions();
508 void determineDecomposition
511 const Time& baseRunTime,
513 const bool decompose,
516 const bool writeCellDist,
538 <<
"You have selected decomposition method \"" 539 << decomposer.type() <<
"\n" 540 <<
" which does not synchronise decomposition across" 541 " processor patches.\n" 542 " You might want to select a decomposition method" 543 " that is aware of this. Continuing...." <<
endl;
552 <<
"Setting caseName to " << baseRunTime.
caseName()
553 <<
" to read decomposeParDict" <<
endl;
559 if (method.
found(
"weightField"))
576 cellWeights = weights.internalField();
588 <<
"Restoring caseName" <<
endl;
596 const label oldNumProcs =
607 <<
"Setting caseName to " << baseRunTime.
caseName()
608 <<
" to write undecomposed cellDist" <<
endl;
612 writeDecomposition(
"cellDist",
mesh, decomp);
613 InfoOrPout<<
"Restoring caseName" <<
endl;
622 writeDecomposition(
"cellDist",
mesh, decomp);
632 template<
class CoupledPatchType,
class GeoField>
633 void correctCoupledBoundaryConditions(
fvMesh&
mesh)
637 fld.boundaryFieldRef().template evaluateCoupled<CoupledPatchType>();
647 const Time& baseRunTime,
651 const bool doReadFields,
652 const bool decompose,
654 const bool overwrite,
657 const label nDestProcs,
727 if (volMeshOnProc.
found(
false))
732 subsetterPtr().subMesh().init(
true);
733 subsetterPtr().subMesh().globalData();
734 subsetterPtr().subMesh().tetBasePtIs();
735 subsetterPtr().subMesh().geometricD();
743 <<
"Setting caseName to " << baseRunTime.
caseName()
744 <<
" to read IOobjects" <<
endl;
765 <<
"Restoring caseName" <<
endl;
772 <<
" mesh:" <<
mesh.objectRegistry::objectRelPath()
773 <<
" have objects:" << objects.
names() <<
endl;
777 (void)objects.
erase(
"cellDist");
788 #undef doFieldReading 789 #define doFieldReading(Storage) \ 791 fieldsDistributor::readFields \ 793 volMeshOnProc, readHandler, mesh, subsetterPtr, \ 799 doFieldReading(volScalarFields);
800 doFieldReading(volVectorFields);
801 doFieldReading(volSphereTensorFields);
802 doFieldReading(volSymmTensorFields);
803 doFieldReading(volTensorFields);
806 doFieldReading(surfScalarFields);
807 doFieldReading(surfVectorFields);
808 doFieldReading(surfSphereTensorFields);
809 doFieldReading(surfSymmTensorFields);
810 doFieldReading(surfTensorFields);
813 doFieldReading(dimScalarFields);
814 doFieldReading(dimVectorFields);
815 doFieldReading(dimSphereTensorFields);
816 doFieldReading(dimSymmTensorFields);
817 doFieldReading(dimTensorFields);
822 #undef doFieldReading 823 #define doFieldReading(Storage) \ 825 fieldsDistributor::readFields \ 827 volMeshOnProc, readHandler, oldPointMesh, \ 828 subsetterPtr, objects, Storage, \ 831 nPointFields += Storage.size(); \ 834 doFieldReading(pointScalarFields);
835 doFieldReading(pointVectorFields);
836 doFieldReading(pointSphTensorFields);
837 doFieldReading(pointSymmTensorFields);
838 doFieldReading(pointTensorFields);
839 #undef doFieldReading 854 pointDistributor.saveMeshPoints();
903 refDataPtr().sync(
io);
915 std::unique_ptr<faMeshesRegistry> faMeshesRegistry_saved
931 InfoOrPout<<
"After distribution:" <<
endl;
937 #undef doCorrectCoupled 938 #define doCorrectCoupled(FieldType) \ 939 correctCoupledBoundaryConditions<processorFvPatch, FieldType>(mesh); 946 #undef doCorrectCoupled 959 pointDistributor.resetTarget(newPointMesh, distMap());
961 pointDistributor.distributeAndStore(pointScalarFields);
962 pointDistributor.distributeAndStore(pointVectorFields);
963 pointDistributor.distributeAndStore(pointSphTensorFields);
964 pointDistributor.distributeAndStore(pointSymmTensorFields);
965 pointDistributor.distributeAndStore(pointTensorFields);
1007 <<
"Setting caseName to " << baseRunTime.
caseName()
1008 <<
" to write reconstructed mesh (and fields)." <<
endl;
1011 const label oldNumProcs
1013 const_cast<fileOperation&>(
fileHandler()).nProcs(nDestProcs)
1021 InfoOrPout<<
"Restoring caseName" <<
endl;
1034 const label oldNumProcs
1036 const_cast<fileOperation&>(
fileHandler()).nProcs(nDestProcs)
1046 <<
"Written redistributed mesh to " 1090 auto& refData = refDataPtr();
1107 refData.distribute(distMap());
1117 const label oldNumProcs
1119 const_cast<fileOperation&>(
fileHandler()).nProcs(nDestProcs)
1123 <<
"Setting caseName to " << baseRunTime.
caseName()
1124 <<
" to write reconstructed refinement data." <<
endl;
1131 InfoOrPout<<
"Restoring caseName" <<
endl;
1141 const label oldNumProcs
1143 const_cast<fileOperation&>(
fileHandler()).nProcs(nDestProcs)
1214 int main(
int argc,
char *argv[])
1218 "Redistribute decomposed mesh and fields according" 1219 " to the decomposeParDict settings.\n" 1220 "Optionally run in decompose/reconstruct mode" 1236 "Additional verbosity. (Can be used multiple times for debugging)" 1240 "Test without writing the decomposition. " 1241 "Changes -cellDist to only write volScalarField." 1247 "Write cell distribution as a labelList - for use with 'manual' " 1248 "decomposition method or as a volScalarField for post-processing." 1253 "Only reconstruct new times (i.e. that do not exist already)" 1257 "Additional verbosity. (Can be used multiple times)" 1262 "Suppress finiteArea mesh/field handling",
1290 const bool hasDistributedFiles(
fileHandler().distributed());
1303 const bool writeCellDist =
args.
found(
"cellDist");
1305 const bool newTimes =
args.
found(
"newTimes");
1308 const bool doFiniteArea = !
args.
found(
"no-finite-area");
1309 bool decompose =
args.
found(
"decompose");
1310 bool overwrite =
args.
found(
"overwrite");
1314 const wordRes selectedLagrangianFields;
1320 <<
": This utility can only be run parallel" 1327 <<
"Cannot specify both -decompose and -reconstruct" 1339 Info<<
"Additional debugging enabled" <<
nl <<
endl;
1380 InfoOrPout<<
"Decomposing case (like decomposePar)" 1385 InfoOrPout<<
"Reconstructing case (like reconstructParMesh)" 1393 InfoOrPout<<
"Switching to exact matching for " 1395 <<
" processor directories" 1403 InfoOrPout<<
"Switching to matching any " 1414 <<
"Added implicit -overwrite for decompose/reconstruct modes" 1432 if (hasDistributedFiles)
1434 InfoOrPout<<
"Detected multiple roots i.e. non-nfs running" 1450 InfoOrPout<<
"Removing existing processor directory:" 1462 <<
"No processor directories; switching on decompose mode" 1473 <<
"Switching to exact matching for " 1475 <<
" processor directories" 1489 InfoOrPout<<
"Creating time directories on all processors" 1530 if (hasDistributedFiles)
1532 InfoOrPout<<
"Creating time directories for undecomposed Time" 1533 <<
" on all processors" <<
nl <<
endl;
1538 InfoOrPout<<
"Create undecomposed database" <<
nl <<
endl;
1560 for (
const instant& t : baseTimeDirs)
1562 masterTimeDirSet.
insert(t.name());
1590 if (timeDirs.
empty())
1593 <<
"No times selected" 1604 <<
"Reconstructing mesh and addressing" <<
nl <<
endl;
1622 <<
"Reconstructing mesh:" 1625 bool areaMeshDetected =
false;
1632 baseRunTime.
setTime(timeDirs[timeI], timeI);
1674 volMeshInstance/volMeshSubDir,
1679 newHandler(volMeshOnProc, volMeshReadHandler);
1686 areaMeshInstance/areaMeshSubDir,
1689 areaMeshDetected = areaMeshOnProc.found(
true);
1691 if (areaMeshOnProc == volMeshOnProc)
1693 if (volMeshReadHandler)
1696 areaMeshReadHandler.
ref(volMeshReadHandler.
ref());
1701 newHandler(areaMeshOnProc, areaMeshReadHandler);
1714 bool haveVolAddressing =
false;
1735 "faceProcAddressing",
1745 faceProcAddressing.headerOk()
1746 && faceProcAddressing.size() == faces.size()
1752 haveVolAddressing =
true;
1755 bool haveAreaAddressing =
false;
1776 "faceProcAddressing",
1784 haveAreaAddressing =
1786 faceProcAddressing.headerOk()
1790 else if (areaMeshDetected)
1793 haveAreaAddressing =
true;
1801 bool volMeshHaveUndecomposed =
false;
1802 bool areaMeshHaveUndecomposed =
false;
1807 <<
"Checking " << baseRunTime.
caseName()
1808 <<
" for undecomposed volume and area meshes..." 1828 volMeshHaveUndecomposed = facesIO.headerOk();
1845 areaMeshHaveUndecomposed = labelsIO.headerOk();
1851 ).nProcs(oldNumProcs);
1858 volMeshHaveUndecomposed,
1859 areaMeshHaveUndecomposed
1866 << volMeshHaveUndecomposed <<
"] : " 1867 << volMeshInstance <<
nl 1869 << areaMeshHaveUndecomposed <<
"] : " 1870 << areaMeshInstance <<
nl 1877 !volMeshHaveUndecomposed
1882 <<
"No undecomposed mesh. Creating from: " 1883 << volMeshInstance <<
endl;
1885 if (areaMeshHaveUndecomposed)
1887 areaMeshHaveUndecomposed =
false;
1889 <<
"Also ignore any undecomposed area mesh" 1908 InfoOrPout<<
nl <<
"Reconstructing mesh" <<
nl <<
endl;
1911 const label nDestProcs(1);
1914 redistributeAndWrite
1945 areaMeshOnProc.found(
true)
1948 !areaMeshHaveUndecomposed
1954 <<
"Loading area mesh from " 1955 << areaMeshInstance <<
endl;
1957 InfoOrPout<<
" getting volume mesh support" <<
endl;
1977 baseMeshPtr().facesInstance(),
2043 <<
"Setting caseName to " << baseRunTime.
caseName()
2044 <<
" to write reconstructed area mesh." <<
endl;
2050 areaBaseMeshPtr().write();
2053 InfoOrPout<<
"Restoring caseName" <<
endl;
2057 ).nProcs(oldNumProcs);
2085 <<
"Reconstructing fields" <<
nl <<
endl;
2088 baseRunTime.
setTime(timeDirs[0], 0);
2096 InfoOrPout<<
"Reading undecomposed mesh (on master)" <<
endl;
2137 Pout<<
"Undecomposed mesh :" 2138 <<
" instance:" << baseMeshPtr().facesInstance()
2139 <<
" nCells:" << baseMeshPtr().nCells()
2140 <<
" nFaces:" << baseMeshPtr().nFaces()
2141 <<
" nPoints:" << baseMeshPtr().nPoints()
2145 InfoOrPout<<
"Reading local, decomposed mesh" <<
endl;
2151 baseMeshPtr().facesInstance(),
2166 if (areaMeshDetected)
2185 baseMeshPtr().facesInstance(),
2210 areaBaseMeshPtr().facesInstance(),
2248 auto fvDistributorPtr =
2261 auto pointFieldDistributorPtr =
2280 <<
" Detected initial mesh motion;" 2281 <<
" reconstructing points" <<
nl 2283 fvDistributorPtr().reconstructPoints();
2290 if (newTimes && masterTimeDirSet.
found(timeDirs[timeI].name()))
2293 <<
"Skipping time " << timeDirs[timeI].name()
2300 baseRunTime.
setTime(timeDirs[timeI], timeI);
2311 <<
" Detected mesh motion; reconstructing points" 2313 fvDistributorPtr().reconstructPoints();
2322 <<
" Detected topology change;" 2323 <<
" reconstructing addressing" <<
nl <<
endl;
2330 baseMeshPtr.
clear();
2355 Pout<<
"Undecomposed mesh :" 2356 <<
" nCells:" << baseMeshPtr().nCells()
2357 <<
" nFaces:" << baseMeshPtr().nFaces()
2358 <<
" nPoints:" << baseMeshPtr().nPoints()
2369 fvDistributorPtr.reset
2384 pointFieldDistributorPtr.reset
2396 lagrangianDistributorPtr.
reset();
2401 <<
" Discarding finite-area addressing" 2402 <<
" (TODO)" <<
nl <<
endl;
2404 areaBaseMeshPtr.
reset();
2405 areaMeshPtr.
reset();
2406 faDistributor.
reset();
2407 areaDistMap.
clear();
2417 .distributeAllFields(objects, selectedFields);
2421 pointFieldDistributorPtr()
2422 .distributeAllFields(objects, selectedFields);
2428 lagrangianDistributorPtr,
2432 selectedLagrangianFields
2439 .distributeAllFields(objects, selectedFields);
2472 baseMeshPtr().time()
2499 <<
"Setting time to that of master or undecomposed case : " 2500 << masterTime <<
endl;
2502 baseRunTime.
setTime(masterTime, 0);
2526 << (decompose ?
"Decomposing" :
"Redistributing")
2540 bool volMeshHaveUndecomposed =
true;
2541 bool areaMeshHaveUndecomposed = doFiniteArea;
2548 <<
"Checking undecomposed mesh in case: " 2575 if (
"constant" == areaMeshMasterInstance)
2582 areaMeshMasterInstance/areaMeshSubDir,
2588 if (areaMeshOnProc.empty() || !areaMeshOnProc[0])
2590 areaMeshHaveUndecomposed =
false;
2602 << volMeshHaveUndecomposed <<
"] : " 2603 << volMeshMasterInstance <<
nl 2605 << areaMeshHaveUndecomposed <<
"] : " 2606 << areaMeshMasterInstance <<
nl 2610 InfoOrPout<<
"Restoring caseName" <<
endl;
2619 volMeshHaveUndecomposed,
2620 areaMeshHaveUndecomposed,
2621 volMeshMasterInstance,
2622 areaMeshMasterInstance
2644 volMeshMasterInstance/volMeshSubDir,
2650 newHandler(volMeshOnProc, volMeshReadHandler);
2673 areaMeshHaveUndecomposed;
2680 areaMeshMasterInstance/areaMeshSubDir,
2686 if (areaMeshOnProc == volMeshOnProc)
2688 if (volMeshReadHandler)
2691 areaMeshReadHandler.
ref(volMeshReadHandler.
ref());
2696 newHandler(areaMeshOnProc, areaMeshReadHandler);
2713 volMeshMasterInstance/volMeshSubDir,
2724 Info<<
"Per processor faces dirs:" <<
nl 2732 if (!volMeshOnProc[proci])
2734 Info<<
" [missing]";
2752 areaMeshMasterInstance/areaMeshSubDir,
2763 Info<<
"Per processor faceLabels dirs:" <<
nl 2771 if (!areaMeshOnProc[proci])
2773 Info<<
" [missing]";
2788 <<
"Setting caseName to " << baseRunTime.
caseName()
2789 <<
" to read undecomposed mesh" <<
endl;
2799 volMeshMasterInstance,
2820 ? areaMeshHaveUndecomposed
2821 : areaMeshOnProc.
found(
true)
2830 areaMeshMasterInstance,
2845 InfoOrPout<<
"Restoring caseName" <<
endl;
2858 determineDecomposition
2877 if (!writeHandler && nDestProcs <
fileHandler().nProcs())
2880 isWriteProc.slice(0, nDestProcs) =
true;
2883 << isWriteProc <<
"]" <<
nl 2885 newHandler(isWriteProc, writeHandler);
2899 areaMeshReadHandler,
2900 areaMeshMasterInstance,
2910 <<
"Setting caseName to " << baseRunTime.
caseName()
2911 <<
" to read lagrangian" <<
endl;
2934 selectedLagrangianFields
2940 InfoOrPout<<
"Restoring caseName" <<
endl;
2967 volMeshMasterInstance,
2974 lagrangianDistributorPtr,
3007 <<
"Setting caseName to " << baseRunTime.
caseName()
3008 <<
" to write reconstructed mesh (and fields)." 3015 areaProcMeshPtr->
write();
3018 InfoOrPout<<
"Restoring caseName" <<
endl;
3022 ).nProcs(oldNumProcs);
3039 areaProcMeshPtr->
thisDb(),
3047 areaProcMeshPtr->
write();
3064 <<
"Written redistributed mesh to " 3075 areaFields.redistributeAndWrite(distributor,
true);
3083 defaultHandler.
ref(writeHandler.
ref());
3100 (decompose ? baseRunTime.
caseName() : proc0CaseName),
3111 defaultHandler.
ref(writeHandler.
ref());
3127 (decompose ? baseRunTime.
caseName() : proc0CaseName),
3134 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.
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 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()
static void gatherList(const UList< commsStruct > &comms, UList< T > &values, const int tag, const label comm)
Gather data, but keep individual values separate. Uses the specified communication schedule...
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 bool Store(std::unique_ptr< faMeshesRegistry > &&ptr)
Transfer ownership of meshObject to registry.
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.
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.
virtual const objectRegistry & thisDb() const
Reference to the mesh database.
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?
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.
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.
word findInstance(const fileName &directory, const word &name=word::null, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, const word &stopInstance=word::null, const bool constant_fallback=true) const
Return time instance (location) of directory containing the file name (eg, used in reading mesh data)...
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.
fileName meshDir() const
Return the local mesh directory (dbDir()/meshSubDir)
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 per select0() - otherwise return just the cu...
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 unsigned int minPrecision(unsigned int prec) noexcept
Set the minimum default precision.
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)
static std::unique_ptr< faMeshesRegistry > Release(const word &objName, const polyMesh &mesh, const bool checkout=false)
Release ownership of meshObject (with given registration name) from registry. Returns nullptr if not ...
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))
static void allGatherList(UList< T > &values, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Gather data, but keep individual values separate. Uses MPI_Allgather or manual linear/tree communicat...
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)