From c8a1c95b06e66dea7f7242b1a56b0349e98fd284 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 24 Jan 2020 11:52:45 +0000 Subject: [PATCH] IOobject: Added localPath and localObjectPath member functions For many information and diagnostic messages the absolute path of the object is not required and the local path relative to the current case is sufficient; the new localObjectPath() member function of IOobject provides a convenient way of printing this. --- .../mesh/advanced/autoRefineMesh/autoRefineMesh.C | 6 +++--- .../advanced/refineWallLayer/refineWallLayer.C | 2 +- .../conversion/Optional/ccm26ToFoam/ccm26ToFoam.C | 8 ++++---- .../fluent3DMeshToFoam/fluent3DMeshToFoam.L | 2 +- .../mesh/conversion/foamToStarMesh/getTimeIndex.H | 2 -- .../mesh/generation/blockMesh/blockMesh.C | 6 +++--- .../generation/extrude/extrudeMesh/extrudeMesh.C | 4 ++-- .../conformalVoronoiMesh/conformalVoronoiMeshIO.C | 4 ++-- .../mergeOrSplitBaffles/mergeOrSplitBaffles.C | 6 +++--- .../mesh/manipulation/refineMesh/refineMesh.C | 4 ++-- .../splitMeshRegions/splitMeshRegions.C | 6 +++--- .../decomposePar/decomposePar.C | 4 ++-- .../reconstructParMesh/reconstructParMesh.C | 4 ++-- .../redistributePar/loadOrCreateMesh.C | 5 +---- .../foamToTetDualMesh/foamToTetDualMesh.C | 5 +++-- .../tabulatedWallFunction/tabulatedWallFunction.C | 6 +++--- .../surfaceBooleanFeatures.C | 4 ++-- .../surface/surfaceFeatures/surfaceFeatures.C | 4 ++-- .../surfaceMeshConvertTesting.C | 14 +++++++------- .../surface/surfaceMeshExport/surfaceMeshExport.C | 4 ++-- .../surface/surfaceMeshImport/surfaceMeshImport.C | 4 ++-- src/OpenFOAM/db/IOobject/IOobject.C | 15 ++++++++++++++- src/OpenFOAM/db/IOobject/IOobject.H | 11 ++++++++++- 23 files changed, 74 insertions(+), 56 deletions(-) diff --git a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C index fe7d5ee8e5..6a4e6b53f0 100644 --- a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C +++ b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C @@ -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-2020 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.objectPath() << nl + << refLevel.localObjectPath() << 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.objectPath() << nl + << refLevel.localObjectPath() << nl << endl; } diff --git a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C index 48226b0978..868a6d1c40 100644 --- a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C +++ b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C @@ -143,7 +143,7 @@ int main(int argc, char *argv[]) const cellSet cellsToRefine(mesh, setName); Info<< " Read " << cellsToRefine.size() - << " cells from cellSet " << cellsToRefine.objectPath() + << " cells from cellSet " << cellsToRefine.localObjectPath() << nl << endl; const labelList allCutCells(cutCells.toc()); diff --git a/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C b/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C index 8cc646d00d..e2291a9e44 100644 --- a/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C +++ b/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -1103,7 +1103,7 @@ int main(int argc, char *argv[]) } - Info<< "Writing mesh to " << mesh.objectRegistry::objectPath() + Info<< "Writing mesh to " << mesh.objectRegistry::localObjectPath() << "..." << nl << endl; @@ -1147,8 +1147,8 @@ int main(int argc, char *argv[]) cellTypeField[celli] = foamCellType[celli]; } - Info<< "Writing cellIds as volScalarField to " << cellIdField.objectPath() - << "..." << nl << endl; + Info<< "Writing cellIds as volScalarField to " + << cellIdField.localObjectPath() << "..." << nl << endl; mesh.write(); Info<< "End\n" << endl; diff --git a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L index 929947b68f..1a7c407413 100644 --- a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L +++ b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L @@ -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.objectPath() << endl; + Info<< nl << "Writing mesh to " << mesh.localObjectPath() << endl; mesh.write(); diff --git a/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H b/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H index 22b31b514c..bcfd41ec99 100644 --- a/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H +++ b/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H @@ -42,8 +42,6 @@ else { timeName = runTime.timeName(); - // Info<< "skip ... missing entry " << io.objectPath() << endl; - // continue; } } diff --git a/applications/utilities/mesh/generation/blockMesh/blockMesh.C b/applications/utilities/mesh/generation/blockMesh/blockMesh.C index 1fe4a2b036..fe55d0d53c 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMesh.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMesh.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -201,13 +201,13 @@ int main(int argc, char *argv[]) if (!meshDictIO.typeHeaderOk(true)) { FatalErrorInFunction - << meshDictIO.objectPath() + << meshDictIO.localObjectPath() << nl << exit(FatalError); } Info<< "Creating block mesh from\n " - << meshDictIO.objectPath() << endl; + << meshDictIO.localObjectPath() << endl; IOdictionary meshDict(meshDictIO); blockMesh blocks(meshDict, regionName); diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index 6a1bdb33fa..7f14e1b6ac 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -1034,7 +1034,7 @@ int main(int argc, char *argv[]) } mesh.setInstance(runTimeExtruded.constant()); - Info<< "Writing mesh to " << mesh.objectPath() << nl << endl; + Info<< "Writing mesh to " << mesh.localObjectPath() << nl << endl; if (!mesh.write()) { diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C index 49baee1372..e330f42e23 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C @@ -316,7 +316,7 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance) // } // // Info<< "Writing map from tetDualMesh points to Voronoi mesh to " -// << pointDualAddressing.objectPath() << endl; +// << pointDualAddressing.localObjectPath() << endl; // pointDualAddressing.write(); // // @@ -370,7 +370,7 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance) // } // // Info<< "Writing tetDualMesh points mapped onto Voronoi mesh to " -// << dualPoints.objectPath() << endl +// << dualPoints.localObjectPath() << endl // << "Replace the polyMesh/points with these." << endl; // dualPoints.write(); // } diff --git a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C index 640f120add..6ff2f20d06 100644 --- a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C +++ b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -209,7 +209,7 @@ labelList findBaffles(const polyMesh& mesh, const labelList& boundaryFaces) } Pout<< "Writing " << duplicateSet.size() - << " duplicate faces to faceSet " << duplicateSet.objectPath() + << " duplicate faces to faceSet " << duplicateSet.localObjectPath() << nl << endl; duplicateSet.write(); } @@ -365,7 +365,7 @@ int main(int argc, char *argv[]) Pout<< "Writing " << dupPoints.size() << " duplicated points to pointSet " - << dupPoints.objectPath() << nl << endl; + << dupPoints.localObjectPath() << nl << endl; dupPoints.write(); } diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C index 00558f4467..fd9647f430 100644 --- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C +++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -406,7 +406,7 @@ int main(int argc, char *argv[]) } Info<< "Writing map from new to old cell to " - << newToOld.objectPath() << nl << endl; + << newToOld.localObjectPath() << nl << endl; newToOld.write(); diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 6f19f0ae4e..0225035d14 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -1412,7 +1412,7 @@ void writeCellToRegion(const fvMesh& mesh, const labelList& cellRegion) cellToRegion.write(); Info<< "Writing region per cell file (for manual decomposition) to " - << cellToRegion.objectPath() << nl << endl; + << cellToRegion.localObjectPath() << nl << endl; } // Write for postprocessing { @@ -1438,7 +1438,7 @@ void writeCellToRegion(const fvMesh& mesh, const labelList& cellRegion) cellToRegion.write(); Info<< "Writing region per cell as volScalarField to " - << cellToRegion.objectPath() << nl << endl; + << cellToRegion.localObjectPath() << nl << endl; } } diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index 502bba0008..1a681a5ce5 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -506,7 +506,7 @@ int main(int argc, char *argv[]) cellDecomposition.write(); Info<< nl << "Wrote decomposition to " - << cellDecomposition.objectPath() + << cellDecomposition.localObjectPath() << " for use in manual decomposition." << endl; // Write as volScalarField for postprocessing. diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C index 870af18f7b..0432e048e6 100644 --- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C +++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -402,7 +402,7 @@ void writeCellDistance cellDecomposition.write(); Info<< nl << "Wrote decomposition to " - << cellDecomposition.objectPath() + << cellDecomposition.localObjectPath() << " for use in manual decomposition." << endl; diff --git a/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C b/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C index a2565f87b9..19b444737e 100644 --- a/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C +++ b/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -209,14 +209,11 @@ Foam::autoPtr Foam::loadOrCreateMesh ) ); dummyMesh.addZones(pz, fz, cz); - // Pout<< "Writing dummy mesh to " << dummyMesh.polyMesh::objectPath() - // << endl; dummyMesh.write(); Pstream::parRun() = oldParRun; } - // Pout<< "Reading mesh from " << io.objectPath() << endl; autoPtr meshPtr(new fvMesh(io)); fvMesh& mesh = meshPtr(); diff --git a/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C b/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C index 8654a46c76..b3291a2558 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C +++ b/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -189,7 +189,8 @@ int main(int argc, char *argv[]) { FatalErrorInFunction << "Size " << pointDualAddressing.size() - << " of addressing map " << pointDualAddressing.objectPath() + << " of addressing map " + << pointDualAddressing.localObjectPath() << " differs from number of points in mesh " << tetDualMesh.nPoints() << exit(FatalError); diff --git a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunction.C b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunction.C index 493145de06..a40ee1bff9 100644 --- a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunction.C +++ b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/tabulatedWallFunction/tabulatedWallFunction.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -76,8 +76,8 @@ void Foam::tabulatedWallFunctions::tabulatedWallFunction::write() "U+ as a function of Re computed using " + type(); } - Info<< "Writing inverted table to\n " << invertedTable_.objectPath() - << endl; + Info<< "Writing inverted table to\n " + << invertedTable_.localObjectPath() << endl; invertedTable_.write(); } diff --git a/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C b/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C index 983b2cf30f..4f54c8c140 100644 --- a/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C +++ b/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -793,7 +793,7 @@ int main(int argc, char *argv[]) ); Info<< nl << "Writing featureEdgeMesh to " - << bfeMesh.objectPath() << endl; + << bfeMesh.localObjectPath() << endl; bfeMesh.regIOobject::write(); } diff --git a/applications/utilities/surface/surfaceFeatures/surfaceFeatures.C b/applications/utilities/surface/surfaceFeatures/surfaceFeatures.C index 1177493e75..07377945d5 100644 --- a/applications/utilities/surface/surfaceFeatures/surfaceFeatures.C +++ b/applications/utilities/surface/surfaceFeatures/surfaceFeatures.C @@ -387,7 +387,7 @@ namespace Foam feMesh.writeStats(Info); Info<< nl << "Writing extendedFeatureEdgeMesh to " - << feMesh.objectPath() << endl; + << feMesh.localObjectPath() << endl; mkDir(feMesh.path()); @@ -420,7 +420,7 @@ namespace Foam ); Info<< nl << "Writing featureEdgeMesh to " - << bfeMesh.objectPath() << endl; + << bfeMesh.localObjectPath() << endl; bfeMesh.regIOobject::write(); diff --git a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C index 8c82458e3b..c9edd94ddd 100644 --- a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C +++ b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -337,7 +337,8 @@ int main(int argc, char *argv[]) move(surf) ); - Info<< "writing surfMesh as well: " << surfOut.objectPath() << endl; + Info<< "writing surfMesh as well: " + << surfOut.localObjectPath() << endl; surfOut.write(); surfLabelField zoneIds @@ -366,7 +367,8 @@ int main(int argc, char *argv[]) - Info<< "writing surfMesh again well: " << surfOut.objectPath() + Info<< "writing surfMesh again well: " + << surfOut.localObjectPath() << endl; surfOut.write(); @@ -386,7 +388,7 @@ int main(int argc, char *argv[]) } Info<< "write zoneIds (for testing only): " - << zoneIds.objectPath() << endl; + << zoneIds.localObjectPath() << endl; zoneIds.write(); surfPointLabelField pointIds @@ -394,9 +396,7 @@ int main(int argc, char *argv[]) IOobject ( "zoneIds.", -// "pointIds", surfOut.instance(), -// "pointFields", surfOut, IOobject::NO_READ, IOobject::NO_WRITE @@ -411,7 +411,7 @@ int main(int argc, char *argv[]) } Info<< "write pointIds (for testing only): " - << pointIds.objectPath() << endl; + << pointIds.localObjectPath() << endl; pointIds.write(); Info<<"surfMesh with these names: " << surfOut.names() << endl; diff --git a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C index 4230d2bb36..f6a0a57f3a 100644 --- a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C +++ b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -238,7 +238,7 @@ int main(int argc, char *argv[]) ) ); - Info<< "read surfMesh:\n " << smesh.objectPath() << endl; + Info<< "read surfMesh:\n " << smesh.localObjectPath() << endl; // Simply copy for now, but really should have a separate write method diff --git a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C index 83027a4657..da477195eb 100644 --- a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C +++ b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -288,7 +288,7 @@ int main(int argc, char *argv[]) ); - Info<< "writing surfMesh:\n " << smesh.objectPath() << endl; + Info<< "writing surfMesh:\n " << smesh.localObjectPath() << endl; smesh.write(); Info<< "\nEnd\n" << endl; diff --git a/src/OpenFOAM/db/IOobject/IOobject.C b/src/OpenFOAM/db/IOobject/IOobject.C index 81e639a138..488764c384 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.C +++ b/src/OpenFOAM/db/IOobject/IOobject.C @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -379,6 +379,19 @@ Foam::fileName Foam::IOobject::path } +Foam::fileName Foam::IOobject::localPath() const +{ + if (instance().isAbsolute()) + { + return instance(); + } + else + { + return instance()/db_.dbDir()/local(); + } +} + + Foam::fileName Foam::IOobject::localFilePath(const word& typeName) const { // Do not check for undecomposed files diff --git a/src/OpenFOAM/db/IOobject/IOobject.H b/src/OpenFOAM/db/IOobject/IOobject.H index 5001c23bac..0fe0356f5c 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.H +++ b/src/OpenFOAM/db/IOobject/IOobject.H @@ -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-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -413,12 +413,21 @@ public: 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 complete localPath + object name + fileName localObjectPath() const + { + return localPath()/name(); + } + //- Helper for filePath that searches locally. fileName localFilePath(const word& typeName) const;