ENH: Updated oriented flag for backwards compatibility

This commit is contained in:
Andrew Heather
2017-06-29 13:37:08 +01:00
parent 2355f1aa38
commit 7ac88c13d9
2 changed files with 14 additions and 1 deletions

View File

@ -37,7 +37,15 @@ void Foam::DimensionedField<Type, GeoMesh>::readField
)
{
dimensions_.reset(dimensionSet(fieldDict.lookup("dimensions")));
oriented_.read(fieldDict);
// Note: oriented state may have already been set on construction
// - if so - do not reset by re-reading
// - required for backwards compatibility in case of restarting from
// an old run where the oriented state may not have been set
if (oriented_.oriented() != orientedType::ORIENTED)
{
oriented_.read(fieldDict);
}
Field<Type> f(fieldDictEntry, fieldDict, GeoMesh::size(mesh_));
this->transfer(f);

View File

@ -169,6 +169,11 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::readOldTimeIfPresent()
this->mesh()
);
// Ensure the old time field oriented flag is set to the parent's state
// Note: required for backwards compatibility in case of restarting from
// an old run where the oriented state may not have been set
field0Ptr_->oriented() = this->oriented();
field0Ptr_->timeIndex_ = timeIndex_ - 1;
if (!field0Ptr_->readOldTimeIfPresent())