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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -143,7 +143,7 @@ int main(int argc, char *argv[])
const cellSet cellsToRefine(mesh, setName);
Info<< " Read " << cellsToRefine.size()
<< " cells from cellSet " << cellsToRefine.localObjectPath()
<< " cells from cellSet " << cellsToRefine.relativeObjectPath()
<< nl << endl;
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;
@ -1148,7 +1148,7 @@ int main(int argc, char *argv[])
}
Info<< "Writing cellIds as volScalarField to "
<< cellIdField.localObjectPath() << "..." << nl << endl;
<< cellIdField.relativeObjectPath() << "..." << nl << endl;
mesh.write();
Info<< "End\n" << endl;

View File

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

View File

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

View File

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

View File

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

View File

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

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);
}

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -120,7 +120,7 @@ void Foam::vtkPVFoam::convertFields(vtkMultiBlockDataSet* output)
forAllConstIter(IOobjectList, objects, iter)
{
Info<< " " << iter()->name()
<< " == " << iter()->objectPath() << nl;
<< " == " << iter()->objectPath<volScalarField>() << nl;
}
printMemory();
}
@ -266,7 +266,7 @@ void Foam::vtkPVFoam::convertLagrangianFields(vtkMultiBlockDataSet* output)
forAllConstIter(IOobjectList, objects, iter)
{
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
// field)
Info<< "Loading dictionary " << fieldName << endl;
const word oldTypeName = IOdictionary::typeName;
const_cast<word&>(IOdictionary::typeName) = word::null;
const word oldTypeName = localIOdictionary::typeName;
const_cast<word&>(localIOdictionary::typeName) = word::null;
IOdictionary fieldDict
localIOdictionary fieldDict
(
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
const_cast<word&>(fieldDict.type()) =

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,7 +41,7 @@ void UnMapped(const IOobjectList& objects)
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
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,7 +41,7 @@ void UnMapped(const IOobjectList& objects)
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 "
<< bfeMesh.localObjectPath() << endl;
<< bfeMesh.relativeObjectPath() << endl;
bfeMesh.regIOobject::write();
}

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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();
Info<< "\nEnd\n" << endl;

View File

@ -171,7 +171,7 @@ int main(int argc, char *argv[])
fileName localPath(actualPath);
localPath.replace(runTime.rootPath() + '/', "");
if (actualPath == io.objectPath())
if (actualPath == io.objectPath(false))
{
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
{
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();
}
@ -365,10 +353,17 @@ const Foam::fileName& Foam::IOobject::caseName() const
Foam::fileName& Foam::IOobject::instance() const
{
return instance_;
}
void Foam::IOobject::updateInstance() const
{
if
(
instance_ != time().system()
!instance_.isAbsolute()
&& instance_ != time().system()
&& instance_ != time().constant()
&& instance_ != time().timeName()
)
@ -379,36 +374,23 @@ Foam::fileName& Foam::IOobject::instance() const
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
{
return rootPath()/caseName()/instance()/db_.dbDir()/local();
return rootPath()/caseName(global)/instance()/db_.dbDir()/local();
}
}
Foam::fileName Foam::IOobject::path
(
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
Foam::fileName Foam::IOobject::relativePath() const
{
if (instance().isAbsolute())
{
@ -424,10 +406,10 @@ Foam::fileName Foam::IOobject::localPath() const
Foam::fileName Foam::IOobject::filePath
(
const word& typeName,
const bool isGlobal
const bool global
) const
{
return fileHandler().filePath(isGlobal, *this, typeName);
return fileHandler().filePath(global, *this, typeName);
}

View File

@ -384,61 +384,53 @@ public:
// as <model>:<name>
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& caseName() const;
const fileName& caseName(const bool global) const;
//- Return the instance directory, constant, system, <time> etc.
// If the instance is a time directory it is updated to the
// current time before return
// Allows modification of the instance
fileName& instance() const;
//- If the instance is a time directory update to the current time
void updateInstance() const;
const fileName& local() const
{
return local_;
}
//- Return complete path
fileName path() const;
//- Return complete path including the processor sub-directory
// for a parallel run if global is set false
fileName path(const bool global) const;
//- Return complete path with alternative instance and local
fileName path
(
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 complete path + object name including the processor
// sub-directory for a parallel run if global is set false
fileName objectPath(const bool global) const
{
return path()/name();
return path(global)/name();
}
//- Return complete localPath + object name
fileName localObjectPath() const
//- Return complete path + object name including the processor
// 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
// 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.
fileName filePath(const word& typeName, const bool isGlobal) const;
fileName filePath(const word& typeName, const bool global) const;
// Reading
@ -455,6 +447,7 @@ public:
template<class Type>
void warnNoRereading() const;
// Writing
//- Write the standard OpenFOAM file/dictionary banner
@ -510,24 +503,30 @@ template<>
Ostream& operator<<(Ostream& os, const InfoProxy<IOobject>& ip);
//- Template function for obtaining global status
template<class T>
template<class Type>
inline bool typeGlobal()
{
return false;
}
//- Template function for obtaining global write status
template<class T>
template<class Type>
inline bool typeGlobalFile()
{
return typeGlobal<T>();
return typeGlobal<Type>();
}
//- Template function for obtaining filePath
template<class T>
template<class Type>
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)

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -150,6 +150,16 @@ Foam::objectRegistry::~objectRegistry()
// * * * * * * * * * * * * * * * 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
{
return HashTable<regIOobject*>::toc();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -148,6 +148,15 @@ public:
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
wordList names() const;

View File

@ -138,7 +138,8 @@ Foam::regIOobject::~regIOobject()
if (this == &db())
{
Pout<< "Destroying objectRegistry " << name()
<< " in directory " << rootPath()/caseName()/instance()
<< " in directory "
<< rootPath()/caseName()/instance()
<< endl;
}
else
@ -161,6 +162,30 @@ Foam::regIOobject::~regIOobject()
// * * * * * * * * * * * * * * * 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()
{
if (!registered_)

View File

@ -129,6 +129,45 @@ public:
// 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
//- Add object to registry
@ -211,15 +250,6 @@ public:
// 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
bool headerOk();

View File

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

View File

@ -423,7 +423,7 @@ Foam::fileName Foam::fileOperations::collatedFileOperation::objectPath
// Replacement for objectPath
if (io.time().processorCase())
{
return masterUncollatedFileOperation::localObjectPath
return masterUncollatedFileOperation::relativeObjectPath
(
io,
fileOperation::PROCOBJECT,
@ -433,7 +433,7 @@ Foam::fileName Foam::fileOperations::collatedFileOperation::objectPath
}
else
{
return masterUncollatedFileOperation::localObjectPath
return masterUncollatedFileOperation::relativeObjectPath
(
io,
fileOperation::OBJECT,
@ -693,7 +693,7 @@ Foam::word Foam::fileOperations::collatedFileOperation::processorsDir
const IOobject& io
) 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
// compatibility
fileName originalPath(filePath(io.objectPath()));
fileName originalPath(filePath(io.objectPath(false)));
if (originalPath != objPath)
{
// Test for either directory or a (valid) file & IOobject
@ -445,7 +445,7 @@ Foam::fileName Foam::fileOperation::objectPath
const word& typeName
) const
{
return io.objectPath();
return io.objectPath(false);
}
@ -890,7 +890,7 @@ Foam::fileNameList Foam::fileOperation::readObjects
<< " instance:" << instance << endl;
}
fileName path(db.path(instance, db.dbDir()/local));
fileName path(db.path(instance, local));
newInstance = word::null;
fileNameList objectNames;
@ -911,6 +911,7 @@ Foam::fileNameList Foam::fileOperation::readObjects
objectNames = Foam::readDir(procsPath, fileType::file);
}
}
return objectNames;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -75,7 +75,7 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
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 facesInst(time().findInstance(meshDir(), "faces"));
// fileName boundaryInst(time().findInstance(meshDir(), "boundary"));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -225,7 +225,7 @@ Foam::surfMesh::surfMesh
{
if (debug)
{
Info<<"IOobject: " << io.path() << nl
Info<<"IOobject: " << io.path(false) << nl
<<" name: " << io.name()
<<" instance: " << io.instance()
<<" local: " << io.local()
@ -394,7 +394,7 @@ void Foam::surfMesh::addZones
// Remove all files and some subdirs (eg, sets)
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/"faces");

View File

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

View File

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