mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: questionable findInstance handling of constant (related to #1112)
- when searching for a file that may not actually exist, the short-cut optimization could lead to the 'constant' directory being ignored. STYLE: simplify logic in points0MotionSolver::points0IO
This commit is contained in:
committed by
Andrew Heather
parent
79bf4fafb6
commit
eaacf0a20a
@ -48,58 +48,29 @@ Foam::IOobject Foam::points0MotionSolver::points0IO(const polyMesh& mesh)
|
||||
IOobject::READ_IF_PRESENT
|
||||
);
|
||||
|
||||
if (instance != mesh.time().constant())
|
||||
IOobject io
|
||||
(
|
||||
"points0",
|
||||
instance,
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
|
||||
// If points0 are located in constant directory, verify their existence
|
||||
// or fallback to a copy of the original mesh points
|
||||
if
|
||||
(
|
||||
instance == mesh.time().constant()
|
||||
&& !io.typeHeaderOk<pointIOField>()
|
||||
)
|
||||
{
|
||||
// points0 written to a time folder
|
||||
|
||||
return
|
||||
IOobject
|
||||
(
|
||||
"points0",
|
||||
instance,
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
io.rename("points");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check that points0 are actually in constant directory
|
||||
|
||||
IOobject io
|
||||
(
|
||||
"points0",
|
||||
instance,
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<pointIOField>())
|
||||
{
|
||||
return io;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy of original mesh points
|
||||
|
||||
return
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
instance,
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
return io;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user