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

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -758,7 +758,7 @@ int main(int argc, char *argv[])
if (maxLevel > 0) if (maxLevel > 0)
{ {
Info<< "Read existing refinement level from file " Info<< "Read existing refinement level from file "
<< refLevel.localObjectPath() << nl << refLevel.relativeObjectPath() << nl
<< " min level : " << min(refLevel) << nl << " min level : " << min(refLevel) << nl
<< " max level : " << maxLevel << nl << " max level : " << maxLevel << nl
<< endl; << endl;
@ -766,7 +766,7 @@ int main(int argc, char *argv[])
else else
{ {
Info<< "Created zero refinement level in file " Info<< "Created zero refinement level in file "
<< refLevel.localObjectPath() << nl << refLevel.relativeObjectPath() << nl
<< endl; << endl;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -143,7 +143,7 @@ int main(int argc, char *argv[])
const cellSet cellsToRefine(mesh, setName); const cellSet cellsToRefine(mesh, setName);
Info<< " Read " << cellsToRefine.size() Info<< " Read " << cellsToRefine.size()
<< " cells from cellSet " << cellsToRefine.localObjectPath() << " cells from cellSet " << cellsToRefine.relativeObjectPath()
<< nl << endl; << nl << endl;
forAllIter(labelHashSet, cutCells, iter) forAllIter(labelHashSet, cutCells, iter)

View File

@ -1103,7 +1103,7 @@ int main(int argc, char *argv[])
} }
Info<< "Writing mesh to " << mesh.objectRegistry::localObjectPath() Info<< "Writing mesh to " << mesh.objectRegistry::relativeObjectPath()
<< "..." << nl << endl; << "..." << nl << endl;
@ -1148,7 +1148,7 @@ int main(int argc, char *argv[])
} }
Info<< "Writing cellIds as volScalarField to " Info<< "Writing cellIds as volScalarField to "
<< cellIdField.localObjectPath() << "..." << nl << endl; << cellIdField.relativeObjectPath() << "..." << nl << endl;
mesh.write(); mesh.write();
Info<< "End\n" << endl; Info<< "End\n" << endl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -1478,7 +1478,7 @@ int main(int argc, char *argv[])
// Set the precision of the points data to 10 // Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
Info<< nl << "Writing mesh to " << mesh.localObjectPath() << endl; Info<< nl << "Writing mesh to " << mesh.relativeObjectPath() << endl;
mesh.write(); mesh.write();

View File

@ -154,13 +154,13 @@ int main(int argc, char *argv[])
if (!meshDictIO.typeHeaderOk<IOdictionary>(true)) if (!meshDictIO.typeHeaderOk<IOdictionary>(true))
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Cannot find file " << meshDictIO.localObjectPath() << "Cannot find file " << meshDictIO.relativeObjectPath()
<< nl << nl
<< exit(FatalError); << exit(FatalError);
} }
Info<< "Creating block mesh from\n " Info<< "Creating block mesh from\n "
<< meshDictIO.localObjectPath() << endl; << meshDictIO.relativeObjectPath() << endl;
IOdictionary meshDict(meshDictIO); IOdictionary meshDict(meshDictIO);
blockMesh blocks(meshDict, regionName); blockMesh blocks(meshDict, regionName);

View File

@ -95,7 +95,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
false false
); );
Info<< "Testing:" << io.objectPath() << endl; Info<< "Testing:" << io.objectPath<IOdictionary>() << endl;
if (!io.typeHeaderOk<IOdictionary>(false)) if (!io.typeHeaderOk<IOdictionary>(false))
{ {
@ -1028,7 +1028,7 @@ int main(int argc, char *argv[])
} }
mesh.setInstance(runTimeExtruded.constant()); mesh.setInstance(runTimeExtruded.constant());
Info<< "Writing mesh to " << mesh.localObjectPath() << nl << endl; Info<< "Writing mesh to " << mesh.relativeObjectPath() << nl << endl;
if (!mesh.write()) if (!mesh.write())
{ {

View File

@ -353,7 +353,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
false false
); );
Info<< "Testing:" << io.objectPath() << endl; Info<< "Testing:" << io.objectPath<IOdictionary>() << endl;
if (!io.typeHeaderOk<IOdictionary>(true)) if (!io.typeHeaderOk<IOdictionary>(true))
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -316,7 +316,7 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
// } // }
// //
// Info<< "Writing map from tetDualMesh points to Voronoi mesh to " // Info<< "Writing map from tetDualMesh points to Voronoi mesh to "
// << pointDualAddressing.localObjectPath() << endl; // << pointDualAddressing.relativeObjectPath() << endl;
// pointDualAddressing.write(); // pointDualAddressing.write();
// //
// //
@ -370,7 +370,7 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
// } // }
// //
// Info<< "Writing tetDualMesh points mapped onto Voronoi mesh to " // Info<< "Writing tetDualMesh points mapped onto Voronoi mesh to "
// << dualPoints.localObjectPath() << endl // << dualPoints.relativeObjectPath() << endl
// << "Replace the polyMesh/points with these." << endl; // << "Replace the polyMesh/points with these." << endl;
// dualPoints.write(); // dualPoints.write();
// } // }

View File

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

View File

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

View File

@ -432,13 +432,13 @@ int main(int argc, char *argv[])
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
dictIO.objectPath() dictIO.objectPath<domainDecomposition>()
); );
// Decompose the mesh // Decompose the mesh
if (!decomposeFieldsOnly) if (!decomposeFieldsOnly)
{ {
mesh.decomposeMesh(dictIO.objectPath()); mesh.decomposeMesh(dictIO.objectPath<domainDecomposition>());
mesh.writeDecomposition(decomposeSets); mesh.writeDecomposition(decomposeSets);
@ -464,7 +464,7 @@ int main(int argc, char *argv[])
cellDecomposition.write(); cellDecomposition.write();
Info<< nl << "Wrote decomposition to " Info<< nl << "Wrote decomposition to "
<< cellDecomposition.localObjectPath() << cellDecomposition.relativeObjectPath()
<< " for use in manual decomposition." << endl; << " for use in manual decomposition." << endl;
// Write as volScalarField for postprocessing. // Write as volScalarField for postprocessing.

View File

@ -187,7 +187,7 @@ void writeCellDistribution
cellDecomposition.write(); cellDecomposition.write();
Info<< nl << "Wrote decomposition to " Info<< nl << "Wrote decomposition to "
<< cellDecomposition.localObjectPath() << cellDecomposition.relativeObjectPath()
<< " for use in manual decomposition." << endl; << " for use in manual decomposition." << endl;

View File

@ -33,7 +33,8 @@
} }
else else
{ {
Info<< "skip ... missing entry " << io.objectPath() << endl; Info<< "skip ... missing entry "
<< io.objectPath<IOdictionary>() << endl;
continue; continue;
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -190,7 +190,7 @@ int main(int argc, char *argv[])
FatalErrorInFunction FatalErrorInFunction
<< "Size " << pointDualAddressing.size() << "Size " << pointDualAddressing.size()
<< " of addressing map " << " of addressing map "
<< pointDualAddressing.localObjectPath() << pointDualAddressing.relativeObjectPath()
<< " differs from number of points in mesh " << " differs from number of points in mesh "
<< tetDualMesh.nPoints() << tetDualMesh.nPoints()
<< exit(FatalError); << exit(FatalError);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -120,7 +120,7 @@ void Foam::vtkPVFoam::convertFields(vtkMultiBlockDataSet* output)
forAllConstIter(IOobjectList, objects, iter) forAllConstIter(IOobjectList, objects, iter)
{ {
Info<< " " << iter()->name() Info<< " " << iter()->name()
<< " == " << iter()->objectPath() << nl; << " == " << iter()->objectPath<volScalarField>() << nl;
} }
printMemory(); printMemory();
} }
@ -266,7 +266,7 @@ void Foam::vtkPVFoam::convertLagrangianFields(vtkMultiBlockDataSet* output)
forAllConstIter(IOobjectList, objects, iter) forAllConstIter(IOobjectList, objects, iter)
{ {
Info<< " " << iter()->name() Info<< " " << iter()->name()
<< " == " << iter()->objectPath() << nl; << " == " << iter()->objectPath(false) << nl;
} }
} }

View File

@ -658,10 +658,10 @@ int main(int argc, char *argv[])
// Read dictionary. (disable class type checking so we can load // Read dictionary. (disable class type checking so we can load
// field) // field)
Info<< "Loading dictionary " << fieldName << endl; Info<< "Loading dictionary " << fieldName << endl;
const word oldTypeName = IOdictionary::typeName; const word oldTypeName = localIOdictionary::typeName;
const_cast<word&>(IOdictionary::typeName) = word::null; const_cast<word&>(localIOdictionary::typeName) = word::null;
IOdictionary fieldDict localIOdictionary fieldDict
( (
IOobject IOobject
( (
@ -674,7 +674,7 @@ int main(int argc, char *argv[])
) )
); );
const_cast<word&>(IOdictionary::typeName) = oldTypeName; const_cast<word&>(localIOdictionary::typeName) = oldTypeName;
// Fake type back to what was in field // Fake type back to what was in field
const_cast<word&>(fieldDict.type()) = const_cast<word&>(fieldDict.type()) =

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,7 +41,7 @@ void UnMapped(const IOobjectList& objects)
forAllConstIter(IOobjectList, fields, fieldIter) forAllConstIter(IOobjectList, fields, fieldIter)
{ {
mvBak(fieldIter()->objectPath(), "unmapped"); mvBak(fieldIter()->objectPath<Type>(), "unmapped");
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,7 +41,7 @@ void UnMapped(const IOobjectList& objects)
forAllConstIter(IOobjectList, fields, fieldIter) forAllConstIter(IOobjectList, fields, fieldIter)
{ {
mvBak(fieldIter()->objectPath(), "unmapped"); mvBak(fieldIter()->objectPath<Type>(), "unmapped");
} }
} }

View File

@ -793,7 +793,7 @@ int main(int argc, char *argv[])
); );
Info<< nl << "Writing featureEdgeMesh to " Info<< nl << "Writing featureEdgeMesh to "
<< bfeMesh.localObjectPath() << endl; << bfeMesh.relativeObjectPath() << endl;
bfeMesh.regIOobject::write(); bfeMesh.regIOobject::write();
} }

View File

@ -389,7 +389,7 @@ namespace Foam
feMesh.writeStats(Info); feMesh.writeStats(Info);
Info<< nl << "Writing extendedFeatureEdgeMesh to " Info<< nl << "Writing extendedFeatureEdgeMesh to "
<< feMesh.localObjectPath() << endl; << feMesh.relativeObjectPath() << endl;
mkDir(feMesh.path()); mkDir(feMesh.path());
@ -422,7 +422,7 @@ namespace Foam
); );
Info<< nl << "Writing featureEdgeMesh to " Info<< nl << "Writing featureEdgeMesh to "
<< bfeMesh.localObjectPath() << endl; << bfeMesh.relativeObjectPath() << endl;
bfeMesh.regIOobject::write(); bfeMesh.regIOobject::write();

View File

@ -338,7 +338,7 @@ int main(int argc, char *argv[])
); );
Info<< "writing surfMesh as well: " Info<< "writing surfMesh as well: "
<< surfOut.localObjectPath() << endl; << surfOut.relativeObjectPath() << endl;
surfOut.write(); surfOut.write();
surfLabelField zoneIds surfLabelField zoneIds
@ -368,7 +368,7 @@ int main(int argc, char *argv[])
Info<< "writing surfMesh again well: " Info<< "writing surfMesh again well: "
<< surfOut.localObjectPath() << surfOut.relativeObjectPath()
<< endl; << endl;
surfOut.write(); surfOut.write();
@ -388,7 +388,7 @@ int main(int argc, char *argv[])
} }
Info<< "write zoneIds (for testing only): " Info<< "write zoneIds (for testing only): "
<< zoneIds.localObjectPath() << endl; << zoneIds.relativeObjectPath() << endl;
zoneIds.write(); zoneIds.write();
surfPointLabelField pointIds surfPointLabelField pointIds
@ -411,7 +411,7 @@ int main(int argc, char *argv[])
} }
Info<< "write pointIds (for testing only): " Info<< "write pointIds (for testing only): "
<< pointIds.localObjectPath() << endl; << pointIds.relativeObjectPath() << endl;
pointIds.write(); pointIds.write();
Info<<"surfMesh with these names: " << surfOut.names() << endl; Info<<"surfMesh with these names: " << surfOut.names() << endl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -160,7 +160,7 @@ int main(int argc, char *argv[])
) )
); );
Info<< "read surfMesh:\n " << smesh.localObjectPath() << endl; Info<< "read surfMesh:\n " << smesh.relativeObjectPath() << endl;
// Simply copy for now, but really should have a separate write method // Simply copy for now, but really should have a separate write method

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -209,7 +209,7 @@ int main(int argc, char *argv[])
); );
Info<< "writing surfMesh:\n " << smesh.localObjectPath() << endl; Info<< "writing surfMesh:\n " << smesh.relativeObjectPath() << endl;
smesh.write(); smesh.write();
Info<< "\nEnd\n" << endl; Info<< "\nEnd\n" << endl;

View File

@ -171,7 +171,7 @@ int main(int argc, char *argv[])
fileName localPath(actualPath); fileName localPath(actualPath);
localPath.replace(runTime.rootPath() + '/', ""); localPath.replace(runTime.rootPath() + '/', "");
if (actualPath == io.objectPath()) if (actualPath == io.objectPath(false))
{ {
Info<< "Loading local (decomposed) surface " << localPath << nl <<endl; Info<< "Loading local (decomposed) surface " << localPath << nl <<endl;
} }

View File

@ -333,27 +333,15 @@ Foam::word Foam::IOobject::member() const
} }
bool Foam::IOobject::global() const
{
return false;
}
bool Foam::IOobject::globalFile() const
{
return global();
}
const Foam::fileName& Foam::IOobject::rootPath() const const Foam::fileName& Foam::IOobject::rootPath() const
{ {
return time().rootPath(); return time().rootPath();
} }
const Foam::fileName& Foam::IOobject::caseName() const const Foam::fileName& Foam::IOobject::caseName(const bool global) const
{ {
if (globalFile()) if (global)
{ {
return time().globalCaseName(); return time().globalCaseName();
} }
@ -365,10 +353,17 @@ const Foam::fileName& Foam::IOobject::caseName() const
Foam::fileName& Foam::IOobject::instance() const Foam::fileName& Foam::IOobject::instance() const
{
return instance_;
}
void Foam::IOobject::updateInstance() const
{ {
if if
( (
instance_ != time().system() !instance_.isAbsolute()
&& instance_ != time().system()
&& instance_ != time().constant() && instance_ != time().constant()
&& instance_ != time().timeName() && instance_ != time().timeName()
) )
@ -379,36 +374,23 @@ Foam::fileName& Foam::IOobject::instance() const
instance_ = time().timeName(); instance_ = time().timeName();
} }
} }
return instance_;
} }
Foam::fileName Foam::IOobject::path() const Foam::fileName Foam::IOobject::path(const bool global) const
{ {
if (instance().isAbsolute()) if (instance_.isAbsolute())
{ {
return instance(); return instance_;
} }
else else
{ {
return rootPath()/caseName()/instance()/db_.dbDir()/local(); return rootPath()/caseName(global)/instance()/db_.dbDir()/local();
} }
} }
Foam::fileName Foam::IOobject::path Foam::fileName Foam::IOobject::relativePath() const
(
const word& instance,
const fileName& local
) const
{
// Note: can only be called with relative instance since is word type
return rootPath()/caseName()/instance/db_.dbDir()/local;
}
Foam::fileName Foam::IOobject::localPath() const
{ {
if (instance().isAbsolute()) if (instance().isAbsolute())
{ {
@ -424,10 +406,10 @@ Foam::fileName Foam::IOobject::localPath() const
Foam::fileName Foam::IOobject::filePath Foam::fileName Foam::IOobject::filePath
( (
const word& typeName, const word& typeName,
const bool isGlobal const bool global
) const ) const
{ {
return fileHandler().filePath(isGlobal, *this, typeName); return fileHandler().filePath(global, *this, typeName);
} }

View File

@ -384,61 +384,53 @@ public:
// as <model>:<name> // as <model>:<name>
inline word modelName(const char* name) const; inline word modelName(const char* name) const;
//- Return true if object is global, i.e. same for all processors
// Defaults to false, must be overridden by global IO classes
virtual bool global() const;
//- Return true if object is global, i.e. same for all processors
// and written to the global case directory,
// i.e. not the processor time directory
// Defaults to global()
virtual bool globalFile() const;
const fileName& rootPath() const; const fileName& rootPath() const;
const fileName& caseName() const; const fileName& caseName(const bool global) const;
//- Return the instance directory, constant, system, <time> etc. //- Return the instance directory, constant, system, <time> etc.
// If the instance is a time directory it is updated to the // Allows modification of the instance
// current time before return
fileName& instance() const; fileName& instance() const;
//- If the instance is a time directory update to the current time
void updateInstance() const;
const fileName& local() const const fileName& local() const
{ {
return local_; return local_;
} }
//- Return complete path //- Return complete path including the processor sub-directory
fileName path() const; // for a parallel run if global is set false
fileName path(const bool global) const;
//- Return complete path with alternative instance and local //- Return complete path + object name including the processor
fileName path // sub-directory for a parallel run if global is set false
( fileName objectPath(const bool global) const
const word& instance,
const fileName& local = ""
) const;
//- Return the path relative to the case
fileName localPath() const;
//- Return complete path + object name
fileName objectPath() const
{ {
return path()/name(); return path(global)/name();
} }
//- Return complete localPath + object name //- Return complete path + object name including the processor
fileName localObjectPath() const // sub-directory for a parallel run if globalFile is false for Type
template<class Type>
inline fileName objectPath() const;
//- Return the path relative to the case directory
fileName relativePath() const;
//- Return complete relativePath + object name
fileName relativeObjectPath() const
{ {
return localPath()/name(); return relativePath()/name();
} }
//- Return complete path + object name if the file exists //- Return complete path + object name if the file exists
// in the case directory otherwise null. // in the case directory otherwise null.
// //
// If isGlobal and parallel searches up into the global case // If global and parallel searches up into the global case
// directory. // directory.
fileName filePath(const word& typeName, const bool isGlobal) const; fileName filePath(const word& typeName, const bool global) const;
// Reading // Reading
@ -455,6 +447,7 @@ public:
template<class Type> template<class Type>
void warnNoRereading() const; void warnNoRereading() const;
// Writing // Writing
//- Write the standard OpenFOAM file/dictionary banner //- Write the standard OpenFOAM file/dictionary banner
@ -510,24 +503,30 @@ template<>
Ostream& operator<<(Ostream& os, const InfoProxy<IOobject>& ip); Ostream& operator<<(Ostream& os, const InfoProxy<IOobject>& ip);
//- Template function for obtaining global status //- Template function for obtaining global status
template<class T> template<class Type>
inline bool typeGlobal() inline bool typeGlobal()
{ {
return false; return false;
} }
//- Template function for obtaining global write status //- Template function for obtaining global write status
template<class T> template<class Type>
inline bool typeGlobalFile() inline bool typeGlobalFile()
{ {
return typeGlobal<T>(); return typeGlobal<Type>();
} }
//- Template function for obtaining filePath //- Template function for obtaining filePath
template<class T> template<class Type>
inline fileName typeFilePath(const IOobject& io) inline fileName typeFilePath(const IOobject& io)
{ {
return io.filePath(T::typeName, typeGlobalFile<T>()); return io.filePath(Type::typeName, typeGlobalFile<Type>());
}
template<class Type>
inline fileName IOobject::objectPath() const
{
return objectPath(typeGlobalFile<Type>());
} }
inline IOobject unregister(const IOobject& io) inline IOobject unregister(const IOobject& io)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -39,7 +39,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const InfoProxy<IOobject>& ip)
<< "local:" << token::SPACE << io.local() << token::SPACE << "local:" << token::SPACE << io.local() << token::SPACE
<< "readOpt:" << token::SPACE << io.readOpt() << token::SPACE << "readOpt:" << token::SPACE << io.readOpt() << token::SPACE
<< "writeOpt:" << token::SPACE << io.writeOpt() << token::SPACE << "writeOpt:" << token::SPACE << io.writeOpt() << token::SPACE
<< io.path() << endl; << io.path(false) << endl;
return os; return os;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -51,7 +51,7 @@ Foam::IOdictionary::IOdictionary
: :
regIOobject(io) regIOobject(io)
{ {
dictionary::name() = IOobject::objectPath(); dictionary::name() = regIOobject::objectPath();
// Reading performed by derived type // Reading performed by derived type
} }
@ -61,7 +61,7 @@ Foam::IOdictionary::IOdictionary(const IOobject& io)
: :
regIOobject(io) regIOobject(io)
{ {
dictionary::name() = IOobject::objectPath(); dictionary::name() = regIOobject::objectPath();
readHeaderOk(IOstream::ASCII, typeName); readHeaderOk(IOstream::ASCII, typeName);
@ -78,7 +78,7 @@ Foam::IOdictionary::IOdictionary
: :
regIOobject(io) regIOobject(io)
{ {
dictionary::name() = IOobject::objectPath(); dictionary::name() = regIOobject::objectPath();
if (!readHeaderOk(IOstream::ASCII, typeName)) if (!readHeaderOk(IOstream::ASCII, typeName))
{ {
@ -98,7 +98,7 @@ Foam::IOdictionary::IOdictionary
: :
regIOobject(io) regIOobject(io)
{ {
dictionary::name() = IOobject::objectPath(); dictionary::name() = regIOobject::objectPath();
// Note that we do construct the dictionary null and read in // Note that we do construct the dictionary null and read in
// afterwards // afterwards

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -150,6 +150,16 @@ Foam::objectRegistry::~objectRegistry()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::fileName Foam::objectRegistry::path
(
const word& instance,
const fileName& local
) const
{
// Note: can only be called with relative instance since is word type
return rootPath()/caseName()/instance/dbDir()/local;
}
Foam::wordList Foam::objectRegistry::names() const Foam::wordList Foam::objectRegistry::names() const
{ {
return HashTable<regIOobject*>::toc(); return HashTable<regIOobject*>::toc();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -148,6 +148,15 @@ public:
return dbDir_; return dbDir_;
} }
using regIOobject::path;
//- Return complete path with alternative instance and local
fileName path
(
const word& instance,
const fileName& local = ""
) const;
//- Return the list of names of the IOobjects //- Return the list of names of the IOobjects
wordList names() const; wordList names() const;

View File

@ -138,7 +138,8 @@ Foam::regIOobject::~regIOobject()
if (this == &db()) if (this == &db())
{ {
Pout<< "Destroying objectRegistry " << name() Pout<< "Destroying objectRegistry " << name()
<< " in directory " << rootPath()/caseName()/instance() << " in directory "
<< rootPath()/caseName()/instance()
<< endl; << endl;
} }
else else
@ -161,6 +162,30 @@ Foam::regIOobject::~regIOobject()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::regIOobject::global() const
{
return false;
}
bool Foam::regIOobject::globalFile() const
{
return global();
}
const Foam::fileName& Foam::regIOobject::caseName() const
{
return IOobject::caseName(globalFile());
}
Foam::fileName Foam::regIOobject::path() const
{
return IOobject::path(globalFile());
}
bool Foam::regIOobject::checkIn() bool Foam::regIOobject::checkIn()
{ {
if (!registered_) if (!registered_)

View File

@ -129,6 +129,45 @@ public:
// Member Functions // Member Functions
// Path components
//- Return true if object is global, i.e. same for all processors
// Defaults to false, must be overridden by global IO classes
virtual bool global() const;
//- Return true if object is global, i.e. same for all processors
// and written to the global case directory,
// i.e. not the processor time directory
// Defaults to global()
virtual bool globalFile() const;
using IOobject::caseName;
const fileName& caseName() const;
using IOobject::path;
//- Return complete path
fileName path() const;
using IOobject::objectPath;
//- Return complete path + object name
fileName objectPath() const
{
return path()/name();
}
using IOobject::filePath;
//- Return complete path + object name if the file exists
// in the case directory otherwise null.
//
// For global objects in parallel searches up into the global
// case directory
fileName filePath() const;
// Registration // Registration
//- Add object to registry //- Add object to registry
@ -211,15 +250,6 @@ public:
// Reading // Reading
using IOobject::filePath;
//- Return complete path + object name if the file exists
// in the case directory otherwise null.
//
// For global objects in parallel searches up into the global
// case directory
fileName filePath() const;
//- Read and check header info //- Read and check header info
bool headerOk(); bool headerOk();

View File

@ -50,14 +50,8 @@ bool Foam::regIOobject::writeObject
return false; return false;
} }
if (instance().empty()) // If the instance is a time directory update to the current time
{ updateInstance();
SeriousErrorInFunction
<< "instance undefined for object " << name()
<< endl;
return false;
}
// Write global objects on master only // Write global objects on master only
// Everyone check or just master // Everyone check or just master

View File

@ -423,7 +423,7 @@ Foam::fileName Foam::fileOperations::collatedFileOperation::objectPath
// Replacement for objectPath // Replacement for objectPath
if (io.time().processorCase()) if (io.time().processorCase())
{ {
return masterUncollatedFileOperation::localObjectPath return masterUncollatedFileOperation::relativeObjectPath
( (
io, io,
fileOperation::PROCOBJECT, fileOperation::PROCOBJECT,
@ -433,7 +433,7 @@ Foam::fileName Foam::fileOperations::collatedFileOperation::objectPath
} }
else else
{ {
return masterUncollatedFileOperation::localObjectPath return masterUncollatedFileOperation::relativeObjectPath
( (
io, io,
fileOperation::OBJECT, fileOperation::OBJECT,
@ -693,7 +693,7 @@ Foam::word Foam::fileOperations::collatedFileOperation::processorsDir
const IOobject& io const IOobject& io
) const ) const
{ {
return processorsDir(io.objectPath()); return processorsDir(io.objectPath(false));
} }

View File

@ -379,7 +379,7 @@ bool Foam::fileOperation::exists(IOobject& io) const
{ {
// Re-test with searched for objectPath. This is for backwards // Re-test with searched for objectPath. This is for backwards
// compatibility // compatibility
fileName originalPath(filePath(io.objectPath())); fileName originalPath(filePath(io.objectPath(false)));
if (originalPath != objPath) if (originalPath != objPath)
{ {
// Test for either directory or a (valid) file & IOobject // Test for either directory or a (valid) file & IOobject
@ -445,7 +445,7 @@ Foam::fileName Foam::fileOperation::objectPath
const word& typeName const word& typeName
) const ) const
{ {
return io.objectPath(); return io.objectPath(false);
} }
@ -890,7 +890,7 @@ Foam::fileNameList Foam::fileOperation::readObjects
<< " instance:" << instance << endl; << " instance:" << instance << endl;
} }
fileName path(db.path(instance, db.dbDir()/local)); fileName path(db.path(instance, local));
newInstance = word::null; newInstance = word::null;
fileNameList objectNames; fileNameList objectNames;
@ -911,6 +911,7 @@ Foam::fileNameList Foam::fileOperation::readObjects
objectNames = Foam::readDir(procsPath, fileType::file); objectNames = Foam::readDir(procsPath, fileType::file);
} }
} }
return objectNames; return objectNames;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -322,20 +322,20 @@ public:
const word& typeName const word& typeName
) const; ) const;
//- Search for an object. checkGlobal : also check undecomposed case //- Search for an object. globalFile : also check undecomposed case
// Optional wanted typeName. // Optional wanted typeName.
virtual fileName filePath virtual fileName filePath
( (
const bool checkGlobal, const bool globalFile,
const IOobject&, const IOobject&,
const word& typeName const word& typeName
) const = 0; ) const = 0;
//- Search for a directory. checkGlobal : also check undecomposed //- Search for a directory. globalFile : also check undecomposed
// case // case
virtual fileName dirPath virtual fileName dirPath
( (
const bool checkGlobal, const bool globalFile,
const IOobject& const IOobject&
) const = 0; ) const = 0;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -145,7 +145,7 @@ Foam::fileOperations::masterUncollatedFileOperation::findInstancePath
Foam::fileName Foam::fileName
Foam::fileOperations::masterUncollatedFileOperation::filePathInfo Foam::fileOperations::masterUncollatedFileOperation::filePathInfo
( (
const bool checkGlobal, const bool globalFile,
const bool isFile, const bool isFile,
const IOobject& io, const IOobject& io,
pathType& searchType, pathType& searchType,
@ -185,7 +185,10 @@ Foam::fileOperations::masterUncollatedFileOperation::filePathInfo
// 2. Check processors/ // 2. Check processors/
if (io.time().processorCase()) if (io.time().processorCase())
{ {
tmpNrc<dirIndexList> pDirs(lookupProcessorsPath(io.objectPath())); tmpNrc<dirIndexList> pDirs
(
lookupProcessorsPath(io.objectPath(globalFile))
);
forAll(pDirs(), i) forAll(pDirs(), i)
{ {
const fileName& pDir = pDirs()[i].first(); const fileName& pDir = pDirs()[i].first();
@ -202,7 +205,7 @@ Foam::fileOperations::masterUncollatedFileOperation::filePathInfo
} }
{ {
// 3. Check local // 3. Check local
fileName localPath = io.objectPath(); fileName localPath = io.objectPath(globalFile);
if if
( (
@ -220,7 +223,7 @@ Foam::fileOperations::masterUncollatedFileOperation::filePathInfo
// Any global checks // Any global checks
if if
( (
checkGlobal globalFile
&& io.time().processorCase() && io.time().processorCase()
&& ( && (
io.instance() == io.time().system() io.instance() == io.time().system()
@ -261,7 +264,7 @@ Foam::fileOperations::masterUncollatedFileOperation::filePathInfo
// 1. Try processors equivalent // 1. Try processors equivalent
tmpNrc<dirIndexList> pDirs tmpNrc<dirIndexList> pDirs
( (
lookupProcessorsPath(io.objectPath()) lookupProcessorsPath(io.objectPath(globalFile))
); );
forAll(pDirs(), i) forAll(pDirs(), i)
{ {
@ -304,7 +307,7 @@ Foam::fileOperations::masterUncollatedFileOperation::filePathInfo
// 2. Check local // 2. Check local
fileName fName fileName fName
( (
io.rootPath()/io.caseName() io.rootPath()/io.caseName(false)
/newInstancePath/io.db().dbDir()/io.local()/io.name() /newInstancePath/io.db().dbDir()/io.local()/io.name()
); );
if (isFileOrDir(isFile, fName)) if (isFileOrDir(isFile, fName))
@ -322,7 +325,7 @@ Foam::fileOperations::masterUncollatedFileOperation::filePathInfo
Foam::fileName Foam::fileName
Foam::fileOperations::masterUncollatedFileOperation::localObjectPath Foam::fileOperations::masterUncollatedFileOperation::relativeObjectPath
( (
const IOobject& io, const IOobject& io,
const pathType& searchType, const pathType& searchType,
@ -342,7 +345,7 @@ Foam::fileOperations::masterUncollatedFileOperation::localObjectPath
case fileOperation::OBJECT: case fileOperation::OBJECT:
{ {
return io.path()/io.name(); return io.path(false)/io.name();
} }
break; break;
@ -404,7 +407,7 @@ Foam::fileOperations::masterUncollatedFileOperation::localObjectPath
case fileOperation::FINDINSTANCE: case fileOperation::FINDINSTANCE:
{ {
return return
io.rootPath()/io.caseName() io.rootPath()/io.caseName(false)
/instancePath/io.db().dbDir()/io.local()/io.name(); /instancePath/io.db().dbDir()/io.local()/io.name();
} }
break; break;
@ -571,7 +574,7 @@ Foam::fileOperations::masterUncollatedFileOperation::read
if (filePaths[0].empty()) if (filePaths[0].empty())
{ {
FatalIOErrorInFunction(filePaths[0]) FatalIOErrorInFunction(filePaths[0])
<< "cannot find file " << io.objectPath() << "cannot find file for object " << io.name()
<< exit(FatalIOError); << exit(FatalIOError);
} }
@ -608,7 +611,7 @@ Foam::fileOperations::masterUncollatedFileOperation::read
if (filePaths[0].empty()) if (filePaths[0].empty())
{ {
FatalIOErrorInFunction(filePaths[0]) FatalIOErrorInFunction(filePaths[0])
<< "cannot find file " << io.objectPath() << "cannot find file for object " << io.name()
<< exit(FatalIOError); << exit(FatalIOError);
} }
@ -1127,7 +1130,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::mv
Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::filePath Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::filePath
( (
const bool checkGlobal, const bool globalFile,
const IOobject& io, const IOobject& io,
const word& typeName const word& typeName
) const ) const
@ -1135,13 +1138,13 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::filePath
if (debug) if (debug)
{ {
Pout<< "masterUncollatedFileOperation::filePath :" Pout<< "masterUncollatedFileOperation::filePath :"
<< " objectPath:" << io.objectPath() << " objectPath:" << io.objectPath(globalFile)
<< " checkGlobal:" << checkGlobal << endl; << " globalFile:" << globalFile << endl;
} }
// Now that we have an IOobject path use it to detect & cache // Now that we have an IOobject path use it to detect & cache
// processor directory naming // processor directory naming
(void)lookupProcessorsPath(io.objectPath()); (void)lookupProcessorsPath(io.objectPath(globalFile));
// Trigger caching of times // Trigger caching of times
(void)findTimes(io.time().path(), io.time().constant()); (void)findTimes(io.time().path(), io.time().constant());
@ -1160,7 +1163,7 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::filePath
// fail (except on master). This gets handled later on (in PARENTOBJECT) // fail (except on master). This gets handled later on (in PARENTOBJECT)
objPath = filePathInfo objPath = filePathInfo
( (
checkGlobal, globalFile,
true, true,
io, io,
searchType, searchType,
@ -1192,7 +1195,7 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::filePath
if if
( (
checkGlobal globalFile
|| searchType == fileOperation::PARENTOBJECT || searchType == fileOperation::PARENTOBJECT
|| searchType == fileOperation::PROCBASEOBJECT || searchType == fileOperation::PROCBASEOBJECT
|| searchType == fileOperation::PROCBASEINSTANCE || searchType == fileOperation::PROCBASEINSTANCE
@ -1229,7 +1232,7 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::filePath
case fileOperation::PROCINSTANCE: case fileOperation::PROCINSTANCE:
{ {
// Construct equivalent local path // Construct equivalent local path
objPath = localObjectPath objPath = relativeObjectPath
( (
io, io,
searchType, searchType,
@ -1247,7 +1250,7 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::filePath
objPath = masterOp<fileName, fileOrNullOp> objPath = masterOp<fileName, fileOrNullOp>
( (
io.objectPath(), io.objectPath(globalFile),
fileOrNullOp(true), fileOrNullOp(true),
Pstream::msgType(), Pstream::msgType(),
comm_ comm_
@ -1261,7 +1264,7 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::filePath
{ {
Pout<< "masterUncollatedFileOperation::filePath :" Pout<< "masterUncollatedFileOperation::filePath :"
<< " Returning from file searching:" << endl << " Returning from file searching:" << endl
<< " objectPath:" << io.objectPath() << endl << " objectPath:" << io.objectPath(globalFile) << endl
<< " filePath :" << objPath << endl << endl; << " filePath :" << objPath << endl << endl;
} }
return objPath; return objPath;
@ -1270,20 +1273,20 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::filePath
Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::dirPath Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::dirPath
( (
const bool checkGlobal, const bool globalFile,
const IOobject& io const IOobject& io
) const ) const
{ {
if (debug) if (debug)
{ {
Pout<< "masterUncollatedFileOperation::dirPath :" Pout<< "masterUncollatedFileOperation::dirPath :"
<< " objectPath:" << io.objectPath() << " objectPath:" << io.objectPath(globalFile)
<< " checkGlobal:" << checkGlobal << endl; << " globalFile:" << globalFile << endl;
} }
// Now that we have an IOobject path use it to detect & cache // Now that we have an IOobject path use it to detect & cache
// processor directory naming // processor directory naming
(void)lookupProcessorsPath(io.objectPath()); (void)lookupProcessorsPath(io.objectPath(globalFile));
// Determine master dirPath and scatter // Determine master dirPath and scatter
@ -1296,7 +1299,7 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::dirPath
{ {
objPath = filePathInfo objPath = filePathInfo
( (
checkGlobal, globalFile,
false, false,
io, io,
searchType, searchType,
@ -1314,7 +1317,7 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::dirPath
if if
( (
checkGlobal globalFile
|| searchType == fileOperation::PARENTOBJECT || searchType == fileOperation::PARENTOBJECT
|| searchType == fileOperation::PROCBASEOBJECT || searchType == fileOperation::PROCBASEOBJECT
|| searchType == fileOperation::PROCBASEINSTANCE || searchType == fileOperation::PROCBASEINSTANCE
@ -1351,7 +1354,7 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::dirPath
case fileOperation::PROCINSTANCE: case fileOperation::PROCINSTANCE:
{ {
// Construct equivalent local path // Construct equivalent local path
objPath = localObjectPath objPath = relativeObjectPath
( (
io, io,
searchType, searchType,
@ -1368,7 +1371,7 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::dirPath
// have the file and some not (e.g. lagrangian data) // have the file and some not (e.g. lagrangian data)
objPath = masterOp<fileName, fileOrNullOp> objPath = masterOp<fileName, fileOrNullOp>
( (
io.objectPath(), io.objectPath(globalFile),
fileOrNullOp(false), fileOrNullOp(false),
Pstream::msgType(), Pstream::msgType(),
comm_ comm_
@ -1382,7 +1385,7 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::dirPath
{ {
Pout<< "masterUncollatedFileOperation::dirPath :" Pout<< "masterUncollatedFileOperation::dirPath :"
<< " Returning from file searching:" << endl << " Returning from file searching:" << endl
<< " objectPath:" << io.objectPath() << endl << " objectPath:" << io.objectPath(globalFile) << endl
<< " filePath :" << objPath << endl << endl; << " filePath :" << objPath << endl << endl;
} }
return objPath; return objPath;
@ -1426,7 +1429,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::exists
} }
// 3. Check local // 3. Check local
fileName localPath = io.objectPath(); fileName localPath = io.objectPath(false);
if (localPath != writePath && isFileOrDir(isFile, localPath)) if (localPath != writePath && isFileOrDir(isFile, localPath))
{ {
@ -1466,7 +1469,7 @@ Foam::fileOperations::masterUncollatedFileOperation::findInstance
// parent directory in case of parallel) // parent directory in case of parallel)
tmpNrc<dirIndexList> pDirs(lookupProcessorsPath(io.objectPath())); tmpNrc<dirIndexList> pDirs(lookupProcessorsPath(io.objectPath(false)));
word foundInstance; word foundInstance;
@ -1736,8 +1739,8 @@ bool Foam::fileOperations::masterUncollatedFileOperation::readHeader
if (debug) if (debug)
{ {
Pout<< "masterUncollatedFileOperation::readHeader :" << endl Pout<< "masterUncollatedFileOperation::readHeader :" << nl
<< " objectPath:" << io.objectPath() << endl << " object :" << io.name() << nl
<< " fName :" << fName << endl; << " fName :" << fName << endl;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -437,14 +437,14 @@ protected:
//- Search (locally!) for object; return info on how it was found. //- Search (locally!) for object; return info on how it was found.
// Does not do any parallel communication. // Does not do any parallel communication.
// checkGlobal : also check undecomposed case // globalFile : also check undecomposed case
// isFile : true:check for file false:check for directory // isFile : true:check for file false:check for directory
// searchType : how was found // searchType : how was found
// processorsDir : name of processor directory // processorsDir : name of processor directory
// instance : instance // instance : instance
virtual fileName filePathInfo virtual fileName filePathInfo
( (
const bool checkGlobal, const bool globalFile,
const bool isFile, const bool isFile,
const IOobject&, const IOobject&,
pathType& searchType, pathType& searchType,
@ -453,7 +453,7 @@ protected:
) const; ) const;
//- Construct filePath //- Construct filePath
fileName localObjectPath fileName relativeObjectPath
( (
const IOobject&, const IOobject&,
const pathType& searchType, const pathType& searchType,
@ -642,19 +642,19 @@ public:
// (reg)IOobject functionality // (reg)IOobject functionality
//- Search for an object. checkGlobal : also check undecomposed case //- Search for an object. globalFile : also check undecomposed case
virtual fileName filePath virtual fileName filePath
( (
const bool checkGlobal, const bool globalFile,
const IOobject&, const IOobject&,
const word& typeName const word& typeName
) const; ) const;
//- Search for a directory. checkGlobal : also check undecomposed //- Search for a directory. globalFile : also check undecomposed
// case // case
virtual fileName dirPath virtual fileName dirPath
( (
const bool checkGlobal, const bool globalFile,
const IOobject& const IOobject&
) const; ) const;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -58,7 +58,7 @@ namespace fileOperations
Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePathInfo Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePathInfo
( (
const bool checkGlobal, const bool globalFile,
const bool isFile, const bool isFile,
const IOobject& io const IOobject& io
) const ) const
@ -78,7 +78,7 @@ Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePathInfo
} }
else else
{ {
fileName path = io.path(); fileName path = io.path(globalFile);
fileName objectPath = path/io.name(); fileName objectPath = path/io.name();
if (isFileOrDir(isFile, objectPath)) if (isFileOrDir(isFile, objectPath))
@ -89,7 +89,7 @@ Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePathInfo
{ {
if if
( (
checkGlobal globalFile
&& io.time().processorCase() && io.time().processorCase()
&& ( && (
io.instance() == io.time().system() io.instance() == io.time().system()
@ -114,7 +114,7 @@ Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePathInfo
{ {
tmpNrc<dirIndexList> pDirs tmpNrc<dirIndexList> pDirs
( (
lookupProcessorsPath(io.objectPath()) lookupProcessorsPath(io.objectPath(globalFile))
); );
forAll(pDirs(), i) forAll(pDirs(), i)
{ {
@ -143,7 +143,7 @@ Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePathInfo
{ {
fileName fName fileName fName
( (
io.rootPath()/io.caseName() io.rootPath()/io.caseName(globalFile)
/newInstancePath/io.db().dbDir()/io.local()/io.name() /newInstancePath/io.db().dbDir()/io.local()/io.name()
); );
@ -365,7 +365,7 @@ bool Foam::fileOperations::uncollatedFileOperation::mv
Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePath Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePath
( (
const bool checkGlobal, const bool globalFile,
const IOobject& io, const IOobject& io,
const word& typeName const word& typeName
) const ) const
@ -373,17 +373,17 @@ Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePath
if (debug) if (debug)
{ {
Pout<< "uncollatedFileOperation::filePath :" Pout<< "uncollatedFileOperation::filePath :"
<< " objectPath:" << io.objectPath() << " objectPath:" << io.objectPath(globalFile)
<< " checkGlobal:" << checkGlobal << endl; << " globalFile:" << globalFile << endl;
} }
fileName objPath(filePathInfo(checkGlobal, true, io)); fileName objPath(filePathInfo(globalFile, true, io));
if (debug) if (debug)
{ {
Pout<< "uncollatedFileOperation::filePath :" Pout<< "uncollatedFileOperation::filePath :"
<< " Returning from file searching:" << endl << " Returning from file searching:" << endl
<< " objectPath:" << io.objectPath() << endl << " objectPath:" << io.objectPath(globalFile) << endl
<< " filePath :" << objPath << endl << endl; << " filePath :" << objPath << endl << endl;
} }
return objPath; return objPath;
@ -392,24 +392,24 @@ Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePath
Foam::fileName Foam::fileOperations::uncollatedFileOperation::dirPath Foam::fileName Foam::fileOperations::uncollatedFileOperation::dirPath
( (
const bool checkGlobal, const bool globalFile,
const IOobject& io const IOobject& io
) const ) const
{ {
if (debug) if (debug)
{ {
Pout<< "uncollatedFileOperation::dirPath :" Pout<< "uncollatedFileOperation::dirPath :"
<< " objectPath:" << io.objectPath() << " objectPath:" << io.objectPath(globalFile)
<< " checkGlobal:" << checkGlobal << endl; << " globalFile:" << globalFile << endl;
} }
fileName objPath(filePathInfo(checkGlobal, false, io)); fileName objPath(filePathInfo(globalFile, false, io));
if (debug) if (debug)
{ {
Pout<< "uncollatedFileOperation::dirPath :" Pout<< "uncollatedFileOperation::dirPath :"
<< " Returning from directory searching:" << endl << " Returning from directory searching:" << endl
<< " objectPath:" << io.objectPath() << endl << " objectPath:" << io.objectPath(globalFile) << endl
<< " dirPath :" << objPath << endl << endl; << " dirPath :" << objPath << endl << endl;
} }
return objPath; return objPath;
@ -483,7 +483,7 @@ bool Foam::fileOperations::uncollatedFileOperation::readHeader
if (IOobject::debug) if (IOobject::debug)
{ {
InfoInFunction InfoInFunction
<< "file " << io.objectPath() << " could not be opened" << "file for object " << io.name() << " could not be opened"
<< endl; << endl;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -52,11 +52,11 @@ class uncollatedFileOperation
// Private Member Functions // Private Member Functions
//- Search for an object. //- Search for an object.
// checkGlobal : also check undecomposed case // globalFile : also check undecomposed case
// isFile : true:check for file false:check for directory // isFile : true:check for file false:check for directory
fileName filePathInfo fileName filePathInfo
( (
const bool checkGlobal, const bool globalFile,
const bool isFile, const bool isFile,
const IOobject& const IOobject&
) const; ) const;
@ -200,19 +200,19 @@ public:
// (reg)IOobject functionality // (reg)IOobject functionality
//- Search for an object. checkGlobal : also check undecomposed case //- Search for an object. globalFile : also check undecomposed case
virtual fileName filePath virtual fileName filePath
( (
const bool checkGlobal, const bool globalFile,
const IOobject&, const IOobject&,
const word& typeName const word& typeName
) const; ) const;
//- Search for a directory. checkGlobal : also check undecomposed //- Search for a directory. globalFile : also check undecomposed
// case // case
virtual fileName dirPath virtual fileName dirPath
( (
const bool checkGlobal, const bool globalFile,
const IOobject& const IOobject&
) const; ) const;

View File

@ -75,7 +75,7 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
InfoInFunction << "Updating mesh based on saved data." << endl; InfoInFunction << "Updating mesh based on saved data." << endl;
} }
// Find the point and cell instance // Find the points and faces instance
fileName pointsInst(time().findInstance(meshDir(), "points")); fileName pointsInst(time().findInstance(meshDir(), "points"));
fileName facesInst(time().findInstance(meshDir(), "faces")); fileName facesInst(time().findInstance(meshDir(), "faces"));
// fileName boundaryInst(time().findInstance(meshDir(), "boundary")); // fileName boundaryInst(time().findInstance(meshDir(), "boundary"));

View File

@ -28,7 +28,7 @@ if (!mesh.foundObject<IOdictionary>("radiationProperties"))
<< " type radiation;" << nl << " type radiation;" << nl
<< " libs (\"libradiationModels.so\");" << nl << " libs (\"libradiationModels.so\");" << nl
<< "}" << nl << nl << "}" << nl << nl
<< "to " << radiationProperties.localPath()/"fvModels" << "to " << radiationProperties.relativePath()/"fvModels"
<< exit(FatalError); << exit(FatalError);
} }
} }

View File

@ -77,7 +77,7 @@ void Foam::fv::heatTransferModels::constant::readCoeffs()
FatalIOErrorInFunction(coeffs()) FatalIOErrorInFunction(coeffs())
<< "Heat transfer coefficient (htc) not found. A uniform htc " << "Heat transfer coefficient (htc) not found. A uniform htc "
<< "value should be specified, or a non-uniform field should " << "value should be specified, or a non-uniform field should "
<< "exist at " << htcIO.objectPath() << "exist at " << htcIO.objectPath<volScalarField>()
<< exit(FatalIOError); << exit(FatalIOError);
} }
} }

View File

@ -66,7 +66,7 @@ void Foam::fv::heatTransferModel::readCoeffs()
FatalIOErrorInFunction(coeffs()) FatalIOErrorInFunction(coeffs())
<< "Area per unit volume (AoV) not found. A uniform AoV " << "Area per unit volume (AoV) not found. A uniform AoV "
<< "value should be specified, or a non-uniform field should " << "value should be specified, or a non-uniform field should "
<< "exist at " << AoVIO.objectPath() << "exist at " << AoVIO.objectPath<volScalarField>()
<< exit(FatalIOError); << exit(FatalIOError);
} }
} }

View File

@ -80,8 +80,9 @@ void Foam::parcelCloudList::initialise
} }
else else
{ {
Info<< "Clouds not active: Neither " << cloudsIO.localObjectPath() Info<< "Clouds not active: Neither "
<< " nor " << cloudIO.localObjectPath() << " found" << endl; << cloudsIO.relativeObjectPath()
<< " nor " << cloudIO.relativeObjectPath() << " found" << endl;
} }
} }
} }

View File

@ -95,7 +95,8 @@ void Foam::refinementFeatures::read
FatalIOErrorInFunction FatalIOErrorInFunction
( (
dict dict
) << "Could not open " << featObj.objectPath() ) << "Could not open "
<< featObj.objectPath<featureEdgeMesh>()
<< exit(FatalIOError); << exit(FatalIOError);
} }

View File

@ -68,7 +68,7 @@ Foam::searchableExtrudedCircle::searchableExtrudedCircle
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
).objectPath() ).objectPath(global())
) )
), ),
radius_(dict.lookup<scalar>("radius")) radius_(dict.lookup<scalar>("radius"))

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -1390,8 +1390,8 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh(const IOobject& io)
if (debug) if (debug)
{ {
InfoInFunction << "Read distributedTriSurface from " << io.objectPath() InfoInFunction << "Read distributedTriSurface from "
<< ':' << endl; << searchableSurface::objectPath() << ':' << endl;
writeStats(Info); writeStats(Info);
labelList nTris(Pstream::nProcs()); labelList nTris(Pstream::nProcs());
@ -1474,8 +1474,8 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
if (debug) if (debug)
{ {
InfoInFunction << "Read distributedTriSurface from " << io.objectPath() InfoInFunction << "Read distributedTriSurface from "
<< " and dictionary:" << endl; << searchableSurface::objectPath() << " and dictionary:" << endl;
writeStats(Info); writeStats(Info);
labelList nTris(Pstream::nProcs()); labelList nTris(Pstream::nProcs());

View File

@ -225,7 +225,7 @@ Foam::surfMesh::surfMesh
{ {
if (debug) if (debug)
{ {
Info<<"IOobject: " << io.path() << nl Info<<"IOobject: " << io.path(false) << nl
<<" name: " << io.name() <<" name: " << io.name()
<<" instance: " << io.instance() <<" instance: " << io.instance()
<<" local: " << io.local() <<" local: " << io.local()
@ -394,7 +394,7 @@ void Foam::surfMesh::addZones
// Remove all files and some subdirs (eg, sets) // Remove all files and some subdirs (eg, sets)
void Foam::surfMesh::removeFiles(const fileName& instanceDir) const void Foam::surfMesh::removeFiles(const fileName& instanceDir) const
{ {
fileName meshFilesPath = db().path()/instanceDir/meshSubDir; fileName meshFilesPath = db().path(instanceDir, meshSubDir);
rm(meshFilesPath/"points"); rm(meshFilesPath/"points");
rm(meshFilesPath/"faces"); rm(meshFilesPath/"faces");

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -88,7 +88,7 @@ Foam::surfZoneIOList::surfZoneIOList
FatalErrorInFunction FatalErrorInFunction
<< "surfZones are not ordered. Start of zone " << zoneI << "surfZones are not ordered. Start of zone " << zoneI
<< " does not correspond to sum of preceding zones." << nl << " does not correspond to sum of preceding zones." << nl
<< "while reading " << io.objectPath() << endl << "while reading " << objectPath() << endl
<< exit(FatalError); << exit(FatalError);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,13 +29,12 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(surfacePatchIOList, 0); defineTypeNameAndDebug(surfacePatchIOList, 0);
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from IOObject
Foam::surfacePatchIOList::surfacePatchIOList Foam::surfacePatchIOList::surfacePatchIOList
( (
const IOobject& io const IOobject& io
@ -98,7 +97,7 @@ Foam::surfacePatchIOList::surfacePatchIOList
<< "Patches are not ordered. Start of patch " << patchi << "Patches are not ordered. Start of patch " << patchi
<< " does not correspond to sum of preceding patches." << " does not correspond to sum of preceding patches."
<< endl << endl
<< "while reading " << io.objectPath() << "while reading " << objectPath()
<< exit(FatalError); << exit(FatalError);
} }