116#define InfoOrPout (::debug ? Pout : Info.stream())
122getNewHandler(
const boolUList& useProc,
const bool verbose =
true)
131 Pout<<
"Allocated " << handler().info()
146 handler = getNewHandler(useProc);
160 masterTimeDirs = localTimeDirs;
166 for (
const instant& t : masterTimeDirs)
168 if (!localTimeDirs.contains(t))
191 const bool reconstruct,
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;
339 const labelList& pPatches =
mesh.globalData().processorPatches();
346 mesh.boundaryMesh()[pPatches[i]]
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 =
Foam::max(maxProcCells, nLocalCells);
407 totProcFaces += nProcFaces;
408 totProcPatches += nei.
size();
409 maxProcFaces =
Foam::max(maxProcFaces, nProcFaces);
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 <<
')';
455void writeDecomposition
472 <<
"Writing wanted cell distribution to volScalarField " <<
name
473 <<
" for postprocessing purposes." <<
nl <<
endl;
480 mesh.time().timeName(),
493 procCells[celli] = decomp[celli];
496 procCells.correctBoundaryConditions();
501void determineDecomposition
504 const Time& baseRunTime,
506 const bool decompose,
509 const bool writeCellDist,
531 <<
"You have selected decomposition method \""
532 << decomposer.type() <<
"\n"
533 <<
" which does not synchronise decomposition across"
534 " processor patches.\n"
535 " You might want to select a decomposition method"
536 " that is aware of this. Continuing...." <<
endl;
545 <<
"Setting caseName to " << baseRunTime.
caseName()
546 <<
" to read decomposeParDict" <<
endl;
552 if (method.
found(
"weightField"))
569 cellWeights = weights.internalField();
581 <<
"Restoring caseName" <<
endl;
589 const label oldNumProcs =
600 <<
"Setting caseName to " << baseRunTime.
caseName()
601 <<
" to write undecomposed cellDist" <<
endl;
605 writeDecomposition(
"cellDist",
mesh, decomp);
606 InfoOrPout<<
"Restoring caseName" <<
endl;
615 writeDecomposition(
"cellDist",
mesh, decomp);
625template<
class CoupledPatchType,
class GeoField>
626void correctCoupledBoundaryConditions(
fvMesh&
mesh)
628 for (GeoField&
fld :
mesh.sorted<GeoField>())
630 fld.boundaryFieldRef().template evaluateCoupled<CoupledPatchType>();
640 const Time& baseRunTime,
644 const bool doReadFields,
645 const bool decompose,
646 const bool reconstruct,
647 const bool overwrite,
650 const label nDestProcs,
660 const bool oldProcCase =
runTime.processorCase();
720 if (volMeshOnProc.
found(
false))
725 subsetterPtr().subMesh().init(
true);
726 subsetterPtr().subMesh().globalData();
727 subsetterPtr().subMesh().tetBasePtIs();
728 subsetterPtr().subMesh().geometricD();
736 <<
"Setting caseName to " << baseRunTime.
caseName()
737 <<
" to read IOobjects" <<
endl;
758 <<
"Restoring caseName" <<
endl;
759 runTime.caseName() = proc0CaseName;
760 runTime.processorCase(oldProcCase);
764 <<
"From time " <<
runTime.timeName()
765 <<
" mesh:" <<
mesh.objectRegistry::objectRelPath()
766 <<
" have objects:" << objects.
names() <<
endl;
770 (void)objects.
erase(
"cellDist");
781 #undef doFieldReading
782 #define doFieldReading(Storage) \
784 fieldsDistributor::readFields \
786 volMeshOnProc, readHandler, mesh, subsetterPtr, \
792 doFieldReading(volScalarFields);
793 doFieldReading(volVectorFields);
794 doFieldReading(volSphereTensorFields);
795 doFieldReading(volSymmTensorFields);
796 doFieldReading(volTensorFields);
799 doFieldReading(surfScalarFields);
800 doFieldReading(surfVectorFields);
801 doFieldReading(surfSphereTensorFields);
802 doFieldReading(surfSymmTensorFields);
803 doFieldReading(surfTensorFields);
806 doFieldReading(dimScalarFields);
807 doFieldReading(dimVectorFields);
808 doFieldReading(dimSphereTensorFields);
809 doFieldReading(dimSymmTensorFields);
810 doFieldReading(dimTensorFields);
815 #undef doFieldReading
816 #define doFieldReading(Storage) \
818 fieldsDistributor::readFields \
820 volMeshOnProc, readHandler, oldPointMesh, \
821 subsetterPtr, objects, Storage, \
824 nPointFields += Storage.size(); \
827 doFieldReading(pointScalarFields);
828 doFieldReading(pointVectorFields);
829 doFieldReading(pointSphTensorFields);
830 doFieldReading(pointSymmTensorFields);
831 doFieldReading(pointTensorFields);
832 #undef doFieldReading
839 runTime.caseName() = proc0CaseName;
840 runTime.processorCase(oldProcCase);
847 pointDistributor.saveMeshPoints();
890 runTime.caseName() = proc0CaseName;
891 runTime.processorCase(oldProcCase);
896 refDataPtr().sync(
io);
908 std::unique_ptr<faMeshesRegistry> faMeshesRegistry_saved
924 InfoOrPout<<
"After distribution:" <<
endl;
930 #undef doCorrectCoupled
931 #define doCorrectCoupled(FieldType) \
932 correctCoupledBoundaryConditions<processorFvPatch, FieldType>(mesh);
939 #undef doCorrectCoupled
952 pointDistributor.resetTarget(newPointMesh, distMap());
954 pointDistributor.distributeAndStore(pointScalarFields);
955 pointDistributor.distributeAndStore(pointVectorFields);
956 pointDistributor.distributeAndStore(pointSphTensorFields);
957 pointDistributor.distributeAndStore(pointSymmTensorFields);
958 pointDistributor.distributeAndStore(pointTensorFields);
973 mesh.setInstance(volMeshInstance);
983 mesh.facesInstance(),
1001 <<
"Setting caseName to " << baseRunTime.
caseName()
1002 <<
" to write reconstructed mesh (and fields)." <<
endl;
1004 const bool oldProcCase(
runTime.processorCase(
false));
1005 const label oldNumProcs
1015 InfoOrPout<<
"Restoring caseName" <<
endl;
1018 runTime.caseName() = proc0CaseName;
1019 runTime.processorCase(oldProcCase);
1028 const label oldNumProcs
1040 <<
"Written redistributed mesh to "
1053 mesh.facesInstance(),
1057 else if (reconstruct)
1084 auto& refData = refDataPtr();
1090 mesh.facesInstance(),
1101 refData.distribute(distMap());
1111 const label oldNumProcs
1117 <<
"Setting caseName to " << baseRunTime.
caseName()
1118 <<
" to write reconstructed refinement data." <<
endl;
1120 const bool oldProcCase(
runTime.processorCase(
false));
1125 InfoOrPout<<
"Restoring caseName" <<
endl;
1126 runTime.caseName() = proc0CaseName;
1127 runTime.processorCase(oldProcCase);
1135 const label oldNumProcs
1208int main(
int argc,
char *argv[])
1212 "Redistribute decomposed mesh and fields according"
1213 " to the decomposeParDict settings.\n"
1214 "Optionally run in decompose/reconstruct mode"
1230 "Additional verbosity. (Can be used multiple times for debugging)"
1234 "Test without writing the decomposition. "
1235 "Changes -cellDist to only write volScalarField."
1241 "Write cell distribution as a labelList - for use with 'manual' "
1242 "decomposition method or as a volScalarField for post-processing."
1247 "Only reconstruct new times (i.e. that do not exist already)"
1251 "Additional verbosity. (Can be used multiple times)"
1256 "Suppress finiteArea mesh/field handling",
1287 const bool hasDistributedFiles(
fileHandler().distributed());
1300 const bool writeCellDist =
args.found(
"cellDist");
1301 const bool dryrun =
args.dryRun();
1302 const bool newTimes =
args.found(
"newTimes");
1303 const int optVerbose =
args.verbose();
1305 const bool doFiniteArea = !
args.found(
"no-finite-area");
1306 bool decompose =
args.found(
"decompose");
1307 bool overwrite =
args.found(
"overwrite");
1311 const wordRes selectedLagrangianFields;
1317 <<
": This utility can only be run parallel"
1321 if (decompose && reconstruct)
1324 <<
"Cannot specify both -decompose and -reconstruct"
1336 Info<<
"Additional debugging enabled" <<
nl <<
endl;
1377 InfoOrPout<<
"Decomposing case (like decomposePar)"
1380 else if (reconstruct)
1382 InfoOrPout<<
"Reconstructing case (like reconstructParMesh)"
1386 if (decompose || reconstruct)
1390 InfoOrPout<<
"Switching to exact matching for "
1392 <<
" processor directories"
1400 InfoOrPout<<
"Switching to matching any "
1405 if ((decompose || reconstruct) && !overwrite)
1411 <<
"Added implicit -overwrite for decompose/reconstruct modes"
1423 <<
": cannot open root directory " <<
args.rootPath()
1429 if (hasDistributedFiles)
1431 InfoOrPout<<
"Detected multiple roots i.e. non-nfs running"
1447 InfoOrPout<<
"Removing existing processor directory:"
1448 <<
args.relativePath(procDir) <<
endl;
1459 <<
"No processor directories; switching on decompose mode"
1470 <<
"Switching to exact matching for "
1472 <<
" processor directories"
1486 InfoOrPout<<
"Creating time directories on all processors"
1488 createTimeDirs(
args.path());
1511 runTime.functionObjects().off();
1515 runTime.runTimeModifiable(
false);
1519 const bool oldProcCase =
runTime.processorCase();
1527 if (hasDistributedFiles)
1529 InfoOrPout<<
"Creating time directories for undecomposed Time"
1530 <<
" on all processors" <<
nl <<
endl;
1531 createTimeDirs(
args.globalPath());
1535 InfoOrPout<<
"Create undecomposed database" <<
nl <<
endl;
1557 for (
const instant& t : baseTimeDirs)
1559 masterTimeDirSet.
insert(t.name());
1587 if (timeDirs.
empty())
1590 <<
"No times selected"
1601 <<
"Reconstructing mesh and addressing" <<
nl <<
endl;
1619 <<
"Reconstructing mesh:"
1622 bool areaMeshDetected =
false;
1628 runTime.setTime(timeDirs[timeI], timeI);
1629 baseRunTime.
setTime(timeDirs[timeI], timeI);
1637 volMeshInstance =
runTime.findInstance
1646 areaMeshInstance =
runTime.findInstance
1671 volMeshInstance/volMeshSubDir,
1676 newHandler(volMeshOnProc, volMeshReadHandler);
1683 areaMeshInstance/areaMeshSubDir,
1686 areaMeshDetected = areaMeshOnProc.found(
true);
1688 if (areaMeshOnProc == volMeshOnProc)
1690 if (volMeshReadHandler)
1693 areaMeshReadHandler.
ref(volMeshReadHandler.
ref());
1698 newHandler(areaMeshOnProc, areaMeshReadHandler);
1711 bool haveVolAddressing =
false;
1732 "faceProcAddressing",
1742 faceProcAddressing.headerOk()
1743 && faceProcAddressing.size() == faces.size()
1749 haveVolAddressing =
true;
1752 bool haveAreaAddressing =
false;
1773 "faceProcAddressing",
1781 haveAreaAddressing =
1783 faceProcAddressing.headerOk()
1784 && faceProcAddressing.size() ==
faceLabels.size()
1787 else if (areaMeshDetected)
1790 haveAreaAddressing =
true;
1798 bool volMeshHaveUndecomposed =
false;
1799 bool areaMeshHaveUndecomposed =
false;
1804 <<
"Checking " << baseRunTime.
caseName()
1805 <<
" for undecomposed volume and area meshes..."
1825 volMeshHaveUndecomposed = facesIO.headerOk();
1842 areaMeshHaveUndecomposed = labelsIO.headerOk();
1848 ).nProcs(oldNumProcs);
1855 volMeshHaveUndecomposed,
1856 areaMeshHaveUndecomposed
1863 << volMeshHaveUndecomposed <<
"] : "
1864 << volMeshInstance <<
nl
1866 << areaMeshHaveUndecomposed <<
"] : "
1867 << areaMeshInstance <<
nl
1874 !volMeshHaveUndecomposed
1879 <<
"No undecomposed mesh. Creating from: "
1880 << volMeshInstance <<
endl;
1882 if (areaMeshHaveUndecomposed)
1884 areaMeshHaveUndecomposed =
false;
1886 <<
"Also ignore any undecomposed area mesh"
1905 InfoOrPout<<
nl <<
"Reconstructing mesh" <<
nl <<
endl;
1908 const label nDestProcs(1);
1911 redistributeAndWrite
1942 areaMeshOnProc.found(
true)
1945 !areaMeshHaveUndecomposed
1951 <<
"Loading area mesh from "
1952 << areaMeshInstance <<
endl;
1954 InfoOrPout<<
" getting volume mesh support" <<
endl;
1974 baseMeshPtr().facesInstance(),
2040 <<
"Setting caseName to " << baseRunTime.
caseName()
2041 <<
" to write reconstructed area mesh." <<
endl;
2043 const bool oldProcCase(
runTime.processorCase(
false));
2047 areaBaseMeshPtr().write();
2050 InfoOrPout<<
"Restoring caseName" <<
endl;
2054 ).nProcs(oldNumProcs);
2056 runTime.caseName() = proc0CaseName;
2057 runTime.processorCase(oldProcCase);
2082 <<
"Reconstructing fields" <<
nl <<
endl;
2084 runTime.setTime(timeDirs[0], 0);
2085 baseRunTime.
setTime(timeDirs[0], 0);
2093 InfoOrPout<<
"Reading undecomposed mesh (on master)" <<
endl;
2134 Pout<<
"Undecomposed mesh :"
2135 <<
" instance:" << baseMeshPtr().facesInstance()
2136 <<
" nCells:" << baseMeshPtr().nCells()
2137 <<
" nFaces:" << baseMeshPtr().nFaces()
2138 <<
" nPoints:" << baseMeshPtr().nPoints()
2142 InfoOrPout<<
"Reading local, decomposed mesh" <<
endl;
2148 baseMeshPtr().facesInstance(),
2163 if (areaMeshDetected)
2182 baseMeshPtr().facesInstance(),
2207 areaBaseMeshPtr().facesInstance(),
2245 auto fvDistributorPtr =
2258 auto pointFieldDistributorPtr =
2274 if (
mesh.pointsInstance() !=
mesh.facesInstance())
2277 <<
" Detected initial mesh motion;"
2278 <<
" reconstructing points" <<
nl
2280 fvDistributorPtr().reconstructPoints();
2287 if (newTimes && masterTimeDirSet.
found(timeDirs[timeI].name()))
2290 <<
"Skipping time " << timeDirs[timeI].name()
2296 runTime.setTime(timeDirs[timeI], timeI);
2297 baseRunTime.
setTime(timeDirs[timeI], timeI);
2308 <<
" Detected mesh motion; reconstructing points"
2310 fvDistributorPtr().reconstructPoints();
2319 <<
" Detected topology change;"
2320 <<
" reconstructing addressing" <<
nl <<
endl;
2327 baseMeshPtr.
clear();
2352 Pout<<
"Undecomposed mesh :"
2353 <<
" nCells:" << baseMeshPtr().nCells()
2354 <<
" nFaces:" << baseMeshPtr().nFaces()
2355 <<
" nPoints:" << baseMeshPtr().nPoints()
2366 fvDistributorPtr.reset
2381 pointFieldDistributorPtr.reset
2393 lagrangianDistributorPtr.
reset();
2398 <<
" Discarding finite-area addressing"
2399 <<
" (TODO)" <<
nl <<
endl;
2401 areaBaseMeshPtr.
reset();
2402 areaMeshPtr.
reset();
2403 faDistributor.
reset();
2404 areaDistMap.
clear();
2414 .distributeAllFields(objects, selectedFields);
2418 pointFieldDistributorPtr()
2419 .distributeAllFields(objects, selectedFields);
2425 lagrangianDistributorPtr,
2429 selectedLagrangianFields
2436 .distributeAllFields(objects, selectedFields);
2451 mesh.time().timeName(),
2466 mesh.time().timeName(),
2469 baseMeshPtr().time()
2496 <<
"Setting time to that of master or undecomposed case : "
2497 << masterTime <<
endl;
2498 runTime.setTime(masterTime, 0);
2499 baseRunTime.
setTime(masterTime, 0);
2523 << (decompose ?
"Decomposing" :
"Redistributing")
2537 bool volMeshHaveUndecomposed =
true;
2538 bool areaMeshHaveUndecomposed = doFiniteArea;
2545 <<
"Checking undecomposed mesh in case: "
2572 if (
"constant" == areaMeshMasterInstance)
2579 areaMeshMasterInstance/areaMeshSubDir,
2585 if (areaMeshOnProc.empty() || !areaMeshOnProc[0])
2587 areaMeshHaveUndecomposed =
false;
2599 << volMeshHaveUndecomposed <<
"] : "
2600 << volMeshMasterInstance <<
nl
2602 << areaMeshHaveUndecomposed <<
"] : "
2603 << areaMeshMasterInstance <<
nl
2607 InfoOrPout<<
"Restoring caseName" <<
endl;
2608 runTime.caseName() = proc0CaseName;
2609 runTime.processorCase(oldProcCase);
2616 volMeshHaveUndecomposed,
2617 areaMeshHaveUndecomposed,
2618 volMeshMasterInstance,
2619 areaMeshMasterInstance
2641 volMeshMasterInstance/volMeshSubDir,
2647 newHandler(volMeshOnProc, volMeshReadHandler);
2670 areaMeshHaveUndecomposed;
2677 areaMeshMasterInstance/areaMeshSubDir,
2683 if (areaMeshOnProc == volMeshOnProc)
2685 if (volMeshReadHandler)
2688 areaMeshReadHandler.
ref(volMeshReadHandler.
ref());
2693 newHandler(areaMeshOnProc, areaMeshReadHandler);
2710 volMeshMasterInstance/volMeshSubDir,
2721 Info<<
"Per processor faces dirs:" <<
nl
2727 <<
runTime.relativePath(volMeshDir[proci]);
2729 if (!volMeshOnProc[proci])
2731 Info<<
" [missing]";
2749 areaMeshMasterInstance/areaMeshSubDir,
2760 Info<<
"Per processor faceLabels dirs:" <<
nl
2766 <<
runTime.relativePath(areaMeshDir[proci]);
2768 if (!areaMeshOnProc[proci])
2770 Info<<
" [missing]";
2785 <<
"Setting caseName to " << baseRunTime.
caseName()
2786 <<
" to read undecomposed mesh" <<
endl;
2796 volMeshMasterInstance,
2817 ? areaMeshHaveUndecomposed
2818 : areaMeshOnProc.
found(
true)
2827 areaMeshMasterInstance,
2842 InfoOrPout<<
"Restoring caseName" <<
endl;
2843 runTime.caseName() = proc0CaseName;
2844 runTime.processorCase(oldProcCase);
2847 const label nOldCells =
mesh.nCells();
2855 determineDecomposition
2874 if (!writeHandler && nDestProcs <
fileHandler().nProcs())
2877 isWriteProc.slice(0, nDestProcs) =
true;
2880 << isWriteProc <<
"]" <<
nl
2882 newHandler(isWriteProc, writeHandler);
2896 areaMeshReadHandler,
2897 areaMeshMasterInstance,
2907 <<
"Setting caseName to " << baseRunTime.
caseName()
2908 <<
" to read lagrangian" <<
endl;
2920 runTime.caseName() =
"#invalid-name#";
2931 selectedLagrangianFields
2937 InfoOrPout<<
"Restoring caseName" <<
endl;
2938 runTime.caseName() = proc0CaseName;
2939 runTime.processorCase(oldProcCase);
2964 volMeshMasterInstance,
2971 lagrangianDistributorPtr,
3004 <<
"Setting caseName to " << baseRunTime.
caseName()
3005 <<
" to write reconstructed mesh (and fields)."
3008 const bool oldProcCase(
runTime.processorCase(
false));
3012 areaProcMeshPtr->write();
3015 InfoOrPout<<
"Restoring caseName" <<
endl;
3019 ).nProcs(oldNumProcs);
3021 runTime.caseName() = proc0CaseName;
3022 runTime.processorCase(oldProcCase);
3034 areaProcMeshPtr->facesInstance(),
3036 areaProcMeshPtr->thisDb()
3041 areaProcMeshPtr->write();
3058 <<
"Written redistributed mesh to "
3059 << areaProcMeshPtr->facesInstance() <<
nl <<
endl;
3069 areaFields.redistributeAndWrite(distributor,
true);
3077 defaultHandler.
ref(writeHandler.
ref());
3094 (decompose ? baseRunTime.
caseName() : proc0CaseName),
3105 defaultHandler.
ref(writeHandler.
ref());
3121 (decompose ? baseRunTime.
caseName() : proc0CaseName),
3128 InfoOrPout<<
"End\n" <<
endl;
Inter-processor communication reduction functions.
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
labelList faceLabels(nFaceLabels)
bool erase(iterator &iter)
Erase entry specified by given iterator and delete the allocated pointer.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
bool found(const Key &key) const
Same as contains().
static void writeContents(const IOobject &io, const UList< T > &content)
Write contents. The IOobject is never registered.
A IOmapDistributePolyMesh wrapper for using referenced external data.
static void writeContents(const IOobject &io, const mapDistributePolyMesh &map)
Write contents. The IOobject is never registered.
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable,...
wordList names() const
The unsorted names of the IOobjects.
@ NO_REGISTER
Do not request registration (bool: false).
@ REGISTER
Request registration (bool: true).
@ NO_READ
Nothing to be read.
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ MUST_READ
Reading required.
@ LAZY_READ
Reading is optional [identical to READ_IF_PRESENT].
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static unsigned int minPrecision(unsigned int prec) noexcept
Set the minimum default precision.
void setSize(label n)
Alias for resize().
static bool Store(std::unique_ptr< faMeshesRegistry > &&ptr)
static FOAM_NO_DANGLING_REFERENCE const pointMesh & New(const polyMesh &mesh, Args &&... args)
static std::unique_ptr< faMeshesRegistry > Release(const word &objName, const polyMesh &mesh, bool checkout=true)
static void allGatherList(UList< T > &values, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather data, but keep individual values separate. Uses MPI_Allgather or manual communication.
static void gatherList(UList< T > &values, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather data, but keep individual values separate.
static void broadcast(Type &value, const int communicator=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all communicator ranks. Does nothing in non-paral...
static void broadcasts(const int communicator, Type &value, Args &&... values)
Broadcast multiple items to all communicator ranks. Does nothing in non-parallel.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
instantList times() const
Search the case for valid time directories.
static instantList findTimes(const fileName &directory, const word &constantDirName="constant")
Search a given directory for valid time directories.
bool processorCase() const noexcept
True if this is a processor case.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
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)...
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.
static word controlDictName
The default control dictionary name (normally "controlDict").
Switch runTimeModifiable() const noexcept
Supports re-reading.
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
const fileName & caseName() const noexcept
The case name.
bool found(const T &val, label pos=0) const
Same as contains().
bool empty() const noexcept
True if List is empty (ie, size() is zero).
void size(const label n)
Older name for setAddressableSize.
static label commWorld() noexcept
Communicator for all ranks (respecting any local worlds).
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static constexpr int masterNo() noexcept
Relative rank for the master process - is always 0.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
static rangeType allProcs(const label communicator=worldComm)
Range of process indices for all processes.
Finite area area (element) fields.
Mesh data needed to do the Finite Area discretisation.
Extract command arguments and options from the supplied argc and argv parameters.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addVerboseOption(const string &usage="", bool advanced=false)
Enable a 'verbose' bool option, with usage information.
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void addNote(const string ¬e)
Add extra notes for the usage information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void clear() noexcept
Same as reset(nullptr).
T * get() noexcept
Return pointer to managed object without nullptr checking.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Abstract base class for domain decomposition.
static label nDomains(const dictionary &decompDict, const word ®ionName="")
Return region-specific or top-level numberOfSubdomains entry.
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.
virtual bool parallelAware() const =0
Is method parallel aware?
MeshObject wrapper of decompositionMethod.
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...
decompositionMethod & decomposer() const
Return demand-driven decomposition method.
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.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
static int verbose_
Output verbosity when writing.
static mapDistributePolyMesh distribute(const faMesh &oldMesh, const mapDistributePolyMesh &distMap, const polyMesh &tgtPolyMesh, autoPtr< faMesh > &newMeshPtr)
Distribute mesh according to the given (volume) mesh distribution.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
fileName meshDir() const
Return the local mesh directory (dbDir()/meshSubDir).
static word meshSubDir
The mesh sub-directory name (usually "faMesh").
A class for handling file names.
An encapsulation of filesystem-related operations.
static const fileOperation & fileHandler()
Return the current file handler. Will create the default file handler if necessary.
static autoPtr< fileOperation > NewUncollated()
The commonly used uncollatedFileOperation.
static int cacheLevel() noexcept
Return cache level.
static word processorsBaseDir
Return the processors directory name (usually "processors").
static autoPtr< fileOperation > New(const word &handlerType, bool verbose=false)
Select fileHandler-type. Uses defaultFileHandler if the handlerType is empty.
static int nProcsFilter() noexcept
Return collated 'processorsDDD' filtering.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
Mesh data needed to do the Finite Volume discretisation.
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
Various for reading/decomposing/reconstructing/distributing refinement data.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
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).
static void removeFiles(const polyMesh &)
Helper: remove all relevant files from mesh instance.
Registry of regIOobjects.
const Time & time() const noexcept
Return time registry.
Simple container to manage read/write, redistribute finiteArea fields.
Finite volume reconstructor for volume and surface fields.
Distributor/redistributor for point fields, uses a two (or three) stage construction.
static int verbose_
Output verbosity when writing.
Mesh representing a set of points created from polyMesh.
Mesh consisting of general polyhedral cells.
static const word & regionName(const word ®ion)
The mesh region name or word::null if polyMesh::defaultRegion.
static word defaultRegion
Return the default region name.
fileName meshDir() const
Return the local mesh directory (dbDir()/meshSubDir).
readUpdateState
Enumeration defining the state of the mesh after a read update.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh").
Neighbour processor patch.
int neighbProcNo() const noexcept
Return neighbour processor number.
A class for managing references or pointers (no reference counting).
T * get() noexcept
Return pointer without nullptr checking.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
static void unset(bool verbose=false)
Deactivate SIGFPE handler and NaN memory initialisation.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
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...
instantList select(const instantList ×) const
Select a list of Time values that are within the ranges.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
static const word null
An empty word.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Miscellaneous file handling for meshes.
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for handling debugging switches.
int debugSwitch(const char *name, const int deflt=0)
Lookup debug switch or add default value.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
bool allowFaModels() noexcept
The enable/disable state for regionFaModel (default: true).
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
GeometricField< vector, fvPatchField, volMesh > volVectorField
const dimensionSet dimless
Dimensionless.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
PtrList< unmappedPassivePositionParticleCloud > readLagrangian(const fvMesh &mesh, const UList< word > &cloudNames, const boolUList &haveClouds, const wordRes &selectedFields)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
IOList< label > labelIOList
IO for a List of label.
List< fileName > fileNameList
List of fileName.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler().
CompactIOList< face > faceCompactIOList
Compact IO for a List of face.
void reconstructLagrangian(autoPtr< parLagrangianDistributor > &distributorPtr, const fvMesh &baseMesh, const fvMesh &mesh, const mapDistributePolyMesh &distMap, const wordRes &selectedFields)
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< instant > instantList
List of instants.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
GeometricField< tensor, fvPatchField, volMesh > volTensorField
void masterMeshInstance(const IOobject &io, fileName &facesInstance, fileName &pointsInstance)
Determine master faces instance.
GeometricField< sphericalTensor, fvPatchField, volMesh > volSphericalTensorField
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
void removeProcAddressing(const faMesh &mesh)
Remove procAddressing.
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").
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0).
UList< bool > boolUList
A UList of bools.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
labelList findIndices(const ListType &input, typename ListType::const_reference val, label start=0)
Linear search to find all occurrences of given element.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
void redistributeLagrangian(autoPtr< parLagrangianDistributor > &distributorPtr, const fvMesh &mesh, const label nOldCells, const mapDistributePolyMesh &distMap, PtrList< unmappedPassivePositionParticleCloud > &clouds)
messageStream Warning
Warning stream (stdout output on master, null elsewhere), with additional 'FOAM Warning' header text.
constexpr char nl
The newline '\n' character (0x0a).
Reading, reconstruct, redistribution of lagrangian fields.
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.