fileOperations: Added more diagnostics

Patch contributed by Mattijs Janssens
This commit is contained in:
Henry Weller
2018-11-30 15:13:53 +00:00
parent b786f41498
commit 6ec5e56968
3 changed files with 35 additions and 3 deletions

View File

@ -402,7 +402,7 @@ Foam::fileOperations::collatedFileOperation::collatedFileOperation
Foam::fileOperations::collatedFileOperation::~collatedFileOperation()
{
if (myComm_ != -1)
if (myComm_ != -1 && myComm_ != UPstream::worldComm)
{
UPstream::freeCommunicator(myComm_);
}

View File

@ -579,6 +579,13 @@ Foam::fileOperations::masterUncollatedFileOperation::read
{
if (procValid[0])
{
if (filePaths[0].empty())
{
FatalIOErrorInFunction(filePaths[0])
<< "cannot find file " << io.objectPath()
<< exit(FatalIOError);
}
DynamicList<label> validProcs(Pstream::nProcs(comm));
for
(
@ -683,7 +690,7 @@ Foam::fileOperations::masterUncollatedFileOperation::read
<< " Done reading " << buf.size() << " bytes" << endl;
}
const fileName& fName = filePaths[Pstream::myProcNo(comm)];
isPtr.reset(new IStringStream(fName, buf));
isPtr.reset(new IStringStream(fName, buf, IOstream::BINARY));
if (!io.readHeader(isPtr()))
{
@ -2446,7 +2453,10 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
// Note: IPstream is not an IStream so use a IStringStream to
// convert the buffer. Note that we construct with a string
// so it holds a copy of the buffer.
return autoPtr<ISstream>(new IStringStream(filePath, buf));
return autoPtr<ISstream>
(
new IStringStream(filePath, buf, IOstream::BINARY)
);
}
}
else

View File

@ -471,6 +471,12 @@ bool Foam::fileOperations::uncollatedFileOperation::readHeader
const word& typeName
) const
{
if (debug)
{
Pout<< "uncollatedFileOperation::readHeader :"
<< " fName:" << fName
<< " typeName:" << typeName << endl;
}
if (fName.empty())
{
if (IOobject::debug)
@ -498,6 +504,14 @@ bool Foam::fileOperations::uncollatedFileOperation::readHeader
ok = decomposedBlockData::readMasterHeader(io, isPtr());
}
if (debug)
{
Pout<< "uncollatedFileOperation::readHeader :"
<< " for fName:" << fName
<< " ok:" << ok
<< " headerClassName:" << io.headerClassName() << endl;
}
return ok;
}
@ -562,6 +576,7 @@ Foam::fileOperations::uncollatedFileOperation::readStream
FatalIOErrorInFunction(isPtr())
<< "could not detect processor number"
<< " from objectPath:" << io.objectPath()
<< " fName:" << fName
<< exit(FatalIOError);
}
@ -624,6 +639,13 @@ bool Foam::fileOperations::uncollatedFileOperation::read
// Restore flags
io.globalObject() = oldGlobal;
regIOobject::masterOnlyReading = oldFlag;
if (debug)
{
Pout<< "uncollatedFileOperation::read :"
<< " Done reading object " << io.objectPath()
<< " from file " << endl;
}
}
if (masterOnly && Pstream::parRun())