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).
This commit is contained in:
Mark Olesen
2024-04-17 14:27:25 +02:00
parent 1d5b95b5fe
commit b5435cc83e
35 changed files with 1812 additions and 350 deletions

View File

@ -173,7 +173,7 @@ namespace Foam
// Uses polyMesh/fvMesh meshSubDir by default
autoPtr<labelIOList> procAddressing
(
const fvMesh& procMesh,
const objectRegistry& procRegistry,
const word& name,
const word& instance,
const word& local = fvMesh::meshSubDir
@ -186,7 +186,7 @@ autoPtr<labelIOList> procAddressing
name,
instance,
local,
procMesh,
procRegistry,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
@ -199,13 +199,13 @@ autoPtr<labelIOList> procAddressing
// Uses the finiteArea meshSubDir
autoPtr<labelIOList> faProcAddressing
(
const fvMesh& procMesh,
const objectRegistry& procRegistry,
const word& name,
const word& instance,
const word& local = faMesh::meshSubDir
)
{
return procAddressing(procMesh, name, instance, local);
return procAddressing(procRegistry, name, instance, local);
}
@ -797,11 +797,22 @@ int main(int argc, char *argv[])
// Field objects at this time
IOobjectList objects;
IOobjectList faObjects;
if (doDecompFields)
{
// List of volume mesh objects for this instance
objects = IOobjectList(mesh, runTime.timeName());
// List of area mesh objects (assuming single region)
faObjects = IOobjectList
(
mesh.time(),
runTime.timeName(),
faMesh::dbDir(mesh, word::null),
IOobjectOption::NO_REGISTER
);
// Ignore generated fields: (cellDist)
objects.remove("cellDist");
}
@ -810,12 +821,15 @@ int main(int argc, char *argv[])
autoPtr<faMeshDecomposition> faMeshDecompPtr;
if (doFiniteArea)
{
const word boundaryInst =
mesh.time().findInstance(mesh.meshDir(), "boundary");
IOobject io
(
"faBoundary",
mesh.time().findInstance(mesh.meshDir(), "boundary"),
faMesh::meshSubDir,
mesh,
boundaryInst,
faMesh::meshDir(mesh, word::null),
mesh.time(),
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
@ -1225,7 +1239,7 @@ int main(int argc, char *argv[])
if (doDecompFields)
{
areaFieldCache.readAllFields(aMesh, objects);
areaFieldCache.readAllFields(aMesh, faObjects);
}
const label nAreaFields = areaFieldCache.size();
@ -1293,7 +1307,7 @@ int main(int argc, char *argv[])
autoPtr<labelIOList> tfaceProcAddr =
faProcAddressing
(
procFvMesh,
procMesh,
"faceProcAddressing",
runTime.constant()
);
@ -1302,7 +1316,7 @@ int main(int argc, char *argv[])
autoPtr<labelIOList> tboundaryProcAddr =
faProcAddressing
(
procFvMesh,
procMesh,
"boundaryProcAddressing",
runTime.constant()
);
@ -1311,7 +1325,7 @@ int main(int argc, char *argv[])
autoPtr<labelIOList> tedgeProcAddr =
faProcAddressing
(
procFvMesh,
procMesh,
"edgeProcAddressing",
runTime.constant()
);