ENH: dictionary: allow transfer of empty dictionary

This commit is contained in:
mattijs
2012-07-30 15:57:15 +01:00
parent d405852e22
commit 1945632da9
3 changed files with 13 additions and 16 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -102,7 +102,7 @@ void Foam::IOdictionary::readFile(const bool masterOnly)
myComm.above(),
0,
Pstream::msgType(),
IOstream::ASCII
IOstream::BINARY
);
IOdictionary::readData(fromAbove);
}
@ -121,7 +121,7 @@ void Foam::IOdictionary::readFile(const bool masterOnly)
myComm.below()[belowI],
0,
Pstream::msgType(),
IOstream::ASCII
IOstream::BINARY
);
IOdictionary::writeData(toBelow);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -80,6 +80,12 @@ Foam::autoPtr<Foam::dictionary> Foam::dictionary::New(Istream& is)
bool Foam::dictionary::read(Istream& is, const bool keepHeader)
{
// Check for empty dictionary
if (is.eof())
{
return true;
}
if (!is.good())
{
FatalIOErrorIn("dictionary::read(Istream&, bool)", is)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -107,12 +107,7 @@ Foam::UIPstream::UIPstream
if (!messageSize_)
{
FatalErrorIn
(
"UIPstream::UIPstream(const commsTypes, const int, "
"DynamicList<char>&, streamFormat, versionNumber)"
) << "read failed"
<< Foam::abort(FatalError);
setEof();
}
}
}
@ -199,11 +194,7 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
if (!messageSize_)
{
FatalErrorIn
(
"UIPstream::UIPstream(const int, PstreamBuffers&)"
) << "read failed"
<< Foam::abort(FatalError);
setEof();
}
}
}