ENH: improve findInstance handling for optional files

- previously would always return "constant" as the instance for
  an optional dir/file that wasn't found.
  However, this meant retesting to screen out false positives.
  Now support an additional parameter
      'bool constant_fallback = ...'
  to return "constant" or an empty word.

  The method signature changes slightly with a new optional bool
  parameter:

      //! Return \c "constant" instead of \c "" if the search failed
      const bool constant_fallback = true

ENH: code consolidation for findInstancePath

- relocate from Time to TimePaths and provide an additional static
  version that is reused in fileOperations

BUG: distributedTriSurfaceMesh:::findLocalInstance broken (#3135)

- was not checking the parent at all.

COMP: remove unused findInstancePath(const fileName&, ..) method
This commit is contained in:
Mark Olesen
2024-04-08 15:19:58 +02:00
parent 85771c8985
commit d578d48a4f
12 changed files with 197 additions and 180 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2023 OpenCFD Ltd.
Copyright (C) 2016-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -314,11 +314,7 @@ boundBox procBounds
{
fileName pointsInstance
(
procDb.findInstance
(
polyMesh::meshDir(regionName),
"points"
)
procDb.findInstance(polyMesh::meshDir(regionName), "points")
);
if (pointsInstance != procDb.timeName())
@ -343,11 +339,7 @@ boundBox procBounds
IOobject
(
"points",
procDb.findInstance
(
polyMesh::meshDir(regionName),
"points"
),
pointsInstance,
polyMesh::meshDir(regionName),
procDb,
IOobject::MUST_READ,