mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: IOobject headerClassName now initialised to empty value
- was previously populated with "IOobject" (the typeName) but then cannot easily detect if the object was actually read. Also clear the headerClassName on a failed read BUG: parallel inconsistency in regIOobject::readHeaderOk - headerOk() checked with master, but possible parallel operations within it
This commit is contained in:
@ -272,18 +272,18 @@ void evaluate
|
||||
);
|
||||
io.typeHeaderOk<IOobject>(false);
|
||||
|
||||
oldFieldType = io.headerClassName();
|
||||
|
||||
if (oldFieldType == IOobject::typeName)
|
||||
if (!io.hasHeaderClass() || io.isHeaderClass<IOobject>())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Field " << fieldName << "(type: " << oldFieldType
|
||||
<< ") seems to be missing. Use 'create'" << nl
|
||||
<< "Field '" << fieldName
|
||||
<< "' seems to be missing. Use 'create'" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
oldFieldType = io.headerClassName();
|
||||
|
||||
Info<< "Modify field: " << fieldName
|
||||
<< " (type " << oldFieldType << ')';
|
||||
<< " (type: " << oldFieldType << ')';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -321,7 +321,7 @@ Foam::IOobject::IOobject
|
||||
sizeofScalar_(static_cast<unsigned char>(sizeof(scalar))),
|
||||
|
||||
name_(name),
|
||||
headerClassName_(typeName),
|
||||
headerClassName_(),
|
||||
note_(),
|
||||
instance_(instance),
|
||||
local_(),
|
||||
@ -331,8 +331,7 @@ Foam::IOobject::IOobject
|
||||
if (objectRegistry::debug)
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Constructing IOobject called " << name_
|
||||
<< " of type " << headerClassName_ << endl;
|
||||
<< "Constructing IOobject: " << name_ << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -352,7 +351,7 @@ Foam::IOobject::IOobject
|
||||
sizeofScalar_(static_cast<unsigned char>(sizeof(scalar))),
|
||||
|
||||
name_(name),
|
||||
headerClassName_(typeName),
|
||||
headerClassName_(),
|
||||
note_(),
|
||||
instance_(instance),
|
||||
local_(local),
|
||||
@ -362,8 +361,7 @@ Foam::IOobject::IOobject
|
||||
if (objectRegistry::debug)
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Constructing IOobject called " << name_
|
||||
<< " of type " << headerClassName_ << endl;
|
||||
<< "Constructing IOobject: " << name_ << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,7 +379,7 @@ Foam::IOobject::IOobject
|
||||
sizeofScalar_(static_cast<unsigned char>(sizeof(scalar))),
|
||||
|
||||
name_(),
|
||||
headerClassName_(typeName),
|
||||
headerClassName_(),
|
||||
note_(),
|
||||
instance_(),
|
||||
local_(),
|
||||
@ -398,8 +396,7 @@ Foam::IOobject::IOobject
|
||||
if (objectRegistry::debug)
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Constructing IOobject called " << name_
|
||||
<< " of type " << headerClassName_ << endl;
|
||||
<< "Constructing IOobject: " << name_ << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -120,6 +120,9 @@ bool Foam::IOobject::readHeader(dictionary& headerDict, Istream& is)
|
||||
|
||||
writeHeader(Info);
|
||||
|
||||
// Mark as not read
|
||||
headerClassName_.clear();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -60,7 +60,9 @@ bool Foam::regIOobject::readHeaderOk
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
const bool oldParRun = Pstream::parRun(false);
|
||||
isHeaderOk = headerOk();
|
||||
Pstream::parRun(oldParRun);
|
||||
}
|
||||
Pstream::broadcast(isHeaderOk);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user