Go to the documentation of this file.
109 using namespace Foam;
127 masterTimeDirs = localTimeDirs;
135 for (
const instant& t : masterTimeDirs)
137 if (!localTimeDirs.found(t))
157 const bool decompose,
159 const word& readTimeName,
165 const IOobject readIO(
"uniform", readTimeName, readDb);
176 if (!readPath.empty())
178 Info<<
"Detected additional non-decomposed files in "
207 Pout<<
" readPath :" << readPath <<
endl;
208 Pout<<
" writePath :" << writePath <<
endl;
209 Pout<<
" currentPath:" << currentPath <<
endl;
212 if (readPath == writePath)
217 if (currentPath.empty())
222 fh.
cp(readPath, writePath);
230 fh.
cp(readPath, writePath);
239 if (isA<fileOperations::collatedFileOperation>(fh))
245 fh.
cp(readPath, writePath);
252 fh.
cp(readPath, writePath);
262 const fileName facesPath(meshPath/
"faces");
263 Info<<
"Checking for mesh in " << facesPath <<
nl <<
endl;
271 Info<<
"Per processor mesh availability:" <<
nl
294 basicFvGeometryScheme::typeName
328 label maxProcCells = 0;
329 label totProcFaces = 0;
330 label maxProcPatches = 0;
331 label totProcPatches = 0;
332 label maxProcFaces = 0;
337 <<
"Processor " << procI <<
nl
338 <<
" Number of cells = " << globalCells.localSize(procI)
341 label nProcFaces = 0;
343 const labelList& nei = patchNeiProcNo[procI];
345 forAll(patchNeiProcNo[procI], i)
347 Info<<
" Number of faces shared with processor "
348 << patchNeiProcNo[procI][i] <<
" = " << patchSize[procI][i]
351 nProcFaces += patchSize[procI][i];
354 Info<<
" Number of processor patches = " << nei.size() <<
nl
355 <<
" Number of processor faces = " << nProcFaces <<
nl
356 <<
" Number of boundary faces = "
357 << globalBoundaryFaces.localSize(procI)-nProcFaces <<
endl;
359 maxProcCells =
max(maxProcCells, globalCells.localSize(procI));
360 totProcFaces += nProcFaces;
361 totProcPatches += nei.size();
362 maxProcPatches =
max(maxProcPatches, nei.size());
363 maxProcFaces =
max(maxProcFaces, nProcFaces);
373 if (totProcPatches == 0)
377 if (totProcFaces == 0)
383 <<
"Number of processor faces = " << totProcFaces/2 <<
nl
384 <<
"Max number of cells = " << maxProcCells
385 <<
" (" << 100.0*(maxProcCells-avgProcCells)/avgProcCells
386 <<
"% above average " << avgProcCells <<
")" <<
nl
387 <<
"Max number of processor patches = " << maxProcPatches
388 <<
" (" << 100.0*(maxProcPatches-avgProcPatches)/avgProcPatches
389 <<
"% above average " << avgProcPatches <<
")" <<
nl
390 <<
"Max number of faces between processors = " << maxProcFaces
391 <<
" (" << 100.0*(maxProcFaces-avgProcFaces)/avgProcFaces
392 <<
"% above average " << avgProcFaces <<
")" <<
nl
398 void writeDecomposition
420 cellDecomposition.write();
422 Info<<
"Writing wanted cell distribution to volScalarField " <<
name
423 <<
" for postprocessing purposes." <<
nl <<
endl;
438 zeroGradientFvPatchScalarField::typeName
443 procCells[cI] = decomp[cI];
446 procCells.correctBoundaryConditions();
451 void determineDecomposition
453 const Time& baseRunTime,
455 const bool decompose,
458 const bool writeCellDist,
476 <<
"You have selected decomposition method "
477 << decomposer.typeName
478 <<
" which does" <<
nl
479 <<
"not synchronise the decomposition across"
480 <<
" processor patches." <<
nl
481 <<
" You might want to select a decomposition method"
482 <<
" which is aware of this. Continuing."
492 <<
" to read decomposeParDict" <<
endl;
498 if (method.
found(
"weightField"))
514 cellWeights = weights.internalField();
522 Info<<
"Restoring caseName to " << proc0CaseName <<
endl;
538 <<
" to write undecomposed cellDist" <<
endl;
542 writeDecomposition(
"cellDist",
mesh, decomp);
543 Info<<
"Restoring caseName to " << proc0CaseName <<
endl;
552 writeDecomposition(
"cellDist",
mesh, decomp);
559 void writeProcAddressing
574 "cellProcAddressing",
587 "faceProcAddressing",
600 "pointProcAddressing",
613 "boundaryProcAddressing",
664 patchDistMap.constructSize(),
665 patchDistMap.subMap(),
666 patchDistMap.subHasFlip(),
667 patchDistMap.constructMap(),
668 patchDistMap.constructHasFlip(),
719 if (writeHandler.
valid())
721 defaultHandler =
fileHandler(std::move(writeHandler));
724 const bool cellOk = cellMap.write();
725 const bool faceOk =
faceMap.write();
726 const bool pointOk = pointMap.write();
727 const bool patchOk = patchMap.write();
729 if (defaultHandler.
valid())
731 writeHandler =
fileHandler(std::move(defaultHandler));
734 if (!cellOk || !faceOk || !pointOk || !patchOk)
737 <<
"Failed to write " << cellMap.objectPath()
738 <<
", " <<
faceMap.objectPath()
739 <<
", " << pointMap.objectPath()
740 <<
", " << patchMap.objectPath()
749 for (
const auto prefix : {
"boundary",
"cell",
"face",
"point"})
753 prefix +
word(
"ProcAddressing"),
766 template<
class GeoField>
780 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
798 template<
class GeoField>
812 wordList objectNames = objects.sortedNames();
821 <<
"Objects not synchronised across processors." <<
nl
828 fields.setSize(masterNames.size());
854 if (!haveMesh[procI])
919 template<
class GeoField,
class CoupledPatchType>
920 void correctCoupledBoundaryConditions(
fvMesh&
mesh)
924 mesh.objectRegistry::lookupClass<GeoField>()
929 GeoField&
fld = *iter();
931 typename GeoField::Boundary& bfld =
fld.boundaryFieldRef();
942 auto& pfld = bfld[patchi];
945 if (fvp.coupled() && !isA<cyclicACMIFvPatch>(fvp))
961 for (
auto& pfld : bfld)
963 const auto& fvp = pfld.patch();
965 if (fvp.coupled() && !isA<cyclicACMIFvPatch>(fvp))
974 fld.mesh().globalData().patchSchedule();
976 forAll(patchSchedule, patchEvali)
978 const label patchi = patchSchedule[patchEvali].patch;
980 auto& pfld = bfld[patchi];
982 if (fvp.coupled() && !isA<cyclicACMIFvPatch>(fvp))
984 if (patchSchedule[patchEvali].
init)
998 <<
"Unsupported communications type "
1010 const Time& baseRunTime,
1013 const bool doReadFields,
1014 const bool decompose,
1016 const bool overwrite,
1018 const label nDestProcs,
1062 const bool allHaveMesh = !haveMesh.found(
false);
1073 <<
"Cannot find non-processor patch on processor "
1102 <<
" mesh:" <<
mesh.objectRegistry::objectPath()
1103 <<
" have objects:" << objects.
names() <<
endl;
1107 auto iter = objects.find(
"cellDist");
1110 objects.erase(iter);
1145 volSphereTensorFields
1193 surfSphereTensorFields
1202 surfSymmTensorFields
1240 dimSphereTensorFields
1268 objects.lookupClass(pointScalarField::typeName).sortedNames()
1272 objects.lookupClass(pointVectorField::typeName).sortedNames()
1278 pointSphericalTensorField::typeName
1285 pointSymmTensorField::typeName
1290 objects.lookupClass(pointTensorField::typeName).sortedNames()
1312 Info<<
"After distribution:" <<
endl;
1313 printMeshData(
mesh);
1316 correctCoupledBoundaryConditions
1321 correctCoupledBoundaryConditions
1326 correctCoupledBoundaryConditions
1331 correctCoupledBoundaryConditions
1336 correctCoupledBoundaryConditions
1378 Info<<
"Setting caseName to " << baseRunTime.
caseName()
1379 <<
" to write reconstructed mesh and fields." <<
endl;
1386 for (
const word& fieldName : pointFieldNames)
1402 Info<<
"Restoring caseName to " << proc0CaseName <<
endl;
1410 if (writeHandler.
valid())
1412 defaultHandler =
fileHandler(std::move(writeHandler));
1417 if (defaultHandler.
valid())
1419 writeHandler =
fileHandler(std::move(defaultHandler));
1422 for (
const word& fieldName : pointFieldNames)
1444 writeProcAddressing(std::move(writeHandler),
mesh, map, decompose);
1451 removeProcAddressing(
mesh);
1487 refData.distribute(map);
1499 Info<<
"Setting caseName to " << baseRunTime.
caseName()
1500 <<
" to write reconstructed refinement data." <<
endl;
1507 Info<<
"Restoring caseName to " << proc0CaseName <<
endl;
1611 forAll(boundaryProcAddressing, i)
1613 if (boundaryProcAddressing[i] != -1)
1615 patchProcAddressing.append(boundaryProcAddressing[i]);
1625 if (baseMeshPtr && baseMeshPtr->
nCells())
1627 const fvMesh& baseMesh = *baseMeshPtr;
1635 std::move(cellSubMap),
1636 std::move(cellAddressing)
1645 std::move(faceSubMap),
1646 std::move(faceAddressing),
1657 std::move(pointSubMap),
1658 std::move(pointAddressing)
1669 std::move(patchSubMap),
1670 std::move(boundaryAddressing)
1679 labelList oldPatchNMeshPoints(pbm.size());
1682 oldPatchStarts[patchI] = pbm[patchI].
start();
1683 oldPatchNMeshPoints[patchI] = pbm[patchI].nPoints();
1693 std::move(oldPatchStarts),
1694 std::move(oldPatchNMeshPoints),
1695 std::move(pointMap),
1711 std::move(cellSubMap),
1712 std::move(cellConstructMap)
1722 std::move(faceSubMap),
1723 std::move(faceConstructMap),
1735 std::move(pointSubMap),
1736 std::move(pointConstructMap)
1748 std::move(patchSubMap),
1749 std::move(patchConstructMap)
1758 labelList oldPatchNMeshPoints(pbm.size());
1761 oldPatchStarts[patchI] = pbm[patchI].
start();
1762 oldPatchNMeshPoints[patchI] = pbm[patchI].nPoints();
1772 std::move(oldPatchStarts),
1773 std::move(oldPatchNMeshPoints),
1774 std::move(pointMap),
1786 void readProcAddressing
1809 Info<<
"Reading addressing from procXXXAddressing at "
1815 "cellProcAddressing",
1827 "faceProcAddressing",
1839 "pointProcAddressing",
1851 "boundaryProcAddressing",
1870 <<
"Read addressing inconsistent with mesh sizes" <<
nl
1872 <<
" addressing:" << cellProcAddressing.objectPath()
1873 <<
" size:" << cellProcAddressing.size() <<
nl
1878 <<
" addressing:" << pointProcAddressing.objectPath()
1879 <<
" size:" << pointProcAddressing.size()
1881 <<
" addressing:" << boundaryProcAddressing.objectPath()
1882 <<
" size:" << boundaryProcAddressing.size()
1887 distMap = createReconstructMap
1893 pointProcAddressing,
1894 boundaryProcAddressing
1900 void reconstructMeshFields
1995 void reconstructLagrangian
2001 const wordRes& selectedLagrangianFields
2011 if (cloudNames.size())
2013 if (!lagrangianReconstructorPtr)
2015 lagrangianReconstructorPtr.
reset
2027 *lagrangianReconstructorPtr;
2031 Info<<
"Reconstructing lagrangian fields for cloud "
2054 selectedLagrangianFields
2061 selectedLagrangianFields
2068 selectedLagrangianFields
2075 selectedLagrangianFields
2082 selectedLagrangianFields
2089 selectedLagrangianFields
2097 selectedLagrangianFields
2105 selectedLagrangianFields
2112 selectedLagrangianFields
2120 selectedLagrangianFields
2127 selectedLagrangianFields
2134 selectedLagrangianFields
2146 const wordRes& selectedLagrangianFields,
2180 selectedLagrangianFields
2187 selectedLagrangianFields
2194 selectedLagrangianFields
2203 selectedLagrangianFields
2210 selectedLagrangianFields
2217 selectedLagrangianFields
2226 selectedLagrangianFields
2233 selectedLagrangianFields
2240 selectedLagrangianFields
2249 selectedLagrangianFields
2256 selectedLagrangianFields
2263 selectedLagrangianFields
2272 selectedLagrangianFields
2279 selectedLagrangianFields
2286 selectedLagrangianFields
2295 selectedLagrangianFields
2302 selectedLagrangianFields
2309 selectedLagrangianFields
2315 void redistributeLagrangian
2319 const label nOldCells,
2326 if (!lagrangianReconstructorPtr)
2328 lagrangianReconstructorPtr.
reset
2340 lagrangianReconstructorPtr();
2471 int main(
int argc,
char *argv[])
2475 "Redistribute decomposed mesh and fields according"
2476 " to the decomposeParDict settings.\n"
2477 "Optionally run in decompose/reconstruct mode"
2493 "Test without writing the decomposition. "
2494 "Changes -cellDist to only write volScalarField."
2499 "Write cell distribution as a labelList - for use with 'manual' "
2500 "decomposition method or as a volScalarField for post-processing."
2505 "Only reconstruct new times (i.e. that do not exist already)"
2528 != fileOperations::uncollatedFileOperation::typeName
2541 writeHandler.
valid()
2556 const bool writeCellDist =
args.
found(
"cellDist");
2558 const bool newTimes =
args.
found(
"newTimes");
2560 bool decompose =
args.
found(
"decompose");
2561 bool overwrite =
args.
found(
"overwrite");
2575 const wordRes selectedLagrangianFields;
2580 Info<<
"Decomposing case (like decomposePar)" <<
nl <<
endl;
2584 <<
"Cannot specify both -decompose and -reconstruct"
2590 Info<<
"Reconstructing case (like reconstructParMesh)" <<
nl <<
endl;
2599 <<
"Working in decompose or reconstruction mode automatically"
2600 <<
" implies -overwrite" <<
nl <<
endl;
2609 <<
": This utility can only be run parallel"
2626 nfs = (roots.size() == 1);
2631 Info<<
"Detected multiple roots i.e. non-nfs running"
2644 Info<<
"Removing existing processor directory" << procDir <<
endl;
2654 Info<<
"No processor directories; switching on decompose mode"
2670 Info<<
"Creating time directories on all processors" <<
nl <<
endl;
2693 Info<<
"Creating time directories for undecomposed Time"
2694 <<
" on all processors" <<
nl <<
endl;
2699 Info<<
"Create undecomposed database"<<
nl <<
endl;
2715 for (
const instant& t : baseTimeDirs)
2717 masterTimeDirSet.insert(t.name());
2746 if (timeDirs.empty())
2749 <<
"No times selected"
2759 <<
"Pass1 : reconstructing mesh and addressing" <<
nl <<
endl;
2778 baseRunTime.
setTime(timeDirs[timeI], timeI);
2812 bool haveAddressing =
false;
2833 "faceProcAddressing",
2847 haveAddressing =
true;
2853 haveAddressing =
true;
2860 bool haveUndecomposedMesh =
false;
2864 <<
" for undecomposed mesh" <<
endl;
2878 haveUndecomposedMesh = facesIO.headerOk();
2886 !haveUndecomposedMesh
2890 Info<<
"loading mesh from " << facesInstance <<
endl;
2906 setBasicGeometry(
mesh);
2912 Info<<
"Reconstructing mesh for time " << facesInstance
2915 label nDestProcs = 1;
2918 redistributeAndWrite
2920 std::move(writeHandler),
2946 <<
"Pass2 : reconstructing fields" <<
nl <<
endl;
2949 baseRunTime.
setTime(timeDirs[0], 0);
2957 Info<<
"Reading undecomposed mesh (on master)" <<
endl;
2970 setBasicGeometry(baseMeshPtr());
2973 Info<<
"Reading local, decomposed mesh" <<
endl;
2980 baseMeshPtr().facesInstance(),
3000 readProcAddressing(
mesh, baseMeshPtr, distMap);
3022 Info<<
" Detected initial mesh motion;"
3023 <<
" reconstructing points" <<
nl
3025 fvReconstructorPtr().reconstructPoints();
3032 if (newTimes && masterTimeDirSet.found(timeDirs[timeI].name()))
3034 Info<<
"Skipping time " << timeDirs[timeI].name()
3041 baseRunTime.
setTime(timeDirs[timeI], timeI);
3051 Info<<
" Dected mesh motion; reconstructing points" <<
nl
3053 fvReconstructorPtr().reconstructPoints();
3061 Info<<
" Detected topology change;"
3062 <<
" reconstructing addressing" <<
nl <<
endl;
3069 baseMeshPtr.
clear();
3084 readProcAddressing(
mesh, baseMeshPtr, distMap);
3087 fvReconstructorPtr.reset
3097 lagrangianReconstructorPtr.
clear();
3106 reconstructMeshFields
3108 fvReconstructorPtr(),
3114 reconstructLagrangian
3116 lagrangianReconstructorPtr,
3120 selectedLagrangianFields
3143 baseMeshPtr().time()
3176 Info<<
"Setting time to that of master or undecomposed case : "
3177 << masterTime <<
endl;
3179 baseRunTime.
setTime(masterTime, 0);
3215 Info<<
"Setting caseName to " << baseRunTime.
caseName()
3216 <<
" to find undecomposed mesh" <<
endl;
3232 Info<<
"Restoring caseName to " << proc0CaseName <<
endl;
3241 const boolList haveMesh(haveFacesFile(meshPath));
3268 Info<<
"Setting caseName to " << baseRunTime.
caseName()
3269 <<
" to read undecomposed mesh" <<
endl;
3288 if (writeHandler.
valid())
3301 for (
const auto proci : procs)
3306 && meshDir[proci] != meshDir[myProci]
3309 Info<<
"Deleting mesh dir:" << meshDir[proci]
3311 rmDir(meshDir[proci]);
3325 Info<<
"Restoring caseName to " << proc0CaseName <<
endl;
3340 determineDecomposition
3360 rmDir(
mesh.objectRegistry::objectPath());
3393 selectedLagrangianFields,
3406 std::move(writeHandler),
3423 redistributeLagrangian
3425 lagrangianReconstructorPtr,
int debug
Static debugging option.
static instantList findTimes(const fileName &directory, const word &constantName="constant")
Search a given directory for valid time directories.
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
List< label > labelList
A List of labels.
const labelListList & subMap() const
From subsetted data back to original data.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
static const word prefix
The prefix to local: lagrangian.
label reconstructFvVolumeInternalFields(const IOobjectList &objects, const wordRes &selectedFields=wordRes()) const
Read, reconstruct and write all/selected volume internal fields.
const fileName & globalCaseName() const
Return global case name.
bool constructHasFlip() const
Does constructMap include a sign.
GeometricField< tensor, fvPatchField, volMesh > volTensorField
Defines the attributes of an object for which implicit objectRegistry management is supported,...
PtrList< labelIOList > & faceProcAddressing
Foam::autoPtr< Foam::fvMesh > meshPtr(nullptr)
autoPtr< fvMesh > loadOrCreateMesh(const bool decompose, const IOobject &io)
Load (if it exists) or create zero cell mesh given an IOobject:
static constexpr int masterNo() noexcept
Process index of the master (always 0)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
const word cloudName(propsDict.get< word >("cloud"))
A class for handling words, derived from Foam::string.
An encapsulation of filesystem-related operations.
label redistributeStoredFields(const mapDistributeBase &map, passivePositionParticleCloud &cloud) const
Redistribute and write stored lagrangian fields.
A class for handling file names.
A primitive field of type <T> with automated input and output.
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
static word defaultRegion
Return the default region name.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
This boundary condition enables processor communication across patches.
A class for managing temporary objects.
Given the original mesh and the list of selected cells, it creates the mesh consisting only of the de...
static constexpr const zero Zero
Global zero (0)
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
int debugSwitch(const char *name, const int deflt=0)
Lookup debug switch or add default value.
Output inter-processor communications stream.
virtual const fvGeometryScheme & geometry() const
Return reference to geometry calculation scheme.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
void distributeCellData(List< T > &lst) const
Distribute list of cell data.
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
bool processorCase() const noexcept
Return true if this is a processor case.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
static autoPtr< fileOperation > NewUncollated()
Static construct the commonly used uncollatedFileOperation.
static word timeName(const scalar t, const int precision=precision_)
virtual void flush() const
Forcibly wait until all output done. Flush any cached data.
static void addNote(const string ¬e)
Add extra notes for the usage information.
const functionObjectList & functionObjects() const
Return the list of function objects.
instantList select(const instantList ×) const
Select a list of Time values that are within the ranges.
const fileName & facesInstance() const
Return the current instance directory for faces.
void transfer(mapDistributePolyMesh &map)
Transfer the contents of the argument and annul the argument.
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
static bool master(const label communicator=worldComm)
Am I the master process.
void combineReduce(const List< UPstream::commsStruct > &comms, T &Value, const CombineOp &cop, const int tag, const label comm)
int neighbProcNo() const
Return neighbour processor number.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
Extract command arguments and options from the supplied argc and argv parameters.
passivePositionParticleCloud but with autoMap and writing disabled. Only used for its objectRegistry ...
static void unset(bool verbose=false)
Deactivate SIGFPE signal handler and NaN memory initialisation.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
const fileOperation & fileHandler()
Get current file handler.
bool valid() const noexcept
Identical to good(), or bool operator.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
decompositionMethod & decomposer() const
Return demand-driven decomposition method.
const T * set(const label i) const
Return const pointer to element (can be nullptr),.
static commsTypes defaultCommsType
Default commsType.
A Field of objects of type <T> with automated input and output using a compact storage....
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
writeOption writeOpt() const noexcept
The write option.
static void removeFiles(const polyMesh &)
Helper: remove all relevant files from mesh instance.
MeshObject wrapper of decompositionMethod.
label start() const
The start label of the boundary faces in the polyMesh face list.
Mesh consisting of general polyhedral cells.
virtual instantList findTimes(const fileName &, const word &) const
Get sorted list of times.
wordList names() const
Return a list of patch names.
const labelList & processorPatches() const noexcept
Return list of processor patch labels.
label nPoints() const noexcept
Number of mesh points.
#define forAll(list, i)
Loop across all elements in list.
const mapDistribute & cellMap() const
Cell distribute map.
static const decompositionModel & New(const polyMesh &mesh, const fileName &decompDictFile="", const dictionary *fallback=nullptr)
Registry of regIOobjects.
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in time.
static void findClouds(const fvMesh &, wordList &cloudNames, List< wordList > &objectNames)
Find all clouds (on all processors) and for each cloud all.
label reconstructFvSurfaceFields(const IOobjectList &objects, const wordRes &selectedFields=wordRes()) const
Read, reconstruct and write all/selected surface fields.
const fileName & pointsInstance() const
Return the current instance directory for points.
virtual bool parallelAware() const =0
Is method parallel aware?
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
label nCells() const noexcept
Number of mesh cells.
static rangeType subProcs(const label communicator=worldComm)
Range of process indices for sub-processes.
int dryRun() const noexcept
Return the dry-run flag.
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
void off()
Switch the function objects off.
messageStream Info
Information stream (stdout output on master, null elsewhere)
static void distribute(const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const bool subHasFlip, const labelListList &constructMap, const bool constructHasFlip, List< T > &, const negateOp &negOp, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Distribute data. Note:schedule only used for.
Lagrangian field redistributor.
void setSize(const label n)
Alias for resize()
void removeFiles(const fileName &instanceDir) const
Remove all files from mesh instance.
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
const mapDistribute & faceMap() const
Face distribute map.
Class containing processor-to-processor mapping information.
const mapDistribute & patchMap() const
Patch distribute map.
instantList times() const
Search the case for valid time directories.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
autoPtr< mapDistributeBase > redistributeLagrangianPositions(passivePositionParticleCloud &cloud) const
Redistribute and write lagrangian positions.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Neighbour processor patch.
static List< int > & procID(label communicator)
Process ID of given process index.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
GeometricField< scalar, fvPatchField, volMesh > volScalarField
virtual bool rmDir(const fileName &dir, const bool silent=false) const =0
Remove a directory and its contents.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
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))
Various for reading/decomposing/reconstructing/distributing refinement data.
static const Enum< commsTypes > commsTypeNames
Names of the communication types.
static instantList selectIfPresent(Time &runTime, const argList &args)
const labelList & oldPatchSizes() const
List of the old patch sizes.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
fileName path() const
Return the full path to the (processor local) case.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dictionary & controlDict() const
Return read access to the controlDict dictionary.
const wordRes fieldNames(propsDict.getOrDefault< wordRes >("fields", wordRes()))
Abstract base class for domain decomposition.
bool subHasFlip() const
Does subMap include a sign.
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Mesh data needed to do the Finite Volume discretisation.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
errorManip< error > abort(error &err)
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
List helper to append y unique elements onto the end of x.
virtual fileName objectPath(const IOobject &io, const word &typeName) const
Generate disk file name for object. Opposite of filePath.
Inter-processor communication reduction functions.
List of IOobjects with searching and retrieving facilities.
word findInstance(const fileName &dir, const word &name=word::null, const IOobject::readOption rOpt=IOobject::MUST_READ, const word &stopInstance=word::null) const
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
static label nDomains(const dictionary &decompDict, const word ®ionName="")
Return region-specific or top-level numberOfSubdomains entry.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
readUpdateState
Enumeration defining the state of the mesh after a read update.
A HashTable similar to std::unordered_map.
label nNonProcessor() const
The number of patches before the first processor patch.
GeometricField< vector, fvPatchField, volMesh > volVectorField
void reset(autoPtr< T > &&other) noexcept
Delete managed object and set to new given pointer.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
label constructSize() const
Constructed data size.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static unsigned int defaultPrecision() noexcept
Return the default precision.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
const word & system() const
Return system name.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights) const
Return the wanted processor number for every coordinate.
static rangeType allProcs(const label communicator=worldComm)
Range of process indices for all processes.
const fileName & caseName() const
Return case name.
label reconstructFvVolumeFields(const IOobjectList &objects, const wordRes &selectedFields=wordRes()) const
Read, reconstruct and write all/selected volume fields.
static int & msgType() noexcept
Message tag of standard messages.
static label nRequests()
Get number of outstanding requests.
void removeEmptyDirs(const fileName &path)
Remove empty directories from bottom up.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
static label readFields(const passivePositionParticleCloud &cloud, const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Read and store all fields of a cloud.
fileName path() const
Return path.
wordList names() const
The names of all objects.
bool rmDir(const fileName &directory, const bool silent=false)
Remove a directory and its contents (optionally silencing warnings)
Reconstructor for lagrangian positions and fields.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
const fileName & rootPath() const
Return root path.
static label worldComm
Default communicator (all processors)
static bool & parRun() noexcept
Test if this a parallel run.
virtual bool isFile(const fileName &, const bool checkGzip=true, const bool followLink=true) const =0
Does the name exist as a FILE in the file system?
IOmapDistributePolyMesh is derived from mapDistributePolyMesh and IOobject to give the mapDistributeP...
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
A List of wordRe with additional matching capabilities.
fileName globalPath() const
Return the full path to the global case.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
static const word null
An empty word.
const polyBoundaryMesh & patches
void clear() noexcept
Same as reset(nullptr)
Class containing processor-to-processor mapping information.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
void reverseDistribute(const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
const Time & time() const
Return the top-level database.
virtual bool cp(const fileName &src, const fileName &dst, const bool followLink=true) const =0
Copy, recursively if necessary, the source to the destination.
Input inter-processor communications stream.
label nFaces() const noexcept
Number of mesh faces.
const mapDistribute & pointMap() const
Point distribute map.
label nOldFaces() const
Number of faces in mesh before distribution.
An instant of time. Contains the time value and name.
GeometricField< sphericalTensor, fvPatchField, volMesh > volSphericalTensorField
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
const globalMeshData & globalData() const
Return parallel info.
label nOldPoints() const
Number of points in mesh before distribution.
static tmp< fvGeometryScheme > New(const fvMesh &mesh, const dictionary &dict, const word &defaultScheme)
Return new tmp interpolation scheme.
fileName objectPath() const
The complete path + object name.
label nOldCells() const
Number of cells in mesh before distribution.
virtual fileName dirPath(const bool checkGlobal, const IOobject &io, const bool search=true) const =0
Search for a directory. checkGlobal : also check undecomposed.
const word & constant() const
Return constant name.
const labelListList & constructMap() const
From subsetted data to new reconstructed data.
IOobjectList lookupClass(const char *clsName) const
The list of IOobjects with the given headerClassName.
Foam::argList args(argc, argv)
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
void distributePointData(List< T > &lst) const
Distribute list of point data.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
#define DebugVar(var)
Report a variable name and value.
#define WarningInFunction
Report a warning using Foam::Warning.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
bool distributed() const noexcept
Distributed roots (parallel run)
const Time & time() const noexcept
Return time registry.
void setInstance(const fileName &instance, const IOobject::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
const fileName & rootPath() const noexcept
Return root path.
static label nProcs(const label communicator=worldComm)
Number of processes in parallel run, and 1 for serial run.
Finite volume reconstructor for volume and surface fields.
const dimensionSet dimless
Dimensionless.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
bool found(const word &optName) const
Return true if the named option is found.
Load or create (0 size) a mesh. Used in distributing meshes to a larger number of processors.
Functor to negate primitives. Dummy for most other types.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.