STYLE: readOnProc/writeOnProc instead of 'valid' for IO

This commit is contained in:
Mark Olesen
2023-03-14 17:39:28 +01:00
parent 188e61af16
commit 475ed5cc32
94 changed files with 415 additions and 383 deletions

View File

@ -46,35 +46,39 @@ using namespace Foam;
template<class Type> template<class Type>
void doWrite(const IOobject& io, const label sz) void doWrite(const IOobject& io, const label sz)
{ {
const bool writeOnProc = (sz > 0);
IOField<Type> fld(io, sz); IOField<Type> fld(io, sz);
forAll(fld, i) forAll(fld, i)
{ {
fld[i] = i + 1000.25 + (0.25 * i); fld[i] = i + 1000.25 + (0.25 * i);
} }
Pout<< "writing:" << fld << endl; Pout<< "writing:" << fld << endl;
fld.write(sz > 0); fld.write(writeOnProc);
} }
template<> template<>
void doWrite<bool>(const IOobject& io, const label sz) void doWrite<bool>(const IOobject& io, const label sz)
{ {
const bool writeOnProc = (sz > 0);
IOField<bool> fld(io, sz); IOField<bool> fld(io, sz);
forAll(fld, i) forAll(fld, i)
{ {
fld[i] = i % 2; fld[i] = i % 2;
} }
Pout<< "writing:" << fld << endl; Pout<< "writing:" << fld << endl;
fld.write(sz > 0); fld.write(writeOnProc);
} }
template<class Type> template<class Type>
void doRead(const IOobject& io, const label sz) void doRead(const IOobject& io, const label sz)
{ {
bool valid = (sz > 0); const bool readOnProc = (sz > 0);
Pout<< " valid:" << valid << endl; Pout<< " readOnProc:" << readOnProc << endl;
IOField<Type> fld(io, valid); IOField<Type> fld(io, readOnProc);
Pout<< " wanted:" << sz << " actually read:" << fld.size() << endl; Pout<< " wanted:" << sz << " actually read:" << fld.size() << endl;
if (fld.size() != sz) if (fld.size() != sz)

View File

@ -203,7 +203,7 @@ bool writeOptionalMeshObject
const word& name, const word& name,
const fileName& meshDir, const fileName& meshDir,
Time& runTime, Time& runTime,
const bool valid const bool writeOnProc
) )
{ {
IOobject io IOobject io
@ -218,8 +218,7 @@ bool writeOptionalMeshObject
); );
bool writeOk = false; bool writeOk = false;
const bool haveFile = io.typeHeaderOk<IOField<label>>(false);
bool haveFile = io.typeHeaderOk<IOField<label>>(false);
// Make sure all know if there is a valid class name // Make sure all know if there is a valid class name
wordList classNames(1, io.headerClassName()); wordList classNames(1, io.headerClassName());
@ -230,10 +229,10 @@ bool writeOptionalMeshObject
{ {
Info<< " Reading " << classNames[0] Info<< " Reading " << classNames[0]
<< " : " << name << endl; << " : " << name << endl;
T meshObject(io, valid && haveFile); T meshObject(io, writeOnProc && haveFile);
Info<< " Writing " << name << endl; Info<< " Writing " << name << endl;
writeOk = meshObject.regIOobject::write(valid && haveFile); writeOk = meshObject.regIOobject::write(writeOnProc && haveFile);
} }
return writeOk; return writeOk;

View File

@ -94,7 +94,7 @@ public:
{} {}
//- Disable writing objects //- Disable writing objects
virtual bool writeObject(IOstreamOption, const bool valid) const virtual bool writeObject(IOstreamOption, const bool writeOnProc) const
{ {
return true; return true;
} }

View File

@ -32,11 +32,11 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class T, class BaseType> template<class T, class BaseType>
void Foam::CompactIOField<T, BaseType>::readFromStream(const bool valid) void Foam::CompactIOField<T, BaseType>::readFromStream(const bool readOnProc)
{ {
Istream& is = readStream(word::null, valid); Istream& is = readStream(word::null, readOnProc);
if (valid) if (readOnProc)
{ {
if (headerClassName() == IOField<T>::typeName) if (headerClassName() == IOField<T>::typeName)
{ {
@ -93,19 +93,19 @@ template<class T, class BaseType>
Foam::CompactIOField<T, BaseType>::CompactIOField Foam::CompactIOField<T, BaseType>::CompactIOField
( (
const IOobject& io, const IOobject& io,
const bool valid const bool readOnProc
) )
: :
regIOobject(io) regIOobject(io)
{ {
if (readOpt() == IOobject::MUST_READ) if (readOpt() == IOobject::MUST_READ)
{ {
readFromStream(valid); readFromStream(readOnProc);
} }
else if (isReadOptional()) else if (isReadOptional())
{ {
bool haveFile = headerOk(); const bool haveFile = headerOk();
readFromStream(valid && haveFile); readFromStream(readOnProc && haveFile);
} }
} }
@ -176,7 +176,7 @@ template<class T, class BaseType>
bool Foam::CompactIOField<T, BaseType>::writeObject bool Foam::CompactIOField<T, BaseType>::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
if (streamOpt.format() == IOstreamOption::ASCII) if (streamOpt.format() == IOstreamOption::ASCII)
@ -186,7 +186,7 @@ bool Foam::CompactIOField<T, BaseType>::writeObject
const_cast<word&>(typeName) = IOField<T>::typeName; const_cast<word&>(typeName) = IOField<T>::typeName;
bool good = regIOobject::writeObject(streamOpt, valid); bool good = regIOobject::writeObject(streamOpt, writeOnProc);
// Restore type // Restore type
const_cast<word&>(typeName) = oldTypeName; const_cast<word&>(typeName) = oldTypeName;
@ -194,7 +194,7 @@ bool Foam::CompactIOField<T, BaseType>::writeObject
return good; return good;
} }
return regIOobject::writeObject(streamOpt, valid); return regIOobject::writeObject(streamOpt, writeOnProc);
} }

View File

@ -76,8 +76,8 @@ class CompactIOField
{ {
// Private Member Functions // Private Member Functions
//- Read according to header type //- Read according to header type, with optional 'on-proc' value
void readFromStream(const bool valid = true); void readFromStream(const bool readOnProc = true);
//- Read if IOobject flags set. Return true if read. //- Read if IOobject flags set. Return true if read.
// Reads according to the header type // Reads according to the header type
@ -99,7 +99,7 @@ public:
explicit CompactIOField(const IOobject& io); explicit CompactIOField(const IOobject& io);
//- Construct from IOobject, with local processor conditional reading //- Construct from IOobject, with local processor conditional reading
CompactIOField(const IOobject& io, const bool valid); CompactIOField(const IOobject& io, const bool readOnProc);
//- Construct from IOobject and zero size (if not read) //- Construct from IOobject and zero size (if not read)
CompactIOField(const IOobject& io, Foam::zero); CompactIOField(const IOobject& io, Foam::zero);
@ -124,7 +124,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
virtual bool writeData(Ostream& os) const; virtual bool writeData(Ostream& os) const;

View File

@ -169,7 +169,7 @@ template<class T, class BaseType>
bool Foam::CompactIOList<T, BaseType>::writeObject bool Foam::CompactIOList<T, BaseType>::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
if if
@ -193,7 +193,7 @@ bool Foam::CompactIOList<T, BaseType>::writeObject
const_cast<word&>(typeName) = IOList<T>::typeName; const_cast<word&>(typeName) = IOList<T>::typeName;
bool good = regIOobject::writeObject(streamOpt, valid); bool good = regIOobject::writeObject(streamOpt, writeOnProc);
// Change type back // Change type back
const_cast<word&>(typeName) = oldTypeName; const_cast<word&>(typeName) = oldTypeName;
@ -201,7 +201,7 @@ bool Foam::CompactIOList<T, BaseType>::writeObject
return good; return good;
} }
return regIOobject::writeObject(streamOpt, valid); return regIOobject::writeObject(streamOpt, writeOnProc);
} }

View File

@ -127,7 +127,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
virtual bool writeData(Ostream&) const; virtual bool writeData(Ostream&) const;

View File

@ -30,13 +30,25 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::IOField<Type>::readFromStream(const bool readOnProc)
{
Istream& is = readStream(typeName, readOnProc);
if (readOnProc)
{
is >> *this;
}
close();
}
template<class Type> template<class Type>
bool Foam::IOField<Type>::readContents() bool Foam::IOField<Type>::readContents()
{ {
if (isReadRequired() || (isReadOptional() && headerOk())) if (isReadRequired() || (isReadOptional() && headerOk()))
{ {
readStream(typeName) >> *this; readFromStream();
close();
return true; return true;
} }
@ -59,7 +71,7 @@ Foam::IOField<Type>::IOField(const IOobject& io)
template<class Type> template<class Type>
Foam::IOField<Type>::IOField(const IOobject& io, const bool valid) Foam::IOField<Type>::IOField(const IOobject& io, const bool readOnProc)
: :
regIOobject(io) regIOobject(io)
{ {
@ -68,25 +80,12 @@ Foam::IOField<Type>::IOField(const IOobject& io, const bool valid)
if (isReadRequired()) if (isReadRequired())
{ {
Istream& is = readStream(typeName, valid); readFromStream(readOnProc);
if (valid)
{
is >> *this;
}
close();
} }
else if (isReadOptional()) else if (isReadOptional())
{ {
bool haveFile = headerOk(); const bool haveFile = headerOk();
readFromStream(readOnProc && haveFile);
Istream& is = readStream(typeName, haveFile && valid);
if (valid && haveFile)
{
is >> *this;
}
close();
} }
} }

View File

@ -59,6 +59,9 @@ class IOField
{ {
// Private Member Functions // Private Member Functions
//- Read with optional 'on-proc' value
void readFromStream(const bool readOnProc = true);
//- Read if IOobject flags set. Return true if read. //- Read if IOobject flags set. Return true if read.
bool readContents(); bool readContents();
@ -80,7 +83,7 @@ public:
explicit IOField(const IOobject& io); explicit IOField(const IOobject& io);
//- Construct from IOobject, with local processor conditional reading //- Construct from IOobject, with local processor conditional reading
IOField(const IOobject& io, const bool valid); IOField(const IOobject& io, const bool readOnProc);
//- Construct from IOobject and zero size (if not read) //- Construct from IOobject and zero size (if not read)
IOField(const IOobject& io, Foam::zero); IOField(const IOobject& io, Foam::zero);

View File

@ -1002,7 +1002,7 @@ bool Foam::decomposedBlockData::writeData(Ostream& os) const
bool Foam::decomposedBlockData::writeObject bool Foam::decomposedBlockData::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
autoPtr<OSstream> osPtr; autoPtr<OSstream> osPtr;

View File

@ -188,7 +188,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;

View File

@ -101,7 +101,7 @@ void Foam::masterOFstream::commit()
if (uniform) if (uniform)
{ {
if (Pstream::master() && valid_) if (Pstream::master() && writeOnProc_)
{ {
checkWrite(pathName_, this->str()); checkWrite(pathName_, this->str());
} }
@ -116,7 +116,7 @@ void Foam::masterOFstream::commit()
// Send my (valid) buffer to master // Send my (valid) buffer to master
if (!Pstream::master()) if (!Pstream::master())
{ {
if (valid_) if (writeOnProc_)
{ {
string s(this->str()); string s(this->str());
@ -131,7 +131,7 @@ void Foam::masterOFstream::commit()
if (Pstream::master()) if (Pstream::master())
{ {
// Write (valid) master data // Write (valid) master data
if (valid_) if (writeOnProc_)
{ {
checkWrite(filePaths[Pstream::masterNo()], this->str()); checkWrite(filePaths[Pstream::masterNo()], this->str());
} }
@ -173,7 +173,7 @@ Foam::masterOFstream::masterOFstream
const fileName& pathName, const fileName& pathName,
IOstreamOption streamOpt, IOstreamOption streamOpt,
IOstreamOption::appendType append, IOstreamOption::appendType append,
const bool valid const bool writeOnProc
) )
: :
OStringStream(streamOpt), OStringStream(streamOpt),
@ -181,7 +181,7 @@ Foam::masterOFstream::masterOFstream
atomic_(atomic), atomic_(atomic),
compression_(streamOpt.compression()), compression_(streamOpt.compression()),
append_(append), append_(append),
valid_(valid) writeOnProc_(writeOnProc)
{} {}

View File

@ -68,7 +68,7 @@ class masterOFstream
const IOstreamOption::appendType append_; const IOstreamOption::appendType append_;
//- Should file be written (on this processor) //- Should file be written (on this processor)
const bool valid_; const bool writeOnProc_;
// Private Member Functions // Private Member Functions
@ -100,7 +100,7 @@ public:
const fileName& pathname, const fileName& pathname,
IOstreamOption streamOpt = IOstreamOption(), IOstreamOption streamOpt = IOstreamOption(),
IOstreamOption::appendType append = IOstreamOption::NON_APPEND, IOstreamOption::appendType append = IOstreamOption::NON_APPEND,
const bool valid = true const bool writeOnProc = true
); );
//- Construct (with worldComm) //- Construct (with worldComm)
@ -110,7 +110,7 @@ public:
const fileName& pathname, const fileName& pathname,
IOstreamOption streamOpt = IOstreamOption(), IOstreamOption streamOpt = IOstreamOption(),
IOstreamOption::appendType append = IOstreamOption::NON_APPEND, IOstreamOption::appendType append = IOstreamOption::NON_APPEND,
const bool valid = true const bool writeOnProc = true
) )
: :
masterOFstream masterOFstream
@ -119,7 +119,7 @@ public:
pathname, pathname,
streamOpt, streamOpt,
append, append,
valid writeOnProc
) )
{} {}

View File

@ -465,7 +465,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
//- Write the objects immediately (not at end of iteration) //- Write the objects immediately (not at end of iteration)

View File

@ -547,7 +547,7 @@ bool Foam::Time::writeTimeDict() const
bool Foam::Time::writeObject bool Foam::Time::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
if (writeTime()) if (writeTime())
@ -556,7 +556,7 @@ bool Foam::Time::writeObject
if (writeOK) if (writeOK)
{ {
writeOK = objectRegistry::writeObject(streamOpt, valid); writeOK = objectRegistry::writeObject(streamOpt, writeOnProc);
} }
if (writeOK) if (writeOK)

View File

@ -500,7 +500,7 @@ bool Foam::objectRegistry::readIfModified()
bool Foam::objectRegistry::writeObject bool Foam::objectRegistry::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
bool ok = true; bool ok = true;
@ -521,7 +521,7 @@ bool Foam::objectRegistry::writeObject
if (iter.val()->writeOpt() != IOobjectOption::NO_WRITE) if (iter.val()->writeOpt() != IOobjectOption::NO_WRITE)
{ {
ok = iter.val()->writeObject(streamOpt, valid) && ok; ok = iter.val()->writeObject(streamOpt, writeOnProc) && ok;
} }
} }

View File

@ -585,7 +585,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;

View File

@ -114,7 +114,7 @@ private:
// Private Member Functions // Private Member Functions
//- Construct object stream, read header if not already constructed //- Construct object stream, read header if not already constructed
void readStream(const bool valid); void readStream(const bool readOnProc);
//- No copy assignment //- No copy assignment
void operator=(const regIOobject&) = delete; void operator=(const regIOobject&) = delete;
@ -306,7 +306,7 @@ public:
bool headerOk(); bool headerOk();
//- Return Istream and check object type against that given //- Return Istream and check object type against that given
Istream& readStream(const word&, const bool valid = true); Istream& readStream(const word&, const bool readOnProc = true);
//- Close Istream //- Close Istream
void close(); void close();
@ -347,11 +347,11 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
//- Write using setting from DB //- Write using setting from DB
virtual bool write(const bool valid = true) const; virtual bool write(const bool writeOnProc = true) const;
// Other // Other
@ -378,10 +378,10 @@ public:
IOstreamOption::streamFormat fmt, IOstreamOption::streamFormat fmt,
IOstreamOption::versionNumber ver, IOstreamOption::versionNumber ver,
IOstreamOption::compressionType cmp, IOstreamOption::compressionType cmp,
const bool valid const bool writeOnProc
) const ) const
{ {
return writeObject(IOstreamOption(fmt, ver, cmp), valid); return writeObject(IOstreamOption(fmt, ver, cmp), writeOnProc);
} }
}; };

View File

@ -83,7 +83,7 @@ bool Foam::regIOobject::readHeaderOk
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::regIOobject::readStream(const bool valid) void Foam::regIOobject::readStream(const bool readOnProc)
{ {
if (readOpt() == IOobject::NO_READ) if (readOpt() == IOobject::NO_READ)
{ {
@ -117,7 +117,7 @@ void Foam::regIOobject::readStream(const bool valid)
} }
} }
isPtr_ = fileHandler().readStream(*this, objPath, type(), valid); isPtr_ = fileHandler().readStream(*this, objPath, type(), readOnProc);
} }
} }
@ -125,7 +125,7 @@ void Foam::regIOobject::readStream(const bool valid)
Foam::Istream& Foam::regIOobject::readStream Foam::Istream& Foam::regIOobject::readStream
( (
const word& expectName, const word& expectName,
const bool valid const bool readOnProc
) )
{ {
if (IFstream::debug) if (IFstream::debug)
@ -140,14 +140,14 @@ Foam::Istream& Foam::regIOobject::readStream
// Construct IFstream if not already constructed // Construct IFstream if not already constructed
if (!isPtr_) if (!isPtr_)
{ {
readStream(valid); readStream(readOnProc);
// Check the className of the regIOobject // Check the className of the regIOobject
// dictionary is an allowable name in case the actual class // dictionary is an allowable name in case the actual class
// instantiated is a dictionary // instantiated is a dictionary
if if
( (
valid readOnProc
&& expectName.size() && expectName.size()
&& headerClassName() != expectName && headerClassName() != expectName
&& headerClassName() != "dictionary" && headerClassName() != "dictionary"

View File

@ -35,7 +35,7 @@ License
bool Foam::regIOobject::writeObject bool Foam::regIOobject::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
if (!good()) if (!good())
@ -107,7 +107,7 @@ bool Foam::regIOobject::writeObject
bool osGood = false; bool osGood = false;
if (!masterOnly || Pstream::master()) if (!masterOnly || Pstream::master())
{ {
osGood = fileHandler().writeObject(*this, streamOpt, valid); osGood = fileHandler().writeObject(*this, streamOpt, writeOnProc);
} }
else else
{ {
@ -131,12 +131,12 @@ bool Foam::regIOobject::writeObject
} }
bool Foam::regIOobject::write(const bool valid) const bool Foam::regIOobject::write(const bool writeOnProc) const
{ {
return writeObject return writeObject
( (
IOstreamOption(time().writeFormat(), time().writeCompression()), IOstreamOption(time().writeFormat(), time().writeCompression()),
valid writeOnProc
); );
} }

View File

@ -364,7 +364,7 @@ bool Foam::fileOperations::collatedFileOperation::writeObject
( (
const regIOobject& io, const regIOobject& io,
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
const Time& tm = io.time(); const Time& tm = io.time();
@ -392,7 +392,7 @@ bool Foam::fileOperations::collatedFileOperation::writeObject
pathName, pathName,
streamOpt, streamOpt,
IOstreamOption::NON_APPEND, IOstreamOption::NON_APPEND,
valid writeOnProc
); );
// If any of these fail, return // If any of these fail, return
@ -436,7 +436,7 @@ bool Foam::fileOperations::collatedFileOperation::writeObject
pathName, pathName,
streamOpt, streamOpt,
IOstreamOption::NON_APPEND, IOstreamOption::NON_APPEND,
valid writeOnProc
); );
// If any of these fail, return // If any of these fail, return

View File

@ -162,7 +162,7 @@ public:
( (
const regIOobject&, const regIOobject&,
IOstreamOption streamOpt = IOstreamOption(), IOstreamOption streamOpt = IOstreamOption(),
const bool valid = true const bool writeOnProc = true
) const; ) const;
// Other // Other

View File

@ -801,10 +801,10 @@ bool Foam::fileOperation::writeObject
( (
const regIOobject& io, const regIOobject& io,
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
if (valid) if (writeOnProc)
{ {
const fileName pathName(io.objectPath()); const fileName pathName(io.objectPath());

View File

@ -433,7 +433,7 @@ public:
regIOobject&, regIOobject&,
const fileName&, const fileName&,
const word& typeName, const word& typeName,
const bool valid = true const bool readOnProc = true
) const = 0; ) const = 0;
//- Top-level read //- Top-level read
@ -447,14 +447,14 @@ public:
//- Writes a regIOobject (so header, contents and divider). //- Writes a regIOobject (so header, contents and divider).
// Returns success state. Default action is to write to // Returns success state. Default action is to write to
// the objectPath using writeData. If !valid the // the objectPath using writeData. If !writeOnProc the
// file does not need to be written (this is used e.g. to // file does not need to be written (this is used e.g. to
// suppress empty local lagrangian data) // suppress empty local lagrangian data)
virtual bool writeObject virtual bool writeObject
( (
const regIOobject& io, const regIOobject& io,
IOstreamOption streamOpt = IOstreamOption(), IOstreamOption streamOpt = IOstreamOption(),
const bool valid = true const bool writeOnProc = true
) const; ) const;
@ -477,7 +477,7 @@ public:
( (
const fileName& pathname, const fileName& pathname,
IOstreamOption streamOpt = IOstreamOption(), IOstreamOption streamOpt = IOstreamOption(),
const bool valid = true const bool writeOnProc = true
) const = 0; ) const = 0;
//- Generate an OSstream that writes a file //- Generate an OSstream that writes a file
@ -486,7 +486,7 @@ public:
IOstreamOption::atomicType atomic, IOstreamOption::atomicType atomic,
const fileName& pathname, const fileName& pathname,
IOstreamOption streamOpt = IOstreamOption(), IOstreamOption streamOpt = IOstreamOption(),
const bool valid = true const bool writeOnProc = true
) const = 0; ) const = 0;

View File

@ -1835,7 +1835,7 @@ Foam::fileOperations::masterUncollatedFileOperation::readStream
regIOobject& io, regIOobject& io,
const fileName& fName, const fileName& fName,
const word& typeName, const word& typeName,
const bool valid const bool readOnProc
) const ) const
{ {
if (debug) if (debug)
@ -1843,7 +1843,7 @@ Foam::fileOperations::masterUncollatedFileOperation::readStream
Pout<< "masterUncollatedFileOperation::readStream :" Pout<< "masterUncollatedFileOperation::readStream :"
<< " object : " << io.name() << " object : " << io.name()
<< " global : " << io.global() << " global : " << io.global()
<< " fName : " << fName << " valid:" << valid << endl; << " fName : " << fName << " readOnProc:" << readOnProc << endl;
} }
@ -2027,10 +2027,13 @@ Foam::fileOperations::masterUncollatedFileOperation::readStream
filePaths[Pstream::myProcNo()] = fName; filePaths[Pstream::myProcNo()] = fName;
Pstream::gatherList(filePaths); Pstream::gatherList(filePaths);
boolList procValid(UPstream::listGatherValues<bool>(valid)); boolList procValid
(
UPstream::listGatherValues<bool>(readOnProc)
);
// NB: local proc validity information required on sub-ranks too! // NB: local proc validity information required on sub-ranks too!
procValid.resize(Pstream::nProcs()); procValid.resize(Pstream::nProcs());
procValid[Pstream::myProcNo()] = valid; procValid[Pstream::myProcNo()] = readOnProc;
return read(io, Pstream::worldComm, true, filePaths, procValid); return read(io, Pstream::worldComm, true, filePaths, procValid);
} }
@ -2041,10 +2044,13 @@ Foam::fileOperations::masterUncollatedFileOperation::readStream
filePaths[Pstream::myProcNo(comm_)] = fName; filePaths[Pstream::myProcNo(comm_)] = fName;
Pstream::gatherList(filePaths, Pstream::msgType(), comm_); Pstream::gatherList(filePaths, Pstream::msgType(), comm_);
boolList procValid(UPstream::listGatherValues<bool>(valid, comm_)); boolList procValid
(
UPstream::listGatherValues<bool>(readOnProc, comm_)
);
// NB: local proc validity information required on sub-ranks too! // NB: local proc validity information required on sub-ranks too!
procValid.resize(Pstream::nProcs(comm_)); procValid.resize(Pstream::nProcs(comm_));
procValid[Pstream::myProcNo(comm_)] = valid; procValid[Pstream::myProcNo(comm_)] = readOnProc;
// Uniform in local comm // Uniform in local comm
const bool uniform = uniformFile(filePaths); const bool uniform = uniformFile(filePaths);
@ -2139,7 +2145,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::writeObject
( (
const regIOobject& io, const regIOobject& io,
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
fileName pathName(io.objectPath()); fileName pathName(io.objectPath());
@ -2147,7 +2153,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::writeObject
if (debug) if (debug)
{ {
Pout<< "masterUncollatedFileOperation::writeObject :" Pout<< "masterUncollatedFileOperation::writeObject :"
<< " io:" << pathName << " valid:" << valid << endl; << " io:" << pathName << " writeOnProc:" << writeOnProc << endl;
} }
// Make sure to pick up any new times // Make sure to pick up any new times
@ -2156,7 +2162,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::writeObject
// Update meta-data for current state // Update meta-data for current state
const_cast<regIOobject&>(io).updateMetaData(); const_cast<regIOobject&>(io).updateMetaData();
autoPtr<OSstream> osPtr(NewOFstream(pathName, streamOpt, valid)); autoPtr<OSstream> osPtr(NewOFstream(pathName, streamOpt, writeOnProc));
OSstream& os = *osPtr; OSstream& os = *osPtr;
// If any of these fail, return (leave error handling to Ostream class) // If any of these fail, return (leave error handling to Ostream class)
@ -2406,7 +2412,7 @@ Foam::fileOperations::masterUncollatedFileOperation::NewOFstream
( (
const fileName& pathName, const fileName& pathName,
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
return autoPtr<OSstream> return autoPtr<OSstream>
@ -2416,7 +2422,7 @@ Foam::fileOperations::masterUncollatedFileOperation::NewOFstream
pathName, pathName,
streamOpt, streamOpt,
IOstreamOption::NON_APPEND, IOstreamOption::NON_APPEND,
valid writeOnProc
) )
); );
} }
@ -2428,7 +2434,7 @@ Foam::fileOperations::masterUncollatedFileOperation::NewOFstream
IOstreamOption::atomicType atomic, IOstreamOption::atomicType atomic,
const fileName& pathName, const fileName& pathName,
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
return autoPtr<OSstream> return autoPtr<OSstream>
@ -2439,7 +2445,7 @@ Foam::fileOperations::masterUncollatedFileOperation::NewOFstream
pathName, pathName,
streamOpt, streamOpt,
IOstreamOption::NON_APPEND, IOstreamOption::NON_APPEND,
valid writeOnProc
) )
); );
} }

View File

@ -662,13 +662,13 @@ public:
) const; ) const;
//- Reads header for regIOobject and returns an ISstream //- Reads header for regIOobject and returns an ISstream
// to read the contents. //- to read the contents.
virtual autoPtr<ISstream> readStream virtual autoPtr<ISstream> readStream
( (
regIOobject&, regIOobject&,
const fileName&, const fileName&,
const word& typeName, const word& typeName,
const bool valid = true const bool readOnProc = true
) const; ) const;
//- Top-level read //- Top-level read
@ -686,7 +686,7 @@ public:
( (
const regIOobject& io, const regIOobject& io,
IOstreamOption streamOpt = IOstreamOption(), IOstreamOption streamOpt = IOstreamOption(),
const bool valid = true const bool writeOnProc = true
) const; ) const;
//- Generate an ISstream that reads a file //- Generate an ISstream that reads a file
@ -697,7 +697,7 @@ public:
( (
const fileName& pathname, const fileName& pathname,
IOstreamOption streamOpt = IOstreamOption(), IOstreamOption streamOpt = IOstreamOption(),
const bool valid = true const bool writeOnProc = true
) const; ) const;
//- Generate an OSstream that writes a file //- Generate an OSstream that writes a file
@ -706,7 +706,7 @@ public:
IOstreamOption::atomicType atomic, IOstreamOption::atomicType atomic,
const fileName& pathname, const fileName& pathname,
IOstreamOption streamOpt = IOstreamOption(), IOstreamOption streamOpt = IOstreamOption(),
const bool valid = true const bool writeOnProc = true
) const; ) const;

View File

@ -548,10 +548,10 @@ Foam::fileOperations::uncollatedFileOperation::readStream
regIOobject& io, regIOobject& io,
const fileName& fName, const fileName& fName,
const word& typeName, const word& typeName,
const bool valid const bool writeOnProc
) const ) const
{ {
if (!valid) if (!writeOnProc)
{ {
return autoPtr<ISstream>(new dummyISstream()); return autoPtr<ISstream>(new dummyISstream());
} }
@ -718,7 +718,7 @@ Foam::fileOperations::uncollatedFileOperation::NewOFstream
( (
const fileName& pathName, const fileName& pathName,
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
return autoPtr<OSstream>(new OFstream(pathName, streamOpt)); return autoPtr<OSstream>(new OFstream(pathName, streamOpt));
@ -731,7 +731,7 @@ Foam::fileOperations::uncollatedFileOperation::NewOFstream
IOstreamOption::atomicType atomic, IOstreamOption::atomicType atomic,
const fileName& pathName, const fileName& pathName,
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
return autoPtr<OSstream>(new OFstream(atomic, pathName, streamOpt)); return autoPtr<OSstream>(new OFstream(atomic, pathName, streamOpt));

View File

@ -291,7 +291,7 @@ public:
( (
const fileName& pathname, const fileName& pathname,
IOstreamOption streamOpt = IOstreamOption(), IOstreamOption streamOpt = IOstreamOption(),
const bool valid = true const bool writeOnProc = true
) const; ) const;
//- Generate an OSstream that writes a file //- Generate an OSstream that writes a file
@ -300,7 +300,7 @@ public:
IOstreamOption::atomicType, IOstreamOption::atomicType,
const fileName& pathname, const fileName& pathname,
IOstreamOption streamOpt = IOstreamOption(), IOstreamOption streamOpt = IOstreamOption(),
const bool valid = true const bool writeOnProc = true
) const; ) const;
}; };

View File

@ -386,7 +386,7 @@ bool Foam::profiling::writeData(Ostream& os) const
bool Foam::profiling::writeObject bool Foam::profiling::writeObject
( (
IOstreamOption, IOstreamOption,
const bool valid const bool writeOnProc
) const ) const
{ {
return return

View File

@ -260,7 +260,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption /*ignore*/, IOstreamOption /*ignore*/,
const bool valid const bool writeOnProc
) const; ) const;
}; };

View File

@ -1246,11 +1246,11 @@ bool Foam::polyBoundaryMesh::writeData(Ostream& os) const
bool Foam::polyBoundaryMesh::writeObject bool Foam::polyBoundaryMesh::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
streamOpt.compression(IOstreamOption::UNCOMPRESSED); streamOpt.compression(IOstreamOption::UNCOMPRESSED);
return regIOobject::writeObject(streamOpt, valid); return regIOobject::writeObject(streamOpt, writeOnProc);
} }

View File

@ -315,7 +315,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;

View File

@ -46,11 +46,11 @@ static const char* headerTypeCompat = "IOPtrList<coordinateSystem>";
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::coordinateSystems::readFromStream(const bool valid) void Foam::coordinateSystems::readFromStream(const bool readOnProc)
{ {
Istream& is = readStream(word::null, valid); Istream& is = readStream(word::null, readOnProc);
if (valid) if (readOnProc)
{ {
if (headerClassName() == typeName) if (headerClassName() == typeName)
{ {
@ -308,14 +308,14 @@ bool Foam::coordinateSystems::writeData(Ostream& os) const
bool Foam::coordinateSystems::writeObject bool Foam::coordinateSystems::writeObject
( (
IOstreamOption, IOstreamOption,
const bool valid const bool writeOnProc
) const ) const
{ {
// Force ASCII, uncompressed // Force ASCII, uncompressed
return regIOobject::writeObject return regIOobject::writeObject
( (
IOstreamOption(IOstreamOption::ASCII), IOstreamOption(IOstreamOption::ASCII),
valid writeOnProc
); );
} }

View File

@ -84,7 +84,7 @@ class coordinateSystems
// Private Member Functions // Private Member Functions
//- Read "coordinateSystems" or older "IOPtrList<coordinateSystem>" //- Read "coordinateSystems" or older "IOPtrList<coordinateSystem>"
void readFromStream(const bool valid = true); void readFromStream(const bool readOnProc = true);
//- Read if IOobject flags set. Return true if read. //- Read if IOobject flags set. Return true if read.
bool readContents(); bool readContents();
@ -184,7 +184,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid = true const bool writeOnProc = true
) const; ) const;

View File

@ -1486,7 +1486,7 @@ bool Foam::dynamicRefineFvMesh::update()
bool Foam::dynamicRefineFvMesh::writeObject bool Foam::dynamicRefineFvMesh::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
// Force refinement data to go to the current time directory. // Force refinement data to go to the current time directory.
@ -1494,9 +1494,9 @@ bool Foam::dynamicRefineFvMesh::writeObject
bool writeOk = bool writeOk =
( (
//dynamicFvMesh::writeObject(streamOpt, valid) //dynamicFvMesh::writeObject(streamOpt, writeOnProc)
dynamicMotionSolverListFvMesh::writeObject(streamOpt, valid) dynamicMotionSolverListFvMesh::writeObject(streamOpt, writeOnProc)
&& meshCutter_.write(valid) && meshCutter_.write(writeOnProc)
); );
if (dumpLevel_) if (dumpLevel_)

View File

@ -280,7 +280,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
}; };

View File

@ -217,7 +217,7 @@ void Foam::motionSolver::updateMesh(const mapPolyMesh& mpm)
bool Foam::motionSolver::writeObject bool Foam::motionSolver::writeObject
( (
IOstreamOption, IOstreamOption,
const bool valid const bool writeOnProc
) const ) const
{ {
return true; return true;

View File

@ -174,7 +174,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
//- Read dynamicMeshDict dictionary //- Read dynamicMeshDict dictionary

View File

@ -5690,16 +5690,16 @@ void Foam::hexRef8::setUnrefinement
// Write refinement to polyMesh directory. // Write refinement to polyMesh directory.
bool Foam::hexRef8::write(const bool valid) const bool Foam::hexRef8::write(const bool writeOnProc) const
{ {
bool writeOk = bool writeOk =
cellLevel_.write(valid) cellLevel_.write(writeOnProc)
&& pointLevel_.write(valid) && pointLevel_.write(writeOnProc)
&& level0Edge_.write(valid); && level0Edge_.write(writeOnProc);
if (history_.active()) if (history_.active())
{ {
writeOk = writeOk && history_.write(valid); writeOk = writeOk && history_.write(writeOnProc);
} }
else else
{ {

View File

@ -588,7 +588,7 @@ public:
void setInstance(const fileName& inst); void setInstance(const fileName& inst);
//- Force writing refinement+history to polyMesh directory. //- Force writing refinement+history to polyMesh directory.
bool write(const bool valid = true) const; bool write(const bool writeOnProc = true) const;
//- Helper: remove all relevant files from mesh instance //- Helper: remove all relevant files from mesh instance
static void removeFiles(const polyMesh&); static void removeFiles(const polyMesh&);

View File

@ -909,14 +909,14 @@ bool Foam::faBoundaryMesh::writeData(Ostream& os) const
bool Foam::faBoundaryMesh::writeObject bool Foam::faBoundaryMesh::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
// Allow/disallow compression? // Allow/disallow compression?
// 1. keep readable // 1. keep readable
// 2. save some space // 2. save some space
// ??? streamOpt.compression(IOstreamOption::UNCOMPRESSED); // ??? streamOpt.compression(IOstreamOption::UNCOMPRESSED);
return regIOobject::writeObject(streamOpt, valid); return regIOobject::writeObject(streamOpt, writeOnProc);
} }

View File

@ -244,7 +244,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;

View File

@ -1044,7 +1044,7 @@ Foam::boolList& Foam::faMesh::correctPatchPointNormals() const
} }
bool Foam::faMesh::write(const bool valid) const bool Foam::faMesh::write(const bool writeOnProc) const
{ {
faceLabels_.write(); faceLabels_.write();
boundary_.write(); boundary_.write();

View File

@ -947,7 +947,7 @@ public:
//- Write mesh //- Write mesh
virtual bool write(const bool valid = true) const; virtual bool write(const bool writeOnProc = true) const;
// Member Operators // Member Operators

View File

@ -1048,13 +1048,13 @@ void Foam::fvMesh::updateMesh(const mapPolyMesh& mpm)
bool Foam::fvMesh::writeObject bool Foam::fvMesh::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
bool ok = true; bool ok = true;
if (phiPtr_) if (phiPtr_)
{ {
ok = phiPtr_->write(valid); ok = phiPtr_->write(writeOnProc);
// NOTE: The old old time mesh phi might be necessary for certain // NOTE: The old old time mesh phi might be necessary for certain
// solver smooth restart using second order time schemes. // solver smooth restart using second order time schemes.
//ok = phiPtr_->oldTime().write(); //ok = phiPtr_->oldTime().write();
@ -1062,16 +1062,16 @@ bool Foam::fvMesh::writeObject
if (V0Ptr_ && V0Ptr_->writeOpt() == IOobject::AUTO_WRITE) if (V0Ptr_ && V0Ptr_->writeOpt() == IOobject::AUTO_WRITE)
{ {
// For second order restarts we need to write V0 // For second order restarts we need to write V0
ok = V0Ptr_->write(valid); ok = V0Ptr_->write(writeOnProc);
} }
return ok && polyMesh::writeObject(streamOpt, valid); return ok && polyMesh::writeObject(streamOpt, writeOnProc);
} }
bool Foam::fvMesh::write(const bool valid) const bool Foam::fvMesh::write(const bool writeOnProc) const
{ {
return polyMesh::write(valid); return polyMesh::write(writeOnProc);
} }

View File

@ -508,11 +508,11 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
//- Write mesh using IO settings from time //- Write mesh using IO settings from time
virtual bool write(const bool valid = true) const; virtual bool write(const bool writeOnProc = true) const;
// Member Operators // Member Operators

View File

@ -388,21 +388,21 @@ void Foam::streamLineParticle::hitWallPatch
void Foam::streamLineParticle::readFields(Cloud<streamLineParticle>& c) void Foam::streamLineParticle::readFields(Cloud<streamLineParticle>& c)
{ {
const bool valid = c.size(); const bool readOnProc = c.size();
particle::readFields(c); particle::readFields(c);
IOField<label> lifeTime IOField<label> lifeTime
( (
c.fieldIOobject("lifeTime", IOobject::MUST_READ), c.fieldIOobject("lifeTime", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, lifeTime); c.checkFieldIOobject(c, lifeTime);
vectorFieldIOField sampledPositions vectorFieldIOField sampledPositions
( (
c.fieldIOobject("sampledPositions", IOobject::MUST_READ), c.fieldIOobject("sampledPositions", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, sampledPositions); c.checkFieldIOobject(c, sampledPositions);
@ -421,7 +421,7 @@ void Foam::streamLineParticle::writeFields(const Cloud<streamLineParticle>& c)
particle::writeFields(c); particle::writeFields(c);
const label np = c.size(); const label np = c.size();
const bool valid = c.size(); const bool writeOnProc = c.size();
IOField<label> lifeTime IOField<label> lifeTime
( (
@ -442,8 +442,8 @@ void Foam::streamLineParticle::writeFields(const Cloud<streamLineParticle>& c)
++i; ++i;
} }
lifeTime.write(valid); lifeTime.write(writeOnProc);
sampledPositions.write(valid); sampledPositions.write(writeOnProc);
} }

View File

@ -87,20 +87,20 @@ Foam::DSMCParcel<ParcelType>::DSMCParcel
template<class ParcelType> template<class ParcelType>
void Foam::DSMCParcel<ParcelType>::readFields(Cloud<DSMCParcel<ParcelType>>& c) void Foam::DSMCParcel<ParcelType>::readFields(Cloud<DSMCParcel<ParcelType>>& c)
{ {
bool valid = c.size(); const bool readOnProc = c.size();
ParcelType::readFields(c); ParcelType::readFields(c);
IOField<vector> U(c.fieldIOobject("U", IOobject::MUST_READ), valid); IOField<vector> U(c.fieldIOobject("U", IOobject::MUST_READ), readOnProc);
c.checkFieldIOobject(c, U); c.checkFieldIOobject(c, U);
IOField<scalar> Ei(c.fieldIOobject("Ei", IOobject::MUST_READ), valid); IOField<scalar> Ei(c.fieldIOobject("Ei", IOobject::MUST_READ), readOnProc);
c.checkFieldIOobject(c, Ei); c.checkFieldIOobject(c, Ei);
IOField<label> typeId IOField<label> typeId
( (
c.fieldIOobject("typeId", IOobject::MUST_READ), c.fieldIOobject("typeId", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, typeId); c.checkFieldIOobject(c, typeId);
@ -123,7 +123,8 @@ void Foam::DSMCParcel<ParcelType>::writeFields
{ {
ParcelType::writeFields(c); ParcelType::writeFields(c);
label np = c.size(); const label np = c.size();
const bool writeOnProc = c.size();
IOField<vector> U(c.fieldIOobject("U", IOobject::NO_READ), np); IOField<vector> U(c.fieldIOobject("U", IOobject::NO_READ), np);
IOField<scalar> Ei(c.fieldIOobject("Ei", IOobject::NO_READ), np); IOField<scalar> Ei(c.fieldIOobject("Ei", IOobject::NO_READ), np);
@ -138,9 +139,9 @@ void Foam::DSMCParcel<ParcelType>::writeFields
++i; ++i;
} }
U.write(np > 0); U.write(writeOnProc);
Ei.write(np > 0); Ei.write(writeOnProc);
typeId.write(np > 0); typeId.write(writeOnProc);
} }

View File

@ -269,7 +269,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
//- Write positions to \<cloudName\>_positions.obj file //- Write positions to \<cloudName\>_positions.obj file

View File

@ -134,18 +134,18 @@ void Foam::Cloud<ParticleType>::initCloud(const bool checkClass)
IOPosition<Cloud<ParticleType>> ioP(*this, geometryType_); IOPosition<Cloud<ParticleType>> ioP(*this, geometryType_);
const bool valid = ioP.headerOk(); const bool haveFile = ioP.headerOk();
Istream& is = ioP.readStream(checkClass ? typeName : "", valid); Istream& is = ioP.readStream(checkClass ? typeName : word::null, haveFile);
if (valid) if (haveFile)
{ {
ioP.readData(is, *this); ioP.readData(is, *this);
ioP.close(); ioP.close();
} }
if (!valid && debug) if (!haveFile && debug)
{ {
Pout<< "Cannot read particle positions file:" << nl Pout<< "Not reading particle positions file: "
<< " " << ioP.objectPath() << nl << ioP.objectRelPath() << nl
<< "Assuming the initial cloud contains 0 particles." << endl; << "Assuming the initial cloud contains 0 particles." << endl;
} }
@ -329,13 +329,13 @@ template<class ParticleType>
bool Foam::Cloud<ParticleType>::writeObject bool Foam::Cloud<ParticleType>::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool const bool /* writeOnProc */
) const ) const
{ {
writeCloudUniformProperties(); writeCloudUniformProperties();
writeFields(); writeFields();
return cloud::writeObject(streamOpt, this->size()); return cloud::writeObject(streamOpt, (this->size() > 0));
} }

View File

@ -54,9 +54,12 @@ Foam::IOPosition<CloudType>::IOPosition
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType> template<class CloudType>
bool Foam::IOPosition<CloudType>::write(const bool valid) const bool Foam::IOPosition<CloudType>::write
(
const bool /* writeOnProc */
) const
{ {
return regIOobject::write(cloud_.size()); return regIOobject::write(cloud_.size() > 0);
} }

View File

@ -84,14 +84,14 @@ public:
); );
// Member functions // Member Functions
//- Inherit readData from regIOobject //- Inherit readData from regIOobject
using regIOobject::readData; using regIOobject::readData;
virtual void readData(Istream&, CloudType&); virtual void readData(Istream&, CloudType&);
virtual bool write(const bool valid = true) const; virtual bool write(const bool writeOnProc = true) const;
virtual bool writeData(Ostream& os) const; virtual bool writeData(Ostream& os) const;
}; };

View File

@ -139,19 +139,19 @@ void Foam::particle::writeProperty
template<class TrackCloudType> template<class TrackCloudType>
void Foam::particle::readFields(TrackCloudType& c) void Foam::particle::readFields(TrackCloudType& c)
{ {
const bool valid = c.size(); const bool readOnProc = c.size();
IOobject procIO(c.fieldIOobject("origProcId", IOobject::MUST_READ)); IOobject procIO(c.fieldIOobject("origProcId", IOobject::MUST_READ));
const bool haveFile = procIO.typeHeaderOk<IOField<label>>(true); const bool haveFile = procIO.typeHeaderOk<IOField<label>>(true);
IOField<label> origProcId(procIO, valid && haveFile); IOField<label> origProcId(procIO, readOnProc && haveFile);
c.checkFieldIOobject(c, origProcId); c.checkFieldIOobject(c, origProcId);
IOField<label> origId IOField<label> origId
( (
c.fieldIOobject("origId", IOobject::MUST_READ), c.fieldIOobject("origId", IOobject::MUST_READ),
valid && haveFile readOnProc && haveFile
); );
c.checkFieldIOobject(c, origId); c.checkFieldIOobject(c, origId);
@ -170,12 +170,12 @@ template<class TrackCloudType>
void Foam::particle::writeFields(const TrackCloudType& c) void Foam::particle::writeFields(const TrackCloudType& c)
{ {
const label np = c.size(); const label np = c.size();
const bool valid = np; const bool writeOnProc = c.size();
if (writeLagrangianCoordinates) if (writeLagrangianCoordinates)
{ {
IOPosition<TrackCloudType> ioP(c); IOPosition<TrackCloudType> ioP(c);
ioP.write(valid); ioP.write(writeOnProc);
} }
else if (!writeLagrangianPositions) else if (!writeLagrangianPositions)
{ {
@ -192,7 +192,7 @@ void Foam::particle::writeFields(const TrackCloudType& c)
c, c,
cloud::geometryType::POSITIONS cloud::geometryType::POSITIONS
); );
ioP.write(valid); ioP.write(writeOnProc);
} }
IOField<label> origProc IOField<label> origProc
@ -215,8 +215,8 @@ void Foam::particle::writeFields(const TrackCloudType& c)
++i; ++i;
} }
origProc.write(valid); origProc.write(writeOnProc);
origId.write(valid); origId.write(writeOnProc);
} }

View File

@ -97,31 +97,31 @@ template<class ParcelType>
template<class CloudType> template<class CloudType>
void Foam::CollidingParcel<ParcelType>::readFields(CloudType& c) void Foam::CollidingParcel<ParcelType>::readFields(CloudType& c)
{ {
const bool valid = c.size(); const bool readOnProc = c.size();
ParcelType::readFields(c); ParcelType::readFields(c);
IOField<vector> f(c.fieldIOobject("f", IOobject::MUST_READ), valid); IOField<vector> f(c.fieldIOobject("f", IOobject::MUST_READ), readOnProc);
c.checkFieldIOobject(c, f); c.checkFieldIOobject(c, f);
IOField<vector> angularMomentum IOField<vector> angularMomentum
( (
c.fieldIOobject("angularMomentum", IOobject::MUST_READ), c.fieldIOobject("angularMomentum", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, angularMomentum); c.checkFieldIOobject(c, angularMomentum);
IOField<vector> torque IOField<vector> torque
( (
c.fieldIOobject("torque", IOobject::MUST_READ), c.fieldIOobject("torque", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, torque); c.checkFieldIOobject(c, torque);
labelFieldCompactIOField collisionRecordsPairAccessed labelFieldCompactIOField collisionRecordsPairAccessed
( (
c.fieldIOobject("collisionRecordsPairAccessed", IOobject::MUST_READ), c.fieldIOobject("collisionRecordsPairAccessed", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldFieldIOobject(c, collisionRecordsPairAccessed); c.checkFieldFieldIOobject(c, collisionRecordsPairAccessed);
@ -132,7 +132,7 @@ void Foam::CollidingParcel<ParcelType>::readFields(CloudType& c)
"collisionRecordsPairOrigProcOfOther", "collisionRecordsPairOrigProcOfOther",
IOobject::MUST_READ IOobject::MUST_READ
), ),
valid readOnProc
); );
c.checkFieldFieldIOobject(c, collisionRecordsPairOrigProcOfOther); c.checkFieldFieldIOobject(c, collisionRecordsPairOrigProcOfOther);
@ -143,35 +143,35 @@ void Foam::CollidingParcel<ParcelType>::readFields(CloudType& c)
"collisionRecordsPairOrigIdOfOther", "collisionRecordsPairOrigIdOfOther",
IOobject::MUST_READ IOobject::MUST_READ
), ),
valid readOnProc
); );
c.checkFieldFieldIOobject(c, collisionRecordsPairOrigProcOfOther); c.checkFieldFieldIOobject(c, collisionRecordsPairOrigProcOfOther);
pairDataFieldCompactIOField collisionRecordsPairData pairDataFieldCompactIOField collisionRecordsPairData
( (
c.fieldIOobject("collisionRecordsPairData", IOobject::MUST_READ), c.fieldIOobject("collisionRecordsPairData", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldFieldIOobject(c, collisionRecordsPairData); c.checkFieldFieldIOobject(c, collisionRecordsPairData);
labelFieldCompactIOField collisionRecordsWallAccessed labelFieldCompactIOField collisionRecordsWallAccessed
( (
c.fieldIOobject("collisionRecordsWallAccessed", IOobject::MUST_READ), c.fieldIOobject("collisionRecordsWallAccessed", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldFieldIOobject(c, collisionRecordsWallAccessed); c.checkFieldFieldIOobject(c, collisionRecordsWallAccessed);
vectorFieldCompactIOField collisionRecordsWallPRel vectorFieldCompactIOField collisionRecordsWallPRel
( (
c.fieldIOobject("collisionRecordsWallPRel", IOobject::MUST_READ), c.fieldIOobject("collisionRecordsWallPRel", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldFieldIOobject(c, collisionRecordsWallPRel); c.checkFieldFieldIOobject(c, collisionRecordsWallPRel);
wallDataFieldCompactIOField collisionRecordsWallData wallDataFieldCompactIOField collisionRecordsWallData
( (
c.fieldIOobject("collisionRecordsWallData", IOobject::MUST_READ), c.fieldIOobject("collisionRecordsWallData", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldFieldIOobject(c, collisionRecordsWallData); c.checkFieldFieldIOobject(c, collisionRecordsWallData);
@ -206,7 +206,7 @@ void Foam::CollidingParcel<ParcelType>::writeFields(const CloudType& c)
ParcelType::writeFields(c); ParcelType::writeFields(c);
const label np = c.size(); const label np = c.size();
const bool valid = np; const bool writeOnProc = c.size();
IOField<vector> f(c.fieldIOobject("f", IOobject::NO_READ), np); IOField<vector> f(c.fieldIOobject("f", IOobject::NO_READ), np);
@ -277,17 +277,17 @@ void Foam::CollidingParcel<ParcelType>::writeFields(const CloudType& c)
++i; ++i;
} }
f.write(valid); f.write(writeOnProc);
angMom.write(valid); angMom.write(writeOnProc);
torque.write(valid); torque.write(writeOnProc);
collisionRecordsPairAccessed.write(valid); collisionRecordsPairAccessed.write(writeOnProc);
collisionRecordsPairOrigProcOfOther.write(valid); collisionRecordsPairOrigProcOfOther.write(writeOnProc);
collisionRecordsPairOrigIdOfOther.write(valid); collisionRecordsPairOrigIdOfOther.write(writeOnProc);
collisionRecordsPairData.write(valid); collisionRecordsPairData.write(writeOnProc);
collisionRecordsWallAccessed.write(valid); collisionRecordsWallAccessed.write(writeOnProc);
collisionRecordsWallPRel.write(valid); collisionRecordsWallPRel.write(writeOnProc);
collisionRecordsWallData.write(valid); collisionRecordsWallData.write(writeOnProc);
} }

View File

@ -120,84 +120,84 @@ template<class ParcelType>
template<class CloudType> template<class CloudType>
void Foam::KinematicParcel<ParcelType>::readFields(CloudType& c) void Foam::KinematicParcel<ParcelType>::readFields(CloudType& c)
{ {
const bool valid = c.size(); const bool readOnProc = c.size();
ParcelType::readFields(c); ParcelType::readFields(c);
IOField<label> active IOField<label> active
( (
c.fieldIOobject("active", IOobject::MUST_READ), c.fieldIOobject("active", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, active); c.checkFieldIOobject(c, active);
IOField<label> typeId IOField<label> typeId
( (
c.fieldIOobject("typeId", IOobject::MUST_READ), c.fieldIOobject("typeId", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, typeId); c.checkFieldIOobject(c, typeId);
IOField<scalar> nParticle IOField<scalar> nParticle
( (
c.fieldIOobject("nParticle", IOobject::MUST_READ), c.fieldIOobject("nParticle", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, nParticle); c.checkFieldIOobject(c, nParticle);
IOField<scalar> d IOField<scalar> d
( (
c.fieldIOobject("d", IOobject::MUST_READ), c.fieldIOobject("d", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, d); c.checkFieldIOobject(c, d);
IOField<scalar> dTarget IOField<scalar> dTarget
( (
c.fieldIOobject("dTarget", IOobject::MUST_READ), c.fieldIOobject("dTarget", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, dTarget); c.checkFieldIOobject(c, dTarget);
IOField<vector> U IOField<vector> U
( (
c.fieldIOobject("U", IOobject::MUST_READ), c.fieldIOobject("U", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, U); c.checkFieldIOobject(c, U);
IOField<scalar> rho IOField<scalar> rho
( (
c.fieldIOobject("rho", IOobject::MUST_READ), c.fieldIOobject("rho", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, rho); c.checkFieldIOobject(c, rho);
IOField<scalar> age IOField<scalar> age
( (
c.fieldIOobject("age", IOobject::MUST_READ), c.fieldIOobject("age", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, age); c.checkFieldIOobject(c, age);
IOField<scalar> tTurb IOField<scalar> tTurb
( (
c.fieldIOobject("tTurb", IOobject::MUST_READ), c.fieldIOobject("tTurb", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, tTurb); c.checkFieldIOobject(c, tTurb);
IOField<vector> UTurb IOField<vector> UTurb
( (
c.fieldIOobject("UTurb", IOobject::MUST_READ), c.fieldIOobject("UTurb", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, UTurb); c.checkFieldIOobject(c, UTurb);
IOField<vector> UCorrect IOField<vector> UCorrect
( (
c.fieldIOobject("UCorrect", IOobject::MUST_READ), c.fieldIOobject("UCorrect", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, UCorrect); c.checkFieldIOobject(c, UCorrect);
@ -229,7 +229,7 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const CloudType& c)
ParcelType::writeFields(c); ParcelType::writeFields(c);
const label np = c.size(); const label np = c.size();
const bool valid = np; const bool writeOnProc = c.size();
IOField<label> active(c.fieldIOobject("active", IOobject::NO_READ), np); IOField<label> active(c.fieldIOobject("active", IOobject::NO_READ), np);
IOField<label> typeId(c.fieldIOobject("typeId", IOobject::NO_READ), np); IOField<label> typeId(c.fieldIOobject("typeId", IOobject::NO_READ), np);
@ -266,17 +266,17 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const CloudType& c)
++i; ++i;
} }
active.write(valid); active.write(writeOnProc);
typeId.write(valid); typeId.write(writeOnProc);
nParticle.write(valid); nParticle.write(writeOnProc);
d.write(valid); d.write(writeOnProc);
dTarget.write(valid); dTarget.write(writeOnProc);
U.write(valid); U.write(writeOnProc);
rho.write(valid); rho.write(writeOnProc);
age.write(valid); age.write(writeOnProc);
tTurb.write(valid); tTurb.write(writeOnProc);
UTurb.write(valid); UTurb.write(writeOnProc);
UCorrect.write(valid); UCorrect.write(writeOnProc);
} }

View File

@ -88,14 +88,14 @@ template<class ParcelType>
template<class CloudType> template<class CloudType>
void Foam::MPPICParcel<ParcelType>::readFields(CloudType& c) void Foam::MPPICParcel<ParcelType>::readFields(CloudType& c)
{ {
bool valid = c.size(); const bool readOnProc = c.size();
ParcelType::readFields(c); ParcelType::readFields(c);
IOField<vector> UCorrect IOField<vector> UCorrect
( (
c.fieldIOobject("UCorrect", IOobject::MUST_READ), c.fieldIOobject("UCorrect", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, UCorrect); c.checkFieldIOobject(c, UCorrect);
@ -116,6 +116,7 @@ void Foam::MPPICParcel<ParcelType>::writeFields(const CloudType& c)
ParcelType::writeFields(c); ParcelType::writeFields(c);
const label np = c.size(); const label np = c.size();
const bool writeOnProc = c.size();
IOField<vector> IOField<vector>
UCorrect(c.fieldIOobject("UCorrect", IOobject::NO_READ), np); UCorrect(c.fieldIOobject("UCorrect", IOobject::NO_READ), np);
@ -129,7 +130,7 @@ void Foam::MPPICParcel<ParcelType>::writeFields(const CloudType& c)
++i; ++i;
} }
UCorrect.write(np > 0); UCorrect.write(writeOnProc);
} }
@ -164,6 +165,7 @@ void Foam::MPPICParcel<ParcelType>::readObjects
{ {
ParcelType::readObjects(c, obr); ParcelType::readObjects(c, obr);
// const bool readOnProc = c.size();
if (!c.size()) return; if (!c.size()) return;
const auto& UCorrect = cloud::lookupIOField<vector>("UCorrect", obr); const auto& UCorrect = cloud::lookupIOField<vector>("UCorrect", obr);
@ -189,6 +191,7 @@ void Foam::MPPICParcel<ParcelType>::writeObjects
ParcelType::writeObjects(c, obr); ParcelType::writeObjects(c, obr);
const label np = c.size(); const label np = c.size();
// const bool writeOnProc = c.size();
auto& UCorrect = cloud::createIOField<vector>("UCorrect", np, obr); auto& UCorrect = cloud::createIOField<vector>("UCorrect", np, obr);

View File

@ -87,14 +87,14 @@ void Foam::ReactingHeterogeneousParcel<ParcelType>::readFields
const CompositionType& compModel const CompositionType& compModel
) )
{ {
const bool valid = c.size(); const bool readOnProc = c.size();
ParcelType::readFields(c); ParcelType::readFields(c);
IOField<scalar> mass0 IOField<scalar> mass0
( (
c.fieldIOobject("mass0", IOobject::MUST_READ), c.fieldIOobject("mass0", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, mass0); c.checkFieldIOobject(c, mass0);
@ -128,7 +128,7 @@ void Foam::ReactingHeterogeneousParcel<ParcelType>::readFields
"F" + name(i), "F" + name(i),
IOobject::MUST_READ IOobject::MUST_READ
), ),
valid readOnProc
); );
label j = 0; label j = 0;
@ -149,7 +149,7 @@ void Foam::ReactingHeterogeneousParcel<ParcelType>::readFields
"Y" + solidNames[j], "Y" + solidNames[j],
IOobject::MUST_READ IOobject::MUST_READ
), ),
valid readOnProc
); );
label i = 0; label i = 0;
@ -186,7 +186,7 @@ void Foam::ReactingHeterogeneousParcel<ParcelType>::writeFields
ThermoParcel<KinematicParcel<particle>>::writeFields(c); ThermoParcel<KinematicParcel<particle>>::writeFields(c);
const label np = c.size(); const label np = c.size();
const bool valid = np; const bool writeOnProc = c.size();
IOField<scalar> mass0(c.fieldIOobject("mass0", IOobject::NO_READ), np); IOField<scalar> mass0(c.fieldIOobject("mass0", IOobject::NO_READ), np);
@ -202,7 +202,7 @@ void Foam::ReactingHeterogeneousParcel<ParcelType>::writeFields
} }
++i; ++i;
} }
mass0.write(valid); mass0.write(writeOnProc);
for (label i = 0; i < nF; i++) for (label i = 0; i < nF; i++)
{ {
@ -221,7 +221,7 @@ void Foam::ReactingHeterogeneousParcel<ParcelType>::writeFields
F = p0.F()[i]; F = p0.F()[i];
} }
F.write(valid); F.write(writeOnProc);
} }
const label idSolid = compModel.idSolid(); const label idSolid = compModel.idSolid();
@ -246,7 +246,7 @@ void Foam::ReactingHeterogeneousParcel<ParcelType>::writeFields
++i; ++i;
} }
Y.write(valid); Y.write(writeOnProc);
} }
} }
@ -310,7 +310,7 @@ void Foam::ReactingHeterogeneousParcel<ParcelType>::readObjects
// Skip Reacting layer // Skip Reacting layer
ThermoParcel<KinematicParcel<particle>>::readObjects(c, obr); ThermoParcel<KinematicParcel<particle>>::readObjects(c, obr);
// const label np = c.size(); // const bool readOnProc = c.size();
WarningInFunction WarningInFunction
<< "Reading of objects is still a work-in-progress" << nl; << "Reading of objects is still a work-in-progress" << nl;
@ -332,6 +332,7 @@ void Foam::ReactingHeterogeneousParcel<ParcelType>::writeObjects
ThermoParcel<KinematicParcel<particle>>::writeObjects(c, obr); ThermoParcel<KinematicParcel<particle>>::writeObjects(c, obr);
const label np = c.size(); const label np = c.size();
const bool writeOnProc = c.size();
// WIP // WIP
label nF = 0; label nF = 0;
@ -341,7 +342,7 @@ void Foam::ReactingHeterogeneousParcel<ParcelType>::writeObjects
break; break;
} }
if (np > 0) if (writeOnProc)
{ {
for (label i = 0; i < nF; i++) for (label i = 0; i < nF; i++)
{ {

View File

@ -93,7 +93,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::readFields
const CompositionType& compModel const CompositionType& compModel
) )
{ {
bool valid = c.size(); const bool readOnProc = c.size();
ParcelType::readFields(c, compModel); ParcelType::readFields(c, compModel);
@ -124,7 +124,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::readFields
"Y" + gasNames[j] + stateLabels[idGas], "Y" + gasNames[j] + stateLabels[idGas],
IOobject::MUST_READ IOobject::MUST_READ
), ),
valid readOnProc
); );
label i = 0; label i = 0;
@ -144,7 +144,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::readFields
"Y" + liquidNames[j] + stateLabels[idLiquid], "Y" + liquidNames[j] + stateLabels[idLiquid],
IOobject::MUST_READ IOobject::MUST_READ
), ),
valid readOnProc
); );
label i = 0; label i = 0;
@ -164,7 +164,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::readFields
"Y" + solidNames[j] + stateLabels[idSolid], "Y" + solidNames[j] + stateLabels[idSolid],
IOobject::MUST_READ IOobject::MUST_READ
), ),
valid readOnProc
); );
label i = 0; label i = 0;
@ -195,7 +195,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeFields
{ {
ParcelType::writeFields(c, compModel); ParcelType::writeFields(c, compModel);
label np = c.size(); const label np = c.size();
const bool writeOnProc = c.size();
// Write the composition fractions // Write the composition fractions
{ {
@ -222,7 +223,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeFields
++i; ++i;
} }
YGas.write(np > 0); YGas.write(writeOnProc);
} }
const label idLiquid = compModel.idLiquid(); const label idLiquid = compModel.idLiquid();
@ -246,7 +247,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeFields
++i; ++i;
} }
YLiquid.write(np > 0); YLiquid.write(writeOnProc);
} }
const label idSolid = compModel.idSolid(); const label idSolid = compModel.idSolid();
@ -270,7 +271,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeFields
++i; ++i;
} }
YSolid.write(np > 0); YSolid.write(writeOnProc);
} }
} }
} }
@ -336,9 +337,10 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::readObjects
ParcelType::readObjects(c, obr); ParcelType::readObjects(c, obr);
const label np = c.size(); const label np = c.size();
const bool readOnProc = c.size();
// The composition fractions // The composition fractions
if (np > 0) if (readOnProc)
{ {
const wordList& stateLabels = compModel.stateLabels(); const wordList& stateLabels = compModel.stateLabels();
@ -402,9 +404,10 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeObjects
ParcelType::writeObjects(c, obr); ParcelType::writeObjects(c, obr);
const label np = c.size(); const label np = c.size();
const bool writeOnProc = c.size();
// Write the composition fractions // Write the composition fractions
if (np > 0) if (writeOnProc)
{ {
const wordList& stateLabels = compModel.stateLabels(); const wordList& stateLabels = compModel.stateLabels();

View File

@ -106,14 +106,14 @@ void Foam::ReactingParcel<ParcelType>::readFields
const CompositionType& compModel const CompositionType& compModel
) )
{ {
bool valid = c.size(); const bool readOnProc = c.size();
ParcelType::readFields(c); ParcelType::readFields(c);
IOField<scalar> mass0 IOField<scalar> mass0
( (
c.fieldIOobject("mass0", IOobject::MUST_READ), c.fieldIOobject("mass0", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, mass0); c.checkFieldIOobject(c, mass0);
@ -151,7 +151,7 @@ void Foam::ReactingParcel<ParcelType>::readFields
"Y" + phaseTypes[j] + stateLabels[j], "Y" + phaseTypes[j] + stateLabels[j],
IOobject::MUST_READ IOobject::MUST_READ
), ),
valid readOnProc
); );
label i = 0; label i = 0;
@ -184,6 +184,7 @@ void Foam::ReactingParcel<ParcelType>::writeFields
ParcelType::writeFields(c); ParcelType::writeFields(c);
const label np = c.size(); const label np = c.size();
const bool writeOnProc = c.size();
{ {
IOField<scalar> mass0(c.fieldIOobject("mass0", IOobject::NO_READ), np); IOField<scalar> mass0(c.fieldIOobject("mass0", IOobject::NO_READ), np);
@ -195,7 +196,7 @@ void Foam::ReactingParcel<ParcelType>::writeFields
++i; ++i;
} }
mass0.write(np > 0); mass0.write(writeOnProc);
// Write the composition fractions // Write the composition fractions
const wordList& phaseTypes = compModel.phaseTypes(); const wordList& phaseTypes = compModel.phaseTypes();
@ -225,7 +226,7 @@ void Foam::ReactingParcel<ParcelType>::writeFields
++i; ++i;
} }
Y.write(np > 0); Y.write(writeOnProc);
} }
} }
} }
@ -337,8 +338,9 @@ void Foam::ReactingParcel<ParcelType>::writeObjects
ParcelType::writeObjects(c, obr); ParcelType::writeObjects(c, obr);
const label np = c.size(); const label np = c.size();
const bool writeOnProc = c.size();
if (np > 0) if (writeOnProc)
{ {
auto& mass0 = cloud::createIOField<scalar>("mass0", np, obr); auto& mass0 = cloud::createIOField<scalar>("mass0", np, obr);

View File

@ -90,14 +90,14 @@ template<class ParcelType>
template<class CloudType> template<class CloudType>
void Foam::ThermoParcel<ParcelType>::readFields(CloudType& c) void Foam::ThermoParcel<ParcelType>::readFields(CloudType& c)
{ {
const bool valid = c.size(); const bool readOnProc = c.size();
ParcelType::readFields(c); ParcelType::readFields(c);
IOField<scalar> T(c.fieldIOobject("T", IOobject::MUST_READ), valid); IOField<scalar> T(c.fieldIOobject("T", IOobject::MUST_READ), readOnProc);
c.checkFieldIOobject(c, T); c.checkFieldIOobject(c, T);
IOField<scalar> Cp(c.fieldIOobject("Cp", IOobject::MUST_READ), valid); IOField<scalar> Cp(c.fieldIOobject("Cp", IOobject::MUST_READ), readOnProc);
c.checkFieldIOobject(c, Cp); c.checkFieldIOobject(c, Cp);
@ -119,7 +119,7 @@ void Foam::ThermoParcel<ParcelType>::writeFields(const CloudType& c)
ParcelType::writeFields(c); ParcelType::writeFields(c);
const label np = c.size(); const label np = c.size();
const bool valid = np; const bool writeOnProc = c.size();
IOField<scalar> T(c.fieldIOobject("T", IOobject::NO_READ), np); IOField<scalar> T(c.fieldIOobject("T", IOobject::NO_READ), np);
IOField<scalar> Cp(c.fieldIOobject("Cp", IOobject::NO_READ), np); IOField<scalar> Cp(c.fieldIOobject("Cp", IOobject::NO_READ), np);
@ -133,8 +133,8 @@ void Foam::ThermoParcel<ParcelType>::writeFields(const CloudType& c)
++i; ++i;
} }
T.write(valid); T.write(writeOnProc);
Cp.write(valid); Cp.write(writeOnProc);
} }

View File

@ -138,7 +138,7 @@ bool Foam::AveragingMethod<Type>::writeData(Ostream& os) const
template<class Type> template<class Type>
bool Foam::AveragingMethod<Type>::write(const bool valid) const bool Foam::AveragingMethod<Type>::write(const bool writeOnProc) const
{ {
const pointMesh pointMesh_(mesh_); const pointMesh pointMesh_(mesh_);
@ -234,10 +234,10 @@ bool Foam::AveragingMethod<Type>::write(const bool valid) const
pointGrad.primitiveFieldRef() /= pointVolume; pointGrad.primitiveFieldRef() /= pointVolume;
// write // write
if (!cellValue.write(valid)) return false; if (!cellValue.write(writeOnProc)) return false;
if (!cellGrad.write(valid)) return false; if (!cellGrad.write(writeOnProc)) return false;
if (!pointValue.write(valid)) return false; if (!pointValue.write(writeOnProc)) return false;
if (!pointGrad.write(valid)) return false; if (!pointGrad.write(writeOnProc)) return false;
return true; return true;
} }

View File

@ -167,7 +167,7 @@ public:
virtual bool writeData(Ostream&) const; virtual bool writeData(Ostream&) const;
//- Write using setting from DB //- Write using setting from DB
virtual bool write(const bool valid = true) const; virtual bool write(const bool writeOnProc = true) const;
//- Return an internal field of the average //- Return an internal field of the average
virtual tmp<Field<Type>> primitiveField() const = 0; virtual tmp<Field<Type>> primitiveField() const = 0;

View File

@ -110,40 +110,44 @@ Foam::molecule::molecule
void Foam::molecule::readFields(Cloud<molecule>& mC) void Foam::molecule::readFields(Cloud<molecule>& mC)
{ {
const bool valid = mC.size(); const bool readOnProc = mC.size();
particle::readFields(mC); particle::readFields(mC);
IOField<tensor> Q(mC.fieldIOobject("Q", IOobject::MUST_READ), valid); IOField<tensor> Q(mC.fieldIOobject("Q", IOobject::MUST_READ), readOnProc);
mC.checkFieldIOobject(mC, Q); mC.checkFieldIOobject(mC, Q);
IOField<vector> v(mC.fieldIOobject("v", IOobject::MUST_READ), valid); IOField<vector> v(mC.fieldIOobject("v", IOobject::MUST_READ), readOnProc);
mC.checkFieldIOobject(mC, v); mC.checkFieldIOobject(mC, v);
IOField<vector> a(mC.fieldIOobject("a", IOobject::MUST_READ), valid); IOField<vector> a(mC.fieldIOobject("a", IOobject::MUST_READ), readOnProc);
mC.checkFieldIOobject(mC, a); mC.checkFieldIOobject(mC, a);
IOField<vector> pi(mC.fieldIOobject("pi", IOobject::MUST_READ), valid); IOField<vector> pi(mC.fieldIOobject("pi", IOobject::MUST_READ), readOnProc);
mC.checkFieldIOobject(mC, pi); mC.checkFieldIOobject(mC, pi);
IOField<vector> tau(mC.fieldIOobject("tau", IOobject::MUST_READ), valid); IOField<vector> tau
(
mC.fieldIOobject("tau", IOobject::MUST_READ),
readOnProc
);
mC.checkFieldIOobject(mC, tau); mC.checkFieldIOobject(mC, tau);
IOField<vector> specialPosition IOField<vector> specialPosition
( (
mC.fieldIOobject("specialPosition", IOobject::MUST_READ), mC.fieldIOobject("specialPosition", IOobject::MUST_READ),
valid readOnProc
); );
mC.checkFieldIOobject(mC, specialPosition); mC.checkFieldIOobject(mC, specialPosition);
IOField<label> special IOField<label> special
( (
mC.fieldIOobject("special", IOobject::MUST_READ), mC.fieldIOobject("special", IOobject::MUST_READ),
valid readOnProc
); );
mC.checkFieldIOobject(mC, special); mC.checkFieldIOobject(mC, special);
IOField<label> id(mC.fieldIOobject("id", IOobject::MUST_READ), valid); IOField<label> id(mC.fieldIOobject("id", IOobject::MUST_READ), readOnProc);
mC.checkFieldIOobject(mC, id); mC.checkFieldIOobject(mC, id);
label i = 0; label i = 0;
@ -168,7 +172,7 @@ void Foam::molecule::writeFields(const Cloud<molecule>& mC)
particle::writeFields(mC); particle::writeFields(mC);
const label np = mC.size(); const label np = mC.size();
const bool valid = np; const bool writeOnProc = mC.size();
IOField<tensor> Q(mC.fieldIOobject("Q", IOobject::NO_READ), np); IOField<tensor> Q(mC.fieldIOobject("Q", IOobject::NO_READ), np);
IOField<vector> v(mC.fieldIOobject("v", IOobject::NO_READ), np); IOField<vector> v(mC.fieldIOobject("v", IOobject::NO_READ), np);
@ -237,21 +241,21 @@ void Foam::molecule::writeFields(const Cloud<molecule>& mC)
++i; ++i;
} }
Q.write(valid); Q.write(writeOnProc);
v.write(valid); v.write(writeOnProc);
a.write(valid); a.write(writeOnProc);
pi.write(valid); pi.write(writeOnProc);
tau.write(valid); tau.write(writeOnProc);
specialPosition.write(valid); specialPosition.write(writeOnProc);
special.write(valid); special.write(writeOnProc);
id.write(valid); id.write(writeOnProc);
piGlobal.write(valid); piGlobal.write(writeOnProc);
tauGlobal.write(valid); tauGlobal.write(writeOnProc);
orientation1.write(valid); orientation1.write(writeOnProc);
orientation2.write(valid); orientation2.write(writeOnProc);
orientation3.write(valid); orientation3.write(writeOnProc);
Info<< "writeFields " << mC.name() << endl; Info<< "writeFields " << mC.name() << endl;

View File

@ -78,14 +78,14 @@ Foam::solidParticle::solidParticle
void Foam::solidParticle::readFields(Cloud<solidParticle>& c) void Foam::solidParticle::readFields(Cloud<solidParticle>& c)
{ {
bool valid = c.size(); const bool readOnProc = c.size();
particle::readFields(c); particle::readFields(c);
IOField<scalar> d(c.fieldIOobject("d", IOobject::MUST_READ), valid); IOField<scalar> d(c.fieldIOobject("d", IOobject::MUST_READ), readOnProc);
c.checkFieldIOobject(c, d); c.checkFieldIOobject(c, d);
IOField<vector> U(c.fieldIOobject("U", IOobject::MUST_READ), valid); IOField<vector> U(c.fieldIOobject("U", IOobject::MUST_READ), readOnProc);
c.checkFieldIOobject(c, U); c.checkFieldIOobject(c, U);
label i = 0; label i = 0;
@ -103,6 +103,7 @@ void Foam::solidParticle::writeFields(const Cloud<solidParticle>& c)
particle::writeFields(c); particle::writeFields(c);
const label np = c.size(); const label np = c.size();
const bool writeOnProc = c.size();
IOField<scalar> d(c.fieldIOobject("d", IOobject::NO_READ), np); IOField<scalar> d(c.fieldIOobject("d", IOobject::NO_READ), np);
IOField<vector> U(c.fieldIOobject("U", IOobject::NO_READ), np); IOField<vector> U(c.fieldIOobject("U", IOobject::NO_READ), np);
@ -115,8 +116,8 @@ void Foam::solidParticle::writeFields(const Cloud<solidParticle>& c)
++i; ++i;
} }
d.write(np > 0); d.write(writeOnProc);
U.write(np > 0); U.write(writeOnProc);
} }

View File

@ -135,86 +135,90 @@ void Foam::SprayParcel<ParcelType>::readFields
const CompositionType& compModel const CompositionType& compModel
) )
{ {
const bool valid = c.size(); const bool readOnProc = c.size();
ParcelType::readFields(c, compModel); ParcelType::readFields(c, compModel);
IOField<scalar> d0(c.fieldIOobject("d0", IOobject::MUST_READ), valid); IOField<scalar> d0(c.fieldIOobject("d0", IOobject::MUST_READ), readOnProc);
c.checkFieldIOobject(c, d0); c.checkFieldIOobject(c, d0);
IOField<vector> position0 IOField<vector> position0
( (
c.fieldIOobject("position0", IOobject::MUST_READ), c.fieldIOobject("position0", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, position0); c.checkFieldIOobject(c, position0);
IOField<scalar> sigma(c.fieldIOobject("sigma", IOobject::MUST_READ), valid); IOField<scalar> sigma
(
c.fieldIOobject("sigma", IOobject::MUST_READ),
readOnProc
);
c.checkFieldIOobject(c, sigma); c.checkFieldIOobject(c, sigma);
IOField<scalar> mu(c.fieldIOobject("mu", IOobject::MUST_READ), valid); IOField<scalar> mu(c.fieldIOobject("mu", IOobject::MUST_READ), readOnProc);
c.checkFieldIOobject(c, mu); c.checkFieldIOobject(c, mu);
IOField<scalar> liquidCore IOField<scalar> liquidCore
( (
c.fieldIOobject("liquidCore", IOobject::MUST_READ), c.fieldIOobject("liquidCore", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, liquidCore); c.checkFieldIOobject(c, liquidCore);
IOField<scalar> KHindex IOField<scalar> KHindex
( (
c.fieldIOobject("KHindex", IOobject::MUST_READ), c.fieldIOobject("KHindex", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, KHindex); c.checkFieldIOobject(c, KHindex);
IOField<scalar> y IOField<scalar> y
( (
c.fieldIOobject("y", IOobject::MUST_READ), c.fieldIOobject("y", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, y); c.checkFieldIOobject(c, y);
IOField<scalar> yDot IOField<scalar> yDot
( (
c.fieldIOobject("yDot", IOobject::MUST_READ), c.fieldIOobject("yDot", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, yDot); c.checkFieldIOobject(c, yDot);
IOField<scalar> tc IOField<scalar> tc
( (
c.fieldIOobject("tc", IOobject::MUST_READ), c.fieldIOobject("tc", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, tc); c.checkFieldIOobject(c, tc);
IOField<scalar> ms IOField<scalar> ms
( (
c.fieldIOobject("ms", IOobject::MUST_READ), c.fieldIOobject("ms", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, ms); c.checkFieldIOobject(c, ms);
IOField<scalar> injector IOField<scalar> injector
( (
c.fieldIOobject("injector", IOobject::MUST_READ), c.fieldIOobject("injector", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, injector); c.checkFieldIOobject(c, injector);
IOField<scalar> tMom IOField<scalar> tMom
( (
c.fieldIOobject("tMom", IOobject::MUST_READ), c.fieldIOobject("tMom", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, tMom); c.checkFieldIOobject(c, tMom);
IOField<scalar> user IOField<scalar> user
( (
c.fieldIOobject("user", IOobject::MUST_READ), c.fieldIOobject("user", IOobject::MUST_READ),
valid readOnProc
); );
c.checkFieldIOobject(c, user); c.checkFieldIOobject(c, user);
@ -259,8 +263,7 @@ void Foam::SprayParcel<ParcelType>::writeFields
ParcelType::writeFields(c, compModel); ParcelType::writeFields(c, compModel);
const label np = c.size(); const label np = c.size();
const bool valid = np; const bool writeOnProc = c.size();
IOField<scalar> d0(c.fieldIOobject("d0", IOobject::NO_READ), np); IOField<scalar> d0(c.fieldIOobject("d0", IOobject::NO_READ), np);
IOField<vector> position0 IOField<vector> position0
@ -307,19 +310,19 @@ void Foam::SprayParcel<ParcelType>::writeFields
++i; ++i;
} }
d0.write(valid); d0.write(writeOnProc);
position0.write(valid); position0.write(writeOnProc);
sigma.write(valid); sigma.write(writeOnProc);
mu.write(valid); mu.write(writeOnProc);
liquidCore.write(valid); liquidCore.write(writeOnProc);
KHindex.write(valid); KHindex.write(writeOnProc);
y.write(valid); y.write(writeOnProc);
yDot.write(valid); yDot.write(writeOnProc);
tc.write(valid); tc.write(writeOnProc);
ms.write(valid); ms.write(writeOnProc);
injector.write(valid); injector.write(writeOnProc);
tMom.write(valid); tMom.write(writeOnProc);
user.write(valid); user.write(writeOnProc);
} }

View File

@ -1265,7 +1265,7 @@ void Foam::triSurfaceMesh::getVolumeType
bool Foam::triSurfaceMesh::writeObject bool Foam::triSurfaceMesh::writeObject
( (
IOstreamOption, IOstreamOption,
const bool valid const bool writeOnProc
) const ) const
{ {
const Time& runTime = searchableSurface::time(); const Time& runTime = searchableSurface::time();

View File

@ -316,7 +316,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
//- Is object global //- Is object global

View File

@ -229,13 +229,13 @@ Foam::label Foam::cellZoneSet::maxSize(const polyMesh& mesh) const
bool Foam::cellZoneSet::writeObject bool Foam::cellZoneSet::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
// Write shadow cellSet // Write shadow cellSet
word oldTypeName = typeName; word oldTypeName = typeName;
const_cast<word&>(type()) = cellSet::typeName; const_cast<word&>(type()) = cellSet::typeName;
bool ok = cellSet::writeObject(streamOpt, valid); bool ok = cellSet::writeObject(streamOpt, writeOnProc);
const_cast<word&>(type()) = oldTypeName; const_cast<word&>(type()) = oldTypeName;
// Modify cellZone // Modify cellZone
@ -265,7 +265,7 @@ bool Foam::cellZoneSet::writeObject
} }
cellZones.clearAddressing(); cellZones.clearAddressing();
return ok && cellZones.write(valid); return ok && cellZones.write(writeOnProc);
} }

View File

@ -143,7 +143,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
//- Update any stored data for new labels //- Update any stored data for new labels

View File

@ -445,13 +445,13 @@ Foam::label Foam::faceZoneSet::maxSize(const polyMesh& mesh) const
bool Foam::faceZoneSet::writeObject bool Foam::faceZoneSet::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
// Write shadow faceSet // Write shadow faceSet
word oldTypeName = typeName; word oldTypeName = typeName;
const_cast<word&>(type()) = faceSet::typeName; const_cast<word&>(type()) = faceSet::typeName;
bool ok = faceSet::writeObject(streamOpt, valid); bool ok = faceSet::writeObject(streamOpt, writeOnProc);
const_cast<word&>(type()) = oldTypeName; const_cast<word&>(type()) = oldTypeName;
// Modify faceZone // Modify faceZone
@ -482,7 +482,7 @@ bool Foam::faceZoneSet::writeObject
} }
faceZones.clearAddressing(); faceZones.clearAddressing();
return ok && faceZones.write(valid); return ok && faceZones.write(writeOnProc);
} }

View File

@ -157,7 +157,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
//- Update any stored data for new labels //- Update any stored data for new labels

View File

@ -229,13 +229,13 @@ Foam::label Foam::pointZoneSet::maxSize(const polyMesh& mesh) const
bool Foam::pointZoneSet::writeObject bool Foam::pointZoneSet::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
// Write shadow pointSet // Write shadow pointSet
word oldTypeName = typeName; word oldTypeName = typeName;
const_cast<word&>(type()) = pointSet::typeName; const_cast<word&>(type()) = pointSet::typeName;
bool ok = pointSet::writeObject(streamOpt, valid); bool ok = pointSet::writeObject(streamOpt, writeOnProc);
const_cast<word&>(type()) = oldTypeName; const_cast<word&>(type()) = oldTypeName;
// Modify pointZone // Modify pointZone
@ -265,7 +265,7 @@ bool Foam::pointZoneSet::writeObject
} }
pointZones.clearAddressing(); pointZones.clearAddressing();
return ok && pointZones.write(valid); return ok && pointZones.write(writeOnProc);
} }

View File

@ -144,7 +144,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
//- Update any stored data for new labels //- Update any stored data for new labels

View File

@ -25,7 +25,6 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::incompressiblePrimalSolver Foam::incompressiblePrimalSolver

View File

@ -74,11 +74,12 @@ bool Foam::dynamicOversetFvMesh::update()
bool Foam::dynamicOversetFvMesh::writeObject bool Foam::dynamicOversetFvMesh::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
bool ok = dynamicMotionSolverListFvMesh::writeObject(streamOpt, valid); bool ok =
ok = oversetFvMeshBase::writeObject(streamOpt, valid) && ok; dynamicMotionSolverListFvMesh::writeObject(streamOpt, writeOnProc);
ok = oversetFvMeshBase::writeObject(streamOpt, writeOnProc) && ok;
return ok; return ok;
} }

View File

@ -210,7 +210,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
}; };

View File

@ -633,7 +633,7 @@ bool Foam::oversetFvMeshBase::interpolateFields()
bool Foam::oversetFvMeshBase::writeObject bool Foam::oversetFvMeshBase::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
// For postprocessing : write cellTypes and zoneID // For postprocessing : write cellTypes and zoneID
@ -664,7 +664,7 @@ bool Foam::oversetFvMeshBase::writeObject
volTypes[cellI] = cellTypes[cellI]; volTypes[cellI] = cellTypes[cellI];
} }
volTypes.correctBoundaryConditions(); volTypes.correctBoundaryConditions();
volTypes.writeObject(streamOpt, valid); volTypes.writeObject(streamOpt, writeOnProc);
} }
{ {
volScalarField volZoneID volScalarField volZoneID
@ -691,7 +691,7 @@ bool Foam::oversetFvMeshBase::writeObject
volZoneID[cellI] = zoneID[cellI]; volZoneID[cellI] = zoneID[cellI];
} }
volZoneID.correctBoundaryConditions(); volZoneID.correctBoundaryConditions();
volZoneID.writeObject(streamOpt, valid); volZoneID.writeObject(streamOpt, writeOnProc);
} }
if (debug) if (debug)
{ {
@ -752,7 +752,7 @@ bool Foam::oversetFvMeshBase::writeObject
( (
volDonorZoneID volDonorZoneID
); );
ok = volDonorZoneID.writeObject(streamOpt, valid); ok = volDonorZoneID.writeObject(streamOpt, writeOnProc);
} }
return ok; return ok;

View File

@ -248,7 +248,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
//- Debug: check halo swap is ok //- Debug: check halo swap is ok

View File

@ -72,11 +72,11 @@ bool Foam::staticOversetFvMesh::update()
bool Foam::staticOversetFvMesh::writeObject bool Foam::staticOversetFvMesh::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
bool ok = staticFvMesh::writeObject(streamOpt, valid); bool ok = staticFvMesh::writeObject(streamOpt, writeOnProc);
ok = oversetFvMeshBase::writeObject(streamOpt, valid) && ok; ok = oversetFvMeshBase::writeObject(streamOpt, writeOnProc) && ok;
return ok; return ok;
} }

View File

@ -209,7 +209,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
}; };

View File

@ -4911,14 +4911,14 @@ void Foam::distributedTriSurfaceMesh::distribute
bool Foam::distributedTriSurfaceMesh::writeObject bool Foam::distributedTriSurfaceMesh::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
if (debug) if (debug)
{ {
Pout<< "distributedTriSurfaceMesh::writeObject :" Pout<< "distributedTriSurfaceMesh::writeObject :"
<< " surface " << searchableSurface::name() << " surface " << searchableSurface::name()
<< " writing surface valid:" << valid << endl; << " writing surface:" << writeOnProc << endl;
} }
// Make sure dictionary goes to same directory as surface // Make sure dictionary goes to same directory as surface

View File

@ -584,7 +584,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
//- Is object global //- Is object global

View File

@ -392,7 +392,7 @@ void Foam::rigidBodyMeshMotion::solve()
bool Foam::rigidBodyMeshMotion::writeObject bool Foam::rigidBodyMeshMotion::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
// Force ASCII writing // Force ASCII writing
@ -413,7 +413,7 @@ bool Foam::rigidBodyMeshMotion::writeObject
); );
model_.state().write(dict); model_.state().write(dict);
return dict.regIOobject::writeObject(streamOpt, valid); return dict.regIOobject::writeObject(streamOpt, writeOnProc);
} }

View File

@ -177,7 +177,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
//- Read dynamicMeshDict dictionary //- Read dynamicMeshDict dictionary

View File

@ -279,7 +279,7 @@ void Foam::rigidBodyMeshMotionSolver::solve()
bool Foam::rigidBodyMeshMotionSolver::writeObject bool Foam::rigidBodyMeshMotionSolver::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
// Force ASCII writing // Force ASCII writing
@ -300,7 +300,7 @@ bool Foam::rigidBodyMeshMotionSolver::writeObject
); );
model_.state().write(dict); model_.state().write(dict);
return dict.regIOobject::writeObject(streamOpt, valid); return dict.regIOobject::writeObject(streamOpt, writeOnProc);
} }

View File

@ -157,7 +157,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
//- Read dynamicMeshDict dictionary //- Read dynamicMeshDict dictionary

View File

@ -298,7 +298,7 @@ void Foam::sixDoFRigidBodyMotionSolver::solve()
bool Foam::sixDoFRigidBodyMotionSolver::writeObject bool Foam::sixDoFRigidBodyMotionSolver::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
IOdictionary dict IOdictionary dict
@ -316,7 +316,7 @@ bool Foam::sixDoFRigidBodyMotionSolver::writeObject
); );
motion_.state().write(dict); motion_.state().write(dict);
return dict.regIOobject::write(); return dict.regIOobject::writeObject(streamOpt, writeOnProc);
} }

View File

@ -145,7 +145,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
//- Read dynamicMeshDict dictionary //- Read dynamicMeshDict dictionary

View File

@ -103,13 +103,13 @@ void Foam::Detail::MeshedSurfaceIOAllocator::clear()
bool Foam::Detail::MeshedSurfaceIOAllocator::writeObject bool Foam::Detail::MeshedSurfaceIOAllocator::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
return return
( (
points_.writeObject(streamOpt, valid) points_.writeObject(streamOpt, writeOnProc)
&& faces_.writeObject(streamOpt, valid) && faces_.writeObject(streamOpt, writeOnProc)
); );
} }

View File

@ -152,7 +152,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;
}; };

View File

@ -391,7 +391,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;

View File

@ -32,7 +32,7 @@ License
bool Foam::polySurface::writeObject bool Foam::polySurface::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
return true; // no-op return true; // no-op

View File

@ -341,7 +341,7 @@ public:
virtual bool writeObject virtual bool writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const; ) const;

View File

@ -194,14 +194,14 @@ Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate()
bool Foam::surfMesh::writeObject bool Foam::surfMesh::writeObject
( (
IOstreamOption streamOpt, IOstreamOption streamOpt,
const bool valid const bool writeOnProc
) const ) const
{ {
bool ok = Allocator::writeObject(streamOpt, valid); bool ok = Allocator::writeObject(streamOpt, writeOnProc);
if (ok) if (ok)
{ {
surfZones_.writeObject(streamOpt, valid); surfZones_.writeObject(streamOpt, writeOnProc);
} }
return ok; return ok;