52 typedef fileOperation::procRangeType procRangeType;
58 fileOperation::splitProcessorPath
70 handler.readDir(
path, fileName::Type::DIRECTORY)
78 for (
const fileName& dirN : dirEntries)
83 const label readProci =
84 fileOperation::splitProcessorPath
85 (dirN,
rp, rd, rl,
group, rNum);
87 if (proci == readProci)
108 else if (
group.contains(proci))
135 const fileName& meshPath,
136 const word& meshFile,
159 typedef fileOperation::procRangeType procRangeType;
163 handler.filePath(
runTime.path()/meshPath/meshFile)
165 bool found = handler.isFile(fName);
172 bool isCollated =
false;
176 if (UPstream::master(UPstream::worldComm))
178 const bool oldParRun = UPstream::parRun(
false);
183 IOobject
io(meshFile, meshPath,
runTime);
186 isCollated = decomposedBlockData::isCollatedType(
io);
188 UPstream::parRun(oldParRun);
190 Pstream::broadcast(isCollated);
197 const label nProcs = UPstream::nProcs(
fileHandler().comm());
198 const label myProcNo = UPstream::myProcNo(
fileHandler().comm());
203 Pstream::listGatherValues
212 label myBlockNumber = -1;
217 label proci = fileOperation::splitProcessorPath
227 if (proci == -1 &&
group.empty())
231 myBlockNumber = UPstream::myProcNo(UPstream::worldComm);
237 myBlockNumber = myProcNo;
242 Pstream::listGatherValues
260 label blockRanki = -1;
266 || (fNames[ranki] != fNames[blockRanki])
270 IFstream is(fNames[ranki]);
271 nBlocks = decomposedBlockData::getNumBlocks(is);
274 allFound[ranki] = (myBlockNumbers[ranki] < nBlocks);
278 found = Pstream::listScatterValues
291 UPstream::allGatherValues<bool>(
found, UPstream::worldComm)
296 Info<<
"Per processor availability of \"" 297 << meshFile <<
"\" file in " << meshPath <<
nl 301 return haveFileOnProc;
310 mesh.facesInstance(),
315 for (
const auto prefix : {
"boundary",
"edge",
"face",
"point"})
317 io.rename(prefix + word(
"ProcAddressing"));
319 const fileName procFile(
io.objectPath());
330 mesh.facesInstance(),
331 polyMesh::meshSubDir,
335 for (
const auto prefix : {
"boundary",
"cell",
"face",
"point"})
337 io.rename(prefix + word(
"ProcAddressing"));
339 const fileName procFile(
io.objectPath());
348 fileName& facesInstance,
349 fileName& pointsInstance
352 const fileName meshSubDir
354 polyMesh::meshDir(
io.name())
357 if (UPstream::master())
359 const bool oldParRun = UPstream::parRun(
false);
361 const int oldCache = fileOperation::cacheLevel(0);
363 facesInstance =
io.time().findInstance
367 IOobjectOption::MUST_READ
369 pointsInstance =
io.time().findInstance
373 IOobjectOption::MUST_READ
376 fileOperation::cacheLevel(oldCache);
379 const_cast<fileOperation&
>(
fileHandler()).nProcs(oldNumProcs);
381 UPstream::parRun(oldParRun);
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")
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler()
#define forAll(list, i)
Loop across all elements in list.
constexpr const char *const group
Group name for atomic constants.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
bool returnReduceAnd(const bool value, const label comm=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
void masterMeshInstance(const IOobject &io, fileName &facesInstance, fileName &pointsInstance)
Determine master faces instance.
regionProperties rp(runTime)
Miscellaneous file handling for meshes.
bool exists(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
bool checkFileExistence(const fileName &fName)
Check for availability of given file.
messageStream Info
Information stream (stdout output on master, null elsewhere)
void removeProcAddressing(const faMesh &mesh)
Remove procAddressing.
List< label > labelList
A List of labels.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
List< fileName > fileNameList
List of fileName.
List< bool > boolList
A List of bools.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.