openfoam/applications/utilities/postProcessing/dataConversion/foamToEnsight/getTimeIndex.H
Mark Olesen b5435cc83e ENH: separate registry and revised file locations for finite-area
- The internal storage location of finite-area changes from being
  piggybacked on the polyMesh registry to a having its own dedicated
  registry:

  * allows a clearer separation of field types without name clashes.
  * prerequisite for supporting multiple finite-area regions (future)

Old Locations:
```
   0/Us
   constant/faMesh
   system/faMeshDefinition
   system/faSchemes
   system/faSolution
```

New Locations:
```
   0/finite-area/Us
   constant/finite-area/faMesh
   system/finite-area/faMeshDefinition  (or system/faMeshDefinition)
   system/finite-area/faSchemes
   system/finite-area/faSolution
```

NOTES:
    The new locations represent a hard change (breaking change) that
    is normally to be avoided, but seamless compatibility handling
    within the code was found to be unworkable.

    The `foamUpgradeFiniteArea` script provides assistance with migration.

    As a convenience, the system/faMeshDefinition location continues
    to be supported (may be deprecated in the future).
2024-04-19 17:20:09 +02:00

70 lines
1.9 KiB
C

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
Description
Read time index from ../uniform/time, but treat 0 and constant specially
or simply increment from the '-index' option if it was supplied
Note
Does a 'continue' out of the loop if not possible to obtain an index
\*---------------------------------------------------------------------------*/
label timeIndex = 0;
{
bool goodTimeIndex = true;
if (doConsecutive)
{
timeIndex = indexingNumber++;
}
else if
(
runTime.timeName() != runTime.constant()
&& runTime.timeName() != "0"
)
{
IOobject io
(
"time",
runTime.timeName(),
"uniform",
runTime,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
);
if (io.typeHeaderOk<IOdictionary>(true, false))
{
io.readOpt(IOobject::MUST_READ_IF_MODIFIED);
IOdictionary timeObject(io);
timeObject.readEntry("index", timeIndex);
}
else
{
goodTimeIndex = false;
Info<< "skip ... missing file: " << io.objectRelPath() << endl;
}
}
if (!goodTimeIndex)
{
continue;
}
}
// ************************************************************************* //