mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: make search of instances in IOobject::typeHeaderOk optional (issue #245)
- in specific cases it can be useful to suppress searching the instances. For example, if one only wishes to check if a "points" is available at the given time instance, without searching backwards through all times.
This commit is contained in:
@ -18,8 +18,10 @@ if (!fieldsToUse.found(fieldName))
|
||||
fieldName,
|
||||
timeDirs[n1].name(),
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
).typeHeaderOk<volScalarField>(false)
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false // no register
|
||||
).typeHeaderOk<volScalarField>(false, false)
|
||||
);
|
||||
|
||||
if (variableGood)
|
||||
|
||||
@ -7,8 +7,6 @@ if (timeDirs.size() > 1 && Pstream::master())
|
||||
// We already loaded a mesh (usually from constant).
|
||||
// See if any other "polyMesh/points" files exist too.
|
||||
|
||||
const fileName& baseDir = mesh.time().path();
|
||||
|
||||
Info<< "Search for moving mesh ... " << flush;
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
@ -17,7 +15,6 @@ if (timeDirs.size() > 1 && Pstream::master())
|
||||
meshMoving =
|
||||
(
|
||||
timeName != mesh.pointsInstance()
|
||||
&& isDir(baseDir/timeName/polyMesh::meshSubDir)
|
||||
&& IOobject
|
||||
(
|
||||
"points",
|
||||
@ -27,7 +24,7 @@ if (timeDirs.size() > 1 && Pstream::master())
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false // no register
|
||||
).typeHeaderOk<pointIOField>(true)
|
||||
).typeHeaderOk<pointIOField>(true, false)
|
||||
);
|
||||
|
||||
if (meshMoving)
|
||||
|
||||
@ -8,15 +8,12 @@ if (timeDirs.size() > 1 && Pstream::master())
|
||||
// We already loaded a mesh (usually from constant).
|
||||
// See if any other "polyMesh/points" files exist too.
|
||||
|
||||
const fileName& baseDir = mesh.time().path();
|
||||
|
||||
Info<< "Search for moving mesh ... " << flush;
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
meshMoving =
|
||||
(
|
||||
isDir(baseDir/timeDirs[timeI].name()/polyMesh::meshSubDir)
|
||||
&& IOobject
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
timeDirs[timeI].name(),
|
||||
@ -25,7 +22,7 @@ if (timeDirs.size() > 1 && Pstream::master())
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false // no register
|
||||
).typeHeaderOk<pointIOField>(true)
|
||||
).typeHeaderOk<pointIOField>(true, false)
|
||||
);
|
||||
|
||||
if (meshMoving)
|
||||
|
||||
@ -21,10 +21,10 @@
|
||||
runTime,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
false // no register
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
if (io.typeHeaderOk<IOdictionary>(true, false))
|
||||
{
|
||||
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||
IOdictionary timeObject(io);
|
||||
|
||||
@ -4,10 +4,13 @@
|
||||
"points",
|
||||
runTime.timeName(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false // no register
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<pointIOField>(true))
|
||||
if (io.typeHeaderOk<pointIOField>(true, false))
|
||||
{
|
||||
// Read new points
|
||||
io.readOpt() = IOobject::MUST_READ;
|
||||
|
||||
@ -1,27 +1,20 @@
|
||||
IOobject ioPoints
|
||||
(
|
||||
"points",
|
||||
runTime.timeName(),
|
||||
mesh.name(),
|
||||
mesh
|
||||
);
|
||||
|
||||
if (ioPoints.typeHeaderOk<pointIOField>(true))
|
||||
{
|
||||
Info<< "new points available" << endl;
|
||||
// Reading new points
|
||||
pointIOField newPoints
|
||||
IOobject io
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
runTime.timeName(),
|
||||
mesh.name(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
"points",
|
||||
runTime.timeName(),
|
||||
mesh.name(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false // no register
|
||||
);
|
||||
|
||||
mesh.movePoints(newPoints);
|
||||
if (io.typeHeaderOk<pointIOField>(true, false))
|
||||
{
|
||||
Info<< "new points available" << endl;
|
||||
// Read new points
|
||||
io.readOpt() = IOobject::MUST_READ;
|
||||
mesh.movePoints(pointIOField(io));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user