114 using namespace Foam;
132 masterTimeDirs = localTimeDirs;
140 for (
const instant& t : masterTimeDirs)
142 if (!localTimeDirs.found(t))
162 const bool decompose,
164 const word& readTimeName,
170 const IOobject readIO(
"uniform", readTimeName, readDb);
181 if (!readPath.empty())
183 Info<<
"Detected additional non-decomposed files in " 212 Pout<<
" readPath :" << readPath <<
endl;
213 Pout<<
" writePath :" << writePath <<
endl;
214 Pout<<
" currentPath:" << currentPath <<
endl;
217 if (readPath == writePath)
222 if (currentPath.empty())
227 fh.
cp(readPath, writePath);
235 fh.
cp(readPath, writePath);
244 if (isA<fileOperations::collatedFileOperation>(fh))
250 fh.
cp(readPath, writePath);
257 fh.
cp(readPath, writePath);
292 label maxProcCells = 0;
293 label maxProcFaces = 0;
294 label totProcFaces = 0;
295 label maxProcPatches = 0;
296 label totProcPatches = 0;
300 const label nLocalCells = globalCells.
localSize(proci);
301 const label nBndFaces = globalBoundaryFaces.localSize(proci);
304 <<
"Processor " << proci;
314 <<
" Number of cells = " << nLocalCells <<
endl;
317 label nProcFaces = 0;
318 const labelList& nei = patchNeiProcNo[proci];
320 forAll(patchNeiProcNo[proci], i)
322 Info<<
" Number of faces shared with processor " 323 << patchNeiProcNo[proci][i] <<
" = " 324 << patchSize[proci][i] <<
nl;
326 nProcFaces += patchSize[proci][i];
330 Info<<
" Number of processor patches = " << nei.
size() <<
nl 331 <<
" Number of processor faces = " << nProcFaces <<
nl 332 <<
" Number of boundary faces = " 333 << nBndFaces-nProcFaces <<
endl;
336 maxProcCells =
max(maxProcCells, nLocalCells);
337 totProcFaces += nProcFaces;
338 totProcPatches += nei.
size();
339 maxProcFaces =
max(maxProcFaces, nProcFaces);
340 maxProcPatches =
max(maxProcPatches, nei.
size());
346 <<
"Number of processor faces = " << (totProcFaces/2) <<
nl 347 <<
"Max number of cells = " << maxProcCells;
349 if (maxProcCells != globalCells.totalSize())
353 Info<<
" (" << 100.0*(maxProcCells-avgValue)/avgValue
354 <<
"% above average " << avgValue <<
')';
358 Info<<
"Max number of processor patches = " << maxProcPatches;
363 Info<<
" (" << 100.0*(maxProcPatches-avgValue)/avgValue
364 <<
"% above average " << avgValue <<
')';
368 Info<<
"Max number of faces between processors = " << maxProcFaces;
373 Info<<
" (" << 100.0*(maxProcFaces-avgValue)/avgValue
374 <<
"% above average " << avgValue <<
')';
381 void writeDecomposition
403 cellDecomposition.write();
405 Info<<
"Writing wanted cell distribution to volScalarField " <<
name 406 <<
" for postprocessing purposes." <<
nl <<
endl;
426 procCells[celli] = decomp[celli];
429 procCells.correctBoundaryConditions();
434 void determineDecomposition
436 const Time& baseRunTime,
438 const bool decompose,
441 const bool writeCellDist,
459 <<
"You have selected decomposition method \"" 460 << decomposer.type() <<
"\n" 461 <<
" which does not synchronise decomposition across" 462 " processor patches.\n" 463 " You might want to select a decomposition method" 464 " that is aware of this. Continuing...." <<
endl;
473 <<
" to read decomposeParDict" <<
endl;
479 if (method.
found(
"weightField"))
495 cellWeights = weights.internalField();
503 Info<<
"Restoring caseName" <<
endl;
519 <<
" to write undecomposed cellDist" <<
endl;
523 writeDecomposition(
"cellDist",
mesh, decomp);
524 Info<<
"Restoring caseName" <<
endl;
533 writeDecomposition(
"cellDist",
mesh, decomp);
541 template<
class CoupledPatchType,
class GeoField>
542 void correctCoupledBoundaryConditions(
fvMesh&
mesh)
546 fld.boundaryFieldRef().template evaluateCoupled<CoupledPatchType>();
555 const Time& baseRunTime,
559 const bool doReadFields,
560 const bool decompose,
562 const bool overwrite,
565 const label nDestProcs,
631 if (volMeshOnProc.
found(
false))
653 <<
" mesh:" <<
mesh.objectRegistry::objectRelPath()
654 <<
" have objects:" << objects.
names() <<
endl;
658 auto iter = objects.find(
"cellDist");
673 #undef doFieldReading 674 #define doFieldReading(Storage) \ 676 fieldsDistributor::readFields \ 678 volMeshOnProc, mesh, subsetterPtr, objects, Storage \ 683 doFieldReading(volScalarFields);
684 doFieldReading(volVectorFields);
685 doFieldReading(volSphereTensorFields);
686 doFieldReading(volSymmTensorFields);
687 doFieldReading(volTensorFields);
690 doFieldReading(surfScalarFields);
691 doFieldReading(surfVectorFields);
692 doFieldReading(surfSphereTensorFields);
693 doFieldReading(surfSymmTensorFields);
694 doFieldReading(surfTensorFields);
697 doFieldReading(dimScalarFields);
698 doFieldReading(dimVectorFields);
699 doFieldReading(dimSphereTensorFields);
700 doFieldReading(dimSymmTensorFields);
701 doFieldReading(dimTensorFields);
706 #undef doFieldReading 707 #define doFieldReading(Storage) \ 709 fieldsDistributor::readFields \ 711 volMeshOnProc, oldPointMesh, subsetterPtr, objects, Storage, \ 714 nPointFields += Storage.size(); \ 717 doFieldReading(pointScalarFields);
718 doFieldReading(pointVectorFields);
719 doFieldReading(pointSphTensorFields);
720 doFieldReading(pointSymmTensorFields);
721 doFieldReading(pointTensorFields);
722 #undef doFieldReading 737 pointDistributor.saveMeshPoints();
748 Info<<
"After distribution:" <<
endl;
754 #undef doCorrectCoupled 755 #define doCorrectCoupled(FieldType) \ 756 correctCoupledBoundaryConditions<processorFvPatch, FieldType>(mesh); 763 #undef doCorrectCoupled 776 pointDistributor.resetTarget(newPointMesh, distMap());
778 pointDistributor.distributeAndStore(pointScalarFields);
779 pointDistributor.distributeAndStore(pointVectorFields);
780 pointDistributor.distributeAndStore(pointSphTensorFields);
781 pointDistributor.distributeAndStore(pointSymmTensorFields);
782 pointDistributor.distributeAndStore(pointTensorFields);
822 <<
" to write reconstructed mesh (and fields)." <<
endl;
830 Info<<
"Restoring caseName" <<
endl;
845 Info<<
"Written redistributed mesh to " 902 refData.distribute(distMap());
915 <<
" to write reconstructed refinement data." <<
endl;
922 Info<<
"Restoring caseName" <<
endl;
997 int main(
int argc,
char *argv[])
1001 "Redistribute decomposed mesh and fields according" 1002 " to the decomposeParDict settings.\n" 1003 "Optionally run in decompose/reconstruct mode" 1020 "Test without writing the decomposition. " 1021 "Changes -cellDist to only write volScalarField." 1027 "Write cell distribution as a labelList - for use with 'manual' " 1028 "decomposition method or as a volScalarField for post-processing." 1033 "Only reconstruct new times (i.e. that do not exist already)" 1037 "Additional verbosity. (Can be used multiple times)" 1042 "Suppress finiteArea mesh/field handling",
1065 != fileOperations::uncollatedFileOperation::typeName
1092 const bool writeCellDist =
args.
found(
"cellDist");
1094 const bool newTimes =
args.
found(
"newTimes");
1097 const bool doFiniteArea = !
args.
found(
"no-finite-area");
1098 bool decompose =
args.
found(
"decompose");
1099 bool overwrite =
args.
found(
"overwrite");
1120 const wordRes selectedLagrangianFields;
1125 Info<<
"Decomposing case (like decomposePar)" <<
nl <<
endl;
1129 <<
"Cannot specify both -decompose and -reconstruct" 1135 Info<<
"Reconstructing case (like reconstructParMesh)" <<
nl <<
endl;
1142 <<
"Working in -decompose or -reconstruct mode:" 1143 " automatically implies -overwrite" <<
nl <<
endl;
1149 <<
": This utility can only be run parallel" 1166 nfs = (roots.size() == 1);
1171 Info<<
"Detected multiple roots i.e. non-nfs running" 1184 Info<<
"Removing existing processor directory:" 1195 Info<<
"No processor directories; switching on decompose mode" 1211 Info<<
"Creating time directories on all processors" <<
nl <<
endl;
1234 Info<<
"Creating time directories for undecomposed Time" 1235 <<
" on all processors" <<
nl <<
endl;
1240 Info<<
"Create undecomposed database" <<
nl <<
endl;
1257 for (
const instant& t : baseTimeDirs)
1259 masterTimeDirSet.insert(t.name());
1288 if (timeDirs.
empty())
1291 <<
"No times selected" 1301 <<
"Reconstructing mesh and addressing" <<
nl <<
endl;
1314 bool areaMeshDetected =
false;
1321 baseRunTime.
setTime(timeDirs[timeI], timeI);
1363 volMeshInstance/volMeshSubDir,
1372 areaMeshInstance/areaMeshSubDir,
1376 areaMeshDetected = areaMeshOnProc.
found(
true);
1388 bool haveVolAddressing =
false;
1409 "faceProcAddressing",
1419 faceProcAddressing.headerOk()
1420 && faceProcAddressing.size() == faces.size()
1426 haveVolAddressing =
true;
1429 bool haveAreaAddressing =
false;
1450 "faceProcAddressing",
1458 haveAreaAddressing =
1460 faceProcAddressing.headerOk()
1464 else if (areaMeshDetected)
1467 haveAreaAddressing =
true;
1475 bool volMeshHaveUndecomposed =
false;
1476 bool areaMeshHaveUndecomposed =
false;
1481 <<
" for undecomposed volume and area meshes..." 1500 volMeshHaveUndecomposed = facesIO.headerOk();
1517 areaMeshHaveUndecomposed = labelsIO.headerOk();
1526 volMeshHaveUndecomposed,
1527 areaMeshHaveUndecomposed
1532 Info<<
" volume mesh [" 1533 << volMeshHaveUndecomposed <<
"] : " 1534 << volMeshInstance <<
nl 1536 << areaMeshHaveUndecomposed <<
"] : " 1537 << areaMeshInstance <<
nl 1544 !volMeshHaveUndecomposed
1548 Info<<
"No undecomposed mesh. Creating from: " 1549 << volMeshInstance <<
endl;
1551 if (areaMeshHaveUndecomposed)
1553 areaMeshHaveUndecomposed =
false;
1554 Info<<
"Also ignore any undecomposed area mesh" 1576 const label nDestProcs(1);
1579 redistributeAndWrite
1609 areaMeshOnProc.
found(
true)
1612 !areaMeshHaveUndecomposed
1617 Info<<
"Loading area mesh from " 1618 << areaMeshInstance <<
endl;
1620 Info<<
" getting volume mesh support" <<
endl;
1640 baseMeshPtr().facesInstance(),
1693 Info<<
"Setting caseName to " << baseRunTime.
caseName()
1694 <<
" to write reconstructed area mesh." <<
endl;
1698 areaBaseMeshPtr().write();
1701 Info<<
"Restoring caseName" <<
endl;
1727 <<
"Reconstructing fields" <<
nl <<
endl;
1730 baseRunTime.
setTime(timeDirs[0], 0);
1738 Info<<
"Reading undecomposed mesh (on master)" <<
endl;
1754 Info<<
"Reading local, decomposed mesh" <<
endl;
1760 baseMeshPtr().facesInstance(),
1775 if (areaMeshDetected)
1795 areaBaseMeshPtr().facesInstance(),
1844 auto fvDistributorPtr =
1857 auto pointFieldDistributorPtr =
1874 Info<<
" Detected initial mesh motion;" 1875 <<
" reconstructing points" <<
nl 1877 fvDistributorPtr().reconstructPoints();
1884 if (newTimes && masterTimeDirSet.found(timeDirs[timeI].name()))
1886 Info<<
"Skipping time " << timeDirs[timeI].name()
1893 baseRunTime.
setTime(timeDirs[timeI], timeI);
1903 Info<<
" Detected mesh motion; reconstructing points" 1905 fvDistributorPtr().reconstructPoints();
1913 Info<<
" Detected topology change;" 1914 <<
" reconstructing addressing" <<
nl <<
endl;
1921 baseMeshPtr.
clear();
1941 fvDistributorPtr.reset
1956 pointFieldDistributorPtr.reset
1968 lagrangianDistributorPtr.
reset();
1972 Info<<
" Discarding finite-area addressing" 1973 <<
" (TODO)" <<
nl <<
endl;
1975 areaBaseMeshPtr.
reset();
1976 areaMeshPtr.reset();
1977 faDistributor.
reset();
1978 areaDistMap.
clear();
1989 .distributeAllFields(objects, selectedFields);
1993 pointFieldDistributorPtr()
1994 .distributeAllFields(objects, selectedFields);
2000 lagrangianDistributorPtr,
2004 selectedLagrangianFields
2010 .distributeAllFields(objects, selectedFields);
2033 baseMeshPtr().time()
2066 Info<<
"Setting time to that of master or undecomposed case : " 2067 << masterTime <<
endl;
2069 baseRunTime.
setTime(masterTime, 0);
2083 << (decompose ?
"Decomposing" :
"Redistributing")
2097 bool volMeshHaveUndecomposed =
true;
2098 bool areaMeshHaveUndecomposed = doFiniteArea;
2104 Info<<
"Checking undecomposed mesh in case: " 2130 if (
"constant" == areaMeshMasterInstance)
2137 areaMeshMasterInstance/areaMeshSubDir,
2143 if (areaMeshOnProc.
empty() || !areaMeshOnProc[0])
2145 areaMeshHaveUndecomposed =
false;
2154 Info<<
" volume mesh [" 2155 << volMeshHaveUndecomposed <<
"] : " 2156 << volMeshMasterInstance <<
nl 2158 << areaMeshHaveUndecomposed <<
"] : " 2159 << areaMeshMasterInstance <<
nl 2171 volMeshHaveUndecomposed,
2172 areaMeshHaveUndecomposed,
2173 volMeshMasterInstance,
2174 areaMeshMasterInstance
2186 volMeshMasterInstance/volMeshSubDir,
2195 areaMeshMasterInstance/areaMeshSubDir,
2212 volMeshMasterInstance/volMeshSubDir,
2223 Info<<
"Per processor faces dirs:" <<
nl 2231 if (!volMeshOnProc[proci])
2233 Info<<
" [missing]";
2251 areaMeshMasterInstance/areaMeshSubDir,
2262 Info<<
"Per processor faceLabels dirs:" <<
nl 2270 if (!areaMeshOnProc[proci])
2272 Info<<
" [missing]";
2286 Info<<
"Setting caseName to " << baseRunTime.
caseName()
2287 <<
" to read undecomposed mesh" <<
endl;
2298 volMeshMasterInstance,
2319 ? areaMeshHaveUndecomposed
2320 : areaMeshOnProc.
found(
true)
2329 areaMeshMasterInstance,
2347 Info<<
"Removing left-over empty processor directories" <<
nl;
2357 for (
const auto proci : procs)
2361 !volMeshOnProc[proci]
2362 && volMeshDir[proci] != volMeshDir[myProci]
2370 !areaMeshOnProc[proci]
2371 && areaMeshDir[proci] != areaMeshDir[myProci]
2380 if (proci != myProci)
2399 Info<<
"Restoring caseName" <<
endl;
2418 determineDecomposition
2468 areaMeshMasterInstance,
2487 selectedLagrangianFields
2517 volMeshMasterInstance,
2525 lagrangianDistributorPtr,
2557 Info<<
"Setting caseName to " << baseRunTime.
caseName()
2558 <<
" to write reconstructed mesh (and fields)." 2564 areaProcMeshPtr->
write();
2567 Info<<
"Restoring caseName" <<
endl;
2583 areaProcMeshPtr->
thisDb(),
2591 areaProcMeshPtr->
write();
2607 Info<<
"Written redistributed mesh to " 2618 areaFields.redistributeAndWrite(distributor,
true);
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...
virtual fileName dirPath(const bool checkGlobal, const IOobject &io, const bool search=true) const =0
Search for a directory. checkGlobal : also check undecomposed.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addNote(const string ¬e)
Add extra notes for the usage information.
void size(const label n)
Older name for setAddressableSize.
boolList haveMeshFile(const Time &runTime, const fileName &meshPath, const word &meshFile="faces", const bool verbose=true)
Check for availability of specified mesh file (default: "faces")
fileName path() const
Return path.
A class for handling file names.
Inter-processor communication reduction functions.
virtual bool parallelAware() const =0
Is method parallel aware?
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable, so the various sorted methods should be used if traversing in parallel.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const fileName & facesInstance() const
Return the current instance directory for faces.
void off()
Switch the function objects off.
word findInstance(const fileName &dir, const word &name=word::null, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, const word &stopInstance=word::null) const
Return time instance (location) of dir that contains the file name (eg, used in reading mesh data)...
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
static void removeFiles(const polyMesh &)
Helper: remove all relevant files from mesh instance.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void unset(bool verbose=false)
Deactivate SIGFPE signal handler and NaN memory initialisation.
const word & regionName() const
The mesh region name or word::null if polyMesh::defaultRegion.
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")
wordList names() const
The unsorted names of all objects.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights) const
Return the wanted processor number for every coordinate.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool found(const T &val, label pos=0) const
Same as contains()
static bool & parRun() noexcept
Test if this a parallel run.
void clear() noexcept
Same as reset(nullptr)
fileName relativePath(const fileName &input, const bool caseTag=false) const
Return the input relative to the globalPath by stripping off a leading value of the globalPath...
static unsigned int defaultPrecision() noexcept
Return the default precision.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
const fileName & rootPath() const noexcept
Return root path.
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...
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.
labelList faceLabels(nFaceLabels)
Distributor/redistributor for point fields, uses a two (or three) stage construction.
decompositionMethod & decomposer() const
Return demand-driven decomposition method.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
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
Return true if this is a processor case.
An encapsulation of filesystem-related operations.
static void broadcast(Type &value, const label comm=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all processes in communicator.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
Neighbour processor patch.
Mesh representing a set of points created from polyMesh.
#define forAll(list, i)
Loop across all elements in list.
void removeEmptyDirs(const fileName &path)
Remove empty directories from bottom up.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
static void allGatherList(List< T > &values, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Gather data, but keep individual values separate. Uses linear/tree communication. ...
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Foam::word regionName(Foam::polyMesh::defaultRegion)
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). 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 INVALID.
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in time.
void removeFiles(const fileName &instanceDir) const
Remove all files from mesh instance.
Finite volume reconstructor for volume and surface fields.
void redistributeLagrangian(autoPtr< parLagrangianDistributor > &distributorPtr, const fvMesh &mesh, const label nOldCells, const mapDistributePolyMesh &distMap, PtrList< unmappedPassivePositionParticleCloud > &clouds)
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. ...
List helper to append y unique elements onto the end of x.
const word & system() const noexcept
Return system name.
static int verbose_
Output verbosity when writing.
Reading is optional [identical to LAZY_READ].
Simple container to manage read/write, redistribute finiteArea fields.
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.
void removeEmptyDir(const fileName &path)
Remove empty directory.
Finite area area (element) fields.
const globalMeshData & globalData() const
Return parallel info.
static instantList selectIfPresent(Time &runTime, const argList &args)
If any time option provided return the set of times (as select0) otherwise return just the current ti...
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
Abstract base class for domain decomposition.
MeshObject wrapper of decompositionMethod.
fileName relativePath(const fileName &input, const bool caseTag=false) const
Return the input relative to the globalPath by stripping off a leading value of the globalPath...
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
static void combineReduce(const List< commsStruct > &comms, T &value, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) applying cop to inplace combine value from different processors...
bool rmDir(const fileName &directory, const bool silent=false, const bool emptyOnly=false)
Remove a directory and its contents recursively,.
virtual bool cp(const fileName &src, const fileName &dst, const bool followLink=true) const =0
Copy, recursively if necessary, the source to the destination.
void reconstructLagrangian(autoPtr< parLagrangianDistributor > &distributorPtr, const fvMesh &baseMesh, const fvMesh &mesh, const mapDistributePolyMesh &distMap, const wordRes &selectedFields)
static 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 word timeName(const scalar t, const int precision=precision_)
Return time name of given scalar time formatted with the given precision.
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
const word & constant() const noexcept
Return constant name.
int debug
Static debugging option.
const fileName & rootPath() const noexcept
Return root path.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
static void broadcasts(const label comm, Type &arg1, Args &&... args)
Broadcast multiple items to all processes in communicator.
fileName path() const
Return the full path to the (processor local) case.
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))
void removeFiles(const fileName &instanceDir) const
Remove all files from mesh instance.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name...
static word meshSubDir
The mesh sub-directory name (usually "faMesh")
const fileName & facesInstance() const
Return the current instance directory for faces.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
static instantList findTimes(const fileName &directory, const word &constantName="constant")
Search a given directory for valid time directories.
PtrList< unmappedPassivePositionParticleCloud > readLagrangian(const fvMesh &mesh, const wordList &cloudNames, const wordRes &selectedFields)
instantList times() const
Search the case for valid time directories.
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
const functionObjectList & functionObjects() const
Return the list of function objects.
#define WarningInFunction
Report a warning using Foam::Warning.
const fileName & globalCaseName() const noexcept
Return global case name.
static List< int > & procID(const label communicator)
The list of ranks within a given communicator.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label nCells() const noexcept
Number of mesh cells.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Mesh data needed to do the Finite Volume discretisation.
static bool master(const label communicator=worldComm)
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()
const dictionary & controlDict() const
Return read access to the controlDict dictionary.
messageStream Info
Information stream (stdout output on master, null elsewhere)
void removeProcAddressing(const faMesh &mesh)
Remove procAddressing.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Various for reading/decomposing/reconstructing/distributing refinement data.
T * get() noexcept
Return pointer to managed object without nullptr checking.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Mesh consisting of general polyhedral cells.
readUpdateState
Enumeration defining the state of the mesh after a read update.
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.
UPtrList< const regIOobject > sorted() const
Return sorted list of objects.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
Foam::argList args(argc, argv)
Defines the attributes of an object for which implicit objectRegistry management is supported...
virtual fileName objectPath(const IOobject &io, const word &typeName) const
Generate disk file name for object. Opposite of filePath.
int verbose() const noexcept
Return the verbose flag.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Do not request registration (bool: false)
bool found(const word &optName) const
Return true if the named option is found.
static mapDistributePolyMesh distribute(const faMesh &oldMesh, const mapDistributePolyMesh &distMap, const polyMesh &tgtPolyMesh, autoPtr< faMesh > &newMeshPtr)
Distribute mesh according to the given (volume) mesh distribution.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
fileName globalPath() const
Return the full path to the global case.
static autoPtr< fileOperation > NewUncollated()
The commonly used uncollatedFileOperation.
label localSize() const
My local size.
static constexpr const zero Zero
Global zero (0)