BUG: hexRef8Data: scatter master value

For distributed data + running redistributePar some of the processors
might not have level0Edge. In this case the sync() routine should
fix this but it does require at least the master to have valid data.
This commit is contained in:
mattijs
2015-11-27 16:25:54 +00:00
parent c0f4f1e68c
commit a020b2c6cd

View File

@ -61,7 +61,15 @@ Foam::hexRef8Data::hexRef8Data(const IOobject& io)
{ {
IOobject rio(io); IOobject rio(io);
rio.rename("level0Edge"); rio.rename("level0Edge");
bool haveFile = returnReduce(rio.headerOk(), orOp<bool>());
// MEJ: temporarily (until global reading of UniformedFields)
// do not read level0Edge on processors that do not have it.
bool haveFile = rio.headerOk();
if (rio.readOpt() != IOobject::READ_IF_PRESENT)
{
reduce(haveFile, orOp<bool>());
}
if (haveFile) if (haveFile)
{ {
Info<< "Reading hexRef8 data : " << rio.name() << endl; Info<< "Reading hexRef8 data : " << rio.name() << endl;
@ -264,7 +272,7 @@ void Foam::hexRef8Data::sync(const IOobject& io)
if (hasLevel0Edge) if (hasLevel0Edge)
{ {
// Get master length // Get master length
scalar masterLen = level0EdgePtr_().value(); scalar masterLen = (Pstream::master() ? level0EdgePtr_().value() : 0);
Pstream::scatter(masterLen); Pstream::scatter(masterLen);
if (!level0EdgePtr_.valid()) if (!level0EdgePtr_.valid())
{ {