setFields: If field is not found in the current time directory look in "constant"

This commit is contained in:
Henry
2013-02-11 11:13:24 +00:00
parent acd5b1f089
commit b634d14068

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -54,6 +54,7 @@ bool setCellFieldType
word fieldName(fieldValueStream); word fieldName(fieldValueStream);
// Check the current time directory
IOobject fieldHeader IOobject fieldHeader
( (
fieldName, fieldName,
@ -62,6 +63,18 @@ bool setCellFieldType
IOobject::MUST_READ IOobject::MUST_READ
); );
// Check the "constant" directory
if (!fieldHeader.headerOk())
{
fieldHeader = IOobject
(
fieldName,
mesh.time().constant(),
mesh,
IOobject::MUST_READ
);
}
// Check field exists // Check field exists
if (fieldHeader.headerOk()) if (fieldHeader.headerOk())
{ {
@ -193,6 +206,7 @@ bool setFaceFieldType
word fieldName(fieldValueStream); word fieldName(fieldValueStream);
// Check the current time directory
IOobject fieldHeader IOobject fieldHeader
( (
fieldName, fieldName,
@ -201,6 +215,18 @@ bool setFaceFieldType
IOobject::MUST_READ IOobject::MUST_READ
); );
// Check the "constant" directory
if (!fieldHeader.headerOk())
{
fieldHeader = IOobject
(
fieldName,
mesh.time().constant(),
mesh,
IOobject::MUST_READ
);
}
// Check field exists // Check field exists
if (fieldHeader.headerOk()) if (fieldHeader.headerOk())
{ {