55 static bool checkFileExistenceCollated
65 const auto handlerComm = handler.
comm();
72 label myBlockNumber = -1;
77 if (proci == -1 &&
group.empty())
81 myBlockNumber = globalProci;
86 myBlockNumber = handlerProci;
131 allFound.
resize(nHandlerProcs,
false);
134 label nBlocks = -1, blockRanki = -1;
136 for (label ranki = 0; ranki < nHandlerProcs; ++ranki)
141 || (fNames[ranki] != fNames[blockRanki])
145 IFstream is(fNames[ranki]);
149 allFound[ranki] = (myBlockNumbers[ranki] < nBlocks);
167 static bool checkProcessorFile
170 const fileName& instance,
171 const fileName&
local,
187 bool isCollated =
false;
199 if (IFstream is(fName); is.good())
215 found = checkFileExistenceCollated(handler, fName);
223 static bool checkProcessorFile
226 const fileName& meshPath,
242 bool isCollated =
false;
254 if (IFstream is(fName); is.good())
256 IOobject
io(meshFile, meshPath,
runTime);
270 found = checkFileExistenceCollated(handler, fName);
284 const fileName& instance,
285 const fileName&
local,
297 Info<<
"Per processor availability of \"" 302 return haveFileOnProc;
309 const fileName& instance,
310 const fileName&
local,
320 UPstream::allGatherValues<bool>(
found, UPstream::worldComm)
325 Info<<
"Per processor availability of \"" 330 return haveFileOnProc;
337 const fileName& meshPath,
338 const word& meshFile,
342 bool found = checkProcessorFile(
runTime, meshPath, meshFile);
347 UPstream::allGatherValues<bool>(
found, UPstream::worldComm)
352 Info<<
"Per processor availability of \"" 353 << meshFile <<
"\" file in " << meshPath <<
nl 357 return haveFileOnProc;
366 mesh.facesInstance(),
371 for (
const auto prefix : {
"boundary",
"edge",
"face",
"point"})
373 io.rename(prefix + word(
"ProcAddressing"));
375 const fileName procFile(
io.objectPath());
386 mesh.facesInstance(),
387 polyMesh::meshSubDir,
391 for (
const auto prefix : {
"boundary",
"cell",
"face",
"point"})
393 io.rename(prefix + word(
"ProcAddressing"));
395 const fileName procFile(
io.objectPath());
404 fileName& facesInstance,
405 fileName& pointsInstance
408 const fileName meshSubDir
410 polyMesh::meshDir(
io.name())
413 if (UPstream::master(UPstream::worldComm))
415 const auto oldParRun = UPstream::parRun(
false);
417 const auto oldCache = fileOperation::cacheLevel(0);
419 facesInstance =
io.time().findInstance
423 IOobjectOption::MUST_READ
425 pointsInstance =
io.time().findInstance
429 IOobjectOption::MUST_READ
433 fileOperation::cacheLevel(oldCache);
438 UPstream::parRun(oldParRun);
A class for handling file names.
boolList haveMeshFile(const word &name, const fileName &instance, const fileName &local, const Time &runTime, const bool verbose=true)
Check for availability of specified file (on all ranks)
void resize(const label len)
Adjust allocated size of list.
UPstream::rangeType procRangeType
For addressing a range of processors (an int range)
fileName path() const
The path for the case = rootPath/caseName.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
static int myProcNo(label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler()
static int & msgType() noexcept
Message tag of standard messages.
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 T listScatterValues(const UList< T > &allValues, const int communicator=UPstream::worldComm, const int tag=UPstream::msgType())
Scatter individual values from list locations.
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
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?
An encapsulation of filesystem-related operations.
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...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
void masterMeshInstance(const IOobject &io, fileName &facesInstance, fileName &pointsInstance)
Determine master faces instance.
virtual fileName filePath(const bool checkGlobal, const IOobject &, const word &typeName, const bool search=true) const =0
Search for an object.
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
Miscellaneous file handling for meshes.
static bool isCollatedType(const word &objectType)
True if object type is a known collated type.
bitSet haveProcessorFile(const word &name, const fileName &instance, const fileName &local, const Time &runTime, const bool verbose=true)
Check for availability of specified file (on all ranks)
void allGather(Type *allData, int count, MPI_Datatype datatype, const int communicator, UPstream::Request *req=nullptr)
static label getNumBlocks(Istream &is, const label maxNumBlocks=-1)
Extract number of decomposedBlockData block entries, optionally with an upper limit. The input stream should be in a rewound state (or only have read the header) before calling.
static label nProcs(label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run. ...
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
static label detectProcessorPath(const fileName &fName, procRangeType &group, label *numProcs=nullptr)
Detect processor number from 'path/processorDDD/abc' or 'path/processorsNN/abc', 'path/processorsNN_0...
label comm() const noexcept
Communicator to use.
static List< T > listGatherValues(const T &localValue, const int communicator=UPstream::worldComm, const int tag=UPstream::msgType())
Gather individual values into list locations.
messageStream Info
Information stream (stdout output on master, null elsewhere)
void removeProcAddressing(const faMesh &mesh)
Remove procAddressing.
static bool master(label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
List< label > labelList
A List of labels.
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.