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);
|
io.typeHeaderOk<IOobject>(false);
|
||||||
|
|
||||||
oldFieldType = io.headerClassName();
|
if (!io.hasHeaderClass() || io.isHeaderClass<IOobject>())
|
||||||
|
|
||||||
if (oldFieldType == IOobject::typeName)
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Field " << fieldName << "(type: " << oldFieldType
|
<< "Field '" << fieldName
|
||||||
<< ") seems to be missing. Use 'create'" << nl
|
<< "' seems to be missing. Use 'create'" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
oldFieldType = io.headerClassName();
|
||||||
|
|
||||||
Info<< "Modify field: " << fieldName
|
Info<< "Modify field: " << fieldName
|
||||||
<< " (type " << oldFieldType << ')';
|
<< " (type: " << oldFieldType << ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -321,7 +321,7 @@ Foam::IOobject::IOobject
|
|||||||
sizeofScalar_(static_cast<unsigned char>(sizeof(scalar))),
|
sizeofScalar_(static_cast<unsigned char>(sizeof(scalar))),
|
||||||
|
|
||||||
name_(name),
|
name_(name),
|
||||||
headerClassName_(typeName),
|
headerClassName_(),
|
||||||
note_(),
|
note_(),
|
||||||
instance_(instance),
|
instance_(instance),
|
||||||
local_(),
|
local_(),
|
||||||
@ -331,8 +331,7 @@ Foam::IOobject::IOobject
|
|||||||
if (objectRegistry::debug)
|
if (objectRegistry::debug)
|
||||||
{
|
{
|
||||||
InfoInFunction
|
InfoInFunction
|
||||||
<< "Constructing IOobject called " << name_
|
<< "Constructing IOobject: " << name_ << endl;
|
||||||
<< " of type " << headerClassName_ << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,7 +351,7 @@ Foam::IOobject::IOobject
|
|||||||
sizeofScalar_(static_cast<unsigned char>(sizeof(scalar))),
|
sizeofScalar_(static_cast<unsigned char>(sizeof(scalar))),
|
||||||
|
|
||||||
name_(name),
|
name_(name),
|
||||||
headerClassName_(typeName),
|
headerClassName_(),
|
||||||
note_(),
|
note_(),
|
||||||
instance_(instance),
|
instance_(instance),
|
||||||
local_(local),
|
local_(local),
|
||||||
@ -362,8 +361,7 @@ Foam::IOobject::IOobject
|
|||||||
if (objectRegistry::debug)
|
if (objectRegistry::debug)
|
||||||
{
|
{
|
||||||
InfoInFunction
|
InfoInFunction
|
||||||
<< "Constructing IOobject called " << name_
|
<< "Constructing IOobject: " << name_ << endl;
|
||||||
<< " of type " << headerClassName_ << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,7 +379,7 @@ Foam::IOobject::IOobject
|
|||||||
sizeofScalar_(static_cast<unsigned char>(sizeof(scalar))),
|
sizeofScalar_(static_cast<unsigned char>(sizeof(scalar))),
|
||||||
|
|
||||||
name_(),
|
name_(),
|
||||||
headerClassName_(typeName),
|
headerClassName_(),
|
||||||
note_(),
|
note_(),
|
||||||
instance_(),
|
instance_(),
|
||||||
local_(),
|
local_(),
|
||||||
@ -398,8 +396,7 @@ Foam::IOobject::IOobject
|
|||||||
if (objectRegistry::debug)
|
if (objectRegistry::debug)
|
||||||
{
|
{
|
||||||
InfoInFunction
|
InfoInFunction
|
||||||
<< "Constructing IOobject called " << name_
|
<< "Constructing IOobject: " << name_ << endl;
|
||||||
<< " of type " << headerClassName_ << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -120,6 +120,9 @@ bool Foam::IOobject::readHeader(dictionary& headerDict, Istream& is)
|
|||||||
|
|
||||||
writeHeader(Info);
|
writeHeader(Info);
|
||||||
|
|
||||||
|
// Mark as not read
|
||||||
|
headerClassName_.clear();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,9 @@ bool Foam::regIOobject::readHeaderOk
|
|||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
|
const bool oldParRun = Pstream::parRun(false);
|
||||||
isHeaderOk = headerOk();
|
isHeaderOk = headerOk();
|
||||||
|
Pstream::parRun(oldParRun);
|
||||||
}
|
}
|
||||||
Pstream::broadcast(isHeaderOk);
|
Pstream::broadcast(isHeaderOk);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user