IOobject, regIOobject: rationalised handling of paths for global and local objects

now all path functions in 'IOobject' are either templated on the type or require a
'globalFile' argument to specify if the type is case global e.g. 'IOdictionary' or
decomposed in parallel, e.g. almost everything else.

The 'global()' and 'globalFile()' virtual functions are now in 'regIOobject'
abstract base-class and overridden as required by derived classes.  The path
functions using 'global()' and 'globalFile()' to differentiate between global
and processor local objects are now also in 'regIOobject' rather than 'IOobject'
to ensure the path returned is absolutely consistent with the type.

Unfortunately there is still potential for unexpected IO behaviour inconsistent
with the global/local nature of the type due to the 'fileOperation' classes
searching the processor directory for case global objects before searching the
case directory.  This approach appears to be a work-around for incomplete
integration with and rationalisation of 'IOobject' but with the changes above it
is no longer necessary.  Unfortunately this "up" searching is baked-in at a low
level and mixed-up with various complex ways to pick the processor directory
name out of the object path and will take some unravelling but this work will
undertaken as time allows.
This commit is contained in:
Henry Weller
2021-08-09 21:23:12 +01:00
parent a1c991d9f3
commit cc92330253
52 changed files with 313 additions and 255 deletions

View File

@ -195,26 +195,30 @@ int main(int argc, char *argv[])
{
if (dictIO.typeHeaderOk<IOdictionary>(true))
{
Info<< "Refining according to " << dictIO.path() << nl << endl;
Info<< "Refining according to "
<< dictIO.path(typeGlobalFile<IOdictionary>()) << nl << endl;
refineDict = IOdictionary(dictIO);
}
else
{
FatalErrorInFunction
<< "Cannot open specified refinement dictionary "
<< dictIO.path() << exit(FatalError);
<< dictIO.path(typeGlobalFile<IOdictionary>())
<< exit(FatalError);
}
}
else if (!refineAllCells)
{
if (dictIO.typeHeaderOk<IOdictionary>(true))
{
Info<< "Refining according to " << dictIO.path() << nl << endl;
Info<< "Refining according to "
<< dictIO.path(typeGlobalFile<IOdictionary>()) << nl << endl;
refineDict = IOdictionary(dictIO);
}
else
{
Info<< "Refinement dictionary " << dictIO.path() << " not found"
Info<< "Refinement dictionary "
<< dictIO.path(typeGlobalFile<IOdictionary>()) << " not found"
<< nl << endl;
}
}
@ -386,7 +390,7 @@ int main(int argc, char *argv[])
}
Info<< "Writing map from new to old cell to "
<< newToOld.localObjectPath() << nl << endl;
<< newToOld.relativeObjectPath() << nl << endl;
newToOld.write();

View File

@ -586,10 +586,9 @@ autoPtr<mapPolyMesh> createRegionMesh
false
);
Info<< "Testing:" << io.objectPath() << endl;
Info<< "Testing:" << io.objectPath<IOdictionary>() << endl;
if (!io.typeHeaderOk<IOdictionary>(true))
// if (!exists(io.objectPath()))
{
Info<< "Writing dummy " << regionName/io.name() << endl;
dictionary dummyDict;
@ -1393,7 +1392,7 @@ void writeCellToRegion(const fvMesh& mesh, const labelList& cellRegion)
cellToRegion.write();
Info<< "Writing region per cell file (for manual decomposition) to "
<< cellToRegion.localObjectPath() << nl << endl;
<< cellToRegion.relativeObjectPath() << nl << endl;
}
// Write for postprocessing
{
@ -1419,7 +1418,7 @@ void writeCellToRegion(const fvMesh& mesh, const labelList& cellRegion)
cellToRegion.write();
Info<< "Writing region per cell as volScalarField to "
<< cellToRegion.localObjectPath() << nl << endl;
<< cellToRegion.relativeObjectPath() << nl << endl;
}
}

View File

@ -116,7 +116,7 @@ void removeSet
if (objects.found(setName))
{
// Remove file
fileName object = objects[setName]->objectPath();
const fileName object = objects[setName]->objectPath(false);
Info<< "Removing file " << object << endl;
rm(object);
}