diff --git a/applications/solvers/electromagnetics/mhdFoam/createPhiB.H b/applications/solvers/electromagnetics/mhdFoam/createPhiB.H index 02b48f8d28..967c98f55b 100644 --- a/applications/solvers/electromagnetics/mhdFoam/createPhiB.H +++ b/applications/solvers/electromagnetics/mhdFoam/createPhiB.H @@ -1,4 +1,4 @@ -IOobject phiBHeader +typeIOobject phiBHeader ( "phiB", runTime.timeName(), @@ -9,7 +9,7 @@ IOobject phiBHeader surfaceScalarField* phiBPtr = nullptr; -if (phiBHeader.typeHeaderOk(true)) +if (phiBHeader.headerOk()) { Info<< "Reading face flux "; diff --git a/applications/solvers/lagrangian/particleFoam/createFields.H b/applications/solvers/lagrangian/particleFoam/createFields.H index 7039378a86..2dfff06109 100644 --- a/applications/solvers/lagrangian/particleFoam/createFields.H +++ b/applications/solvers/lagrangian/particleFoam/createFields.H @@ -56,7 +56,7 @@ volScalarField mu Info<< "Constructing clouds" << endl; parcelCloudList clouds(rhoInf, U, mu, g); -IOobject Hheader +typeIOobject Hheader ( "H", runTime.timeName(), @@ -67,14 +67,14 @@ IOobject Hheader autoPtr HPtr; -if (Hheader.typeHeaderOk(true)) +if (Hheader.headerOk()) { Info<< "\nReading field H\n" << endl; HPtr.reset(new volVectorField (Hheader, mesh)); } -IOobject HdotGradHheader +typeIOobject HdotGradHheader ( "HdotGradH", runTime.timeName(), @@ -85,7 +85,7 @@ IOobject HdotGradHheader autoPtr HdotGradHPtr; -if (HdotGradHheader.typeHeaderOk(true)) +if (HdotGradHheader.headerOk()) { Info<< "Reading field HdotGradH" << endl; diff --git a/applications/solvers/lagrangian/particleFoam/createNonInertialFrameFields.H b/applications/solvers/lagrangian/particleFoam/createNonInertialFrameFields.H index 731a8196da..6ca6c7afe5 100644 --- a/applications/solvers/lagrangian/particleFoam/createNonInertialFrameFields.H +++ b/applications/solvers/lagrangian/particleFoam/createNonInertialFrameFields.H @@ -1,6 +1,6 @@ Info<< "Reading non-inertial frame fields" << endl; - IOobject linearAccelerationHeader + typeIOobject linearAccelerationHeader ( "linearAcceleration", runTime.timeName(), @@ -11,13 +11,7 @@ autoPtr linearAccelerationPtr; - if - ( - linearAccelerationHeader.typeHeaderOk - ( - true - ) - ) + if (linearAccelerationHeader.headerOk()) { Info<< " Reading " << linearAccelerationHeader.name() << endl; @@ -28,7 +22,7 @@ } - IOobject angularVelocityHeader + typeIOobject angularVelocityHeader ( "angularVelocity", runTime.timeName(), @@ -39,7 +33,7 @@ autoPtr angularVelocityPtr; - if (angularVelocityHeader.typeHeaderOk(true)) + if (angularVelocityHeader.headerOk()) { Info<< " Reading " << angularVelocityHeader.name() << endl; @@ -50,7 +44,7 @@ } - IOobject angularAccelerationHeader + typeIOobject angularAccelerationHeader ( "angularAcceleration", runTime.timeName(), @@ -61,13 +55,7 @@ autoPtr angularAccelerationPtr; - if - ( - angularAccelerationHeader.typeHeaderOk - ( - true - ) - ) + if (angularAccelerationHeader.headerOk()) { Info<< " Reading " << angularAccelerationHeader.name() << endl; @@ -78,7 +66,7 @@ } - IOobject centreOfRotationHeader + typeIOobject centreOfRotationHeader ( "centreOfRotation", runTime.timeName(), @@ -89,13 +77,7 @@ autoPtr centreOfRotationPtr; - if - ( - centreOfRotationHeader.typeHeaderOk - ( - true - ) - ) + if (centreOfRotationHeader.headerOk()) { Info<< " Reading " << centreOfRotationHeader.name() << endl; diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModel.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModel.C index 36d768e2ee..5bb4e4d0f1 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModel.C +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModel.C @@ -46,7 +46,7 @@ Foam::IOobject Foam::twoPhaseChangeModel::createIOobject const compressibleTwoPhaseMixture& mixture ) const { - IOobject io + typeIOobject io ( phaseChangePropertiesName, mixture.alpha1().mesh().time().constant(), @@ -55,7 +55,7 @@ Foam::IOobject Foam::twoPhaseChangeModel::createIOobject IOobject::NO_WRITE ); - if (io.typeHeaderOk(true)) + if (io.headerOk()) { io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; return io; diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModelNew.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModelNew.C index 27bf5ffe45..f7384ef5c0 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModelNew.C +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseChange/twoPhaseChangeModel/twoPhaseChangeModelNew.C @@ -32,7 +32,7 @@ Foam::autoPtr Foam::twoPhaseChangeModel::New const compressibleTwoPhaseMixture& mixture ) { - IOobject twoPhaseChangeModelIO + typeIOobject twoPhaseChangeModelIO ( IOobject ( @@ -47,7 +47,7 @@ Foam::autoPtr Foam::twoPhaseChangeModel::New word modelType(twoPhaseChangeModels::noPhaseChange::typeName); - if (twoPhaseChangeModelIO.typeHeaderOk(false)) + if (twoPhaseChangeModelIO.headerOk()) { IOdictionary(twoPhaseChangeModelIO).lookup ( diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C index 12ebd0b7df..aa79f834bc 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C @@ -44,7 +44,7 @@ Foam::MovingPhaseModel::phi(const volVectorField& U) const { word phiName(IOobject::groupName("phi", this->name())); - IOobject phiHeader + typeIOobject phiHeader ( phiName, U.mesh().time().timeName(), @@ -52,7 +52,7 @@ Foam::MovingPhaseModel::phi(const volVectorField& U) const IOobject::NO_READ ); - if (phiHeader.typeHeaderOk(true)) + if (phiHeader.headerOk()) { Info<< "Reading face flux field " << phiName << endl; diff --git a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C index 58f812b34b..b46ba36b87 100644 --- a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C +++ b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C @@ -639,7 +639,7 @@ int main(int argc, char *argv[]) Info<< "Checking for motionProperties\n" << endl; - IOobject motionObj + typeIOobject motionObj ( "motionProperties", runTime.constant(), @@ -651,7 +651,7 @@ int main(int argc, char *argv[]) // corrector for mesh motion twoDPointCorrector* correct2DPtr = nullptr; - if (motionObj.typeHeaderOk(true)) + if (motionObj.headerOk()) { Info<< "Reading " << runTime.constant() / "motionProperties" << endl << endl; diff --git a/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C b/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C index de8fe12cb4..2a4deec137 100644 --- a/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C +++ b/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.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-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -230,7 +230,7 @@ int main(int argc, char *argv[]) // Refinement level - IOobject refHeader + typeIOobject refHeader ( "refinementLevel", runTime.timeName(), @@ -238,7 +238,7 @@ int main(int argc, char *argv[]) runTime ); - if (!readLevel && refHeader.typeHeaderOk(true)) + if (!readLevel && refHeader.headerOk()) { WarningInFunction << "Detected " << refHeader.name() << " file in " diff --git a/applications/utilities/mesh/advanced/selectCells/edgeStats.C b/applications/utilities/mesh/advanced/selectCells/edgeStats.C index 35427309da..284714dc45 100644 --- a/applications/utilities/mesh/advanced/selectCells/edgeStats.C +++ b/applications/utilities/mesh/advanced/selectCells/edgeStats.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-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -74,7 +74,7 @@ Foam::edgeStats::edgeStats(const polyMesh& mesh) mesh_(mesh), normalDir_(3) { - IOobject motionObj + typeIOobject motionObj ( "motionProperties", mesh.time().constant(), @@ -83,7 +83,7 @@ Foam::edgeStats::edgeStats(const polyMesh& mesh) IOobject::NO_WRITE ); - if (motionObj.typeHeaderOk(true)) + if (motionObj.headerOk()) { Info<< "Reading " << mesh.time().constant() / "motionProperties" << endl << endl; diff --git a/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H b/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H index bcfd41ec99..f9f10d2edb 100644 --- a/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H +++ b/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H @@ -8,7 +8,7 @@ && runTime.timeName() != "0" ) { - IOobject io + typeIOobject io ( "time", runTime.timeName(), @@ -19,7 +19,7 @@ false ); - if (io.typeHeaderOk(true)) + if (io.headerOk()) { IOdictionary timeObject ( diff --git a/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H b/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H index 22b31b514c..5ba1650b6c 100644 --- a/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H +++ b/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H @@ -8,7 +8,7 @@ && runTime.timeName() != "0" ) { - IOobject io + typeIOobject io ( "time", runTime.timeName(), @@ -19,7 +19,7 @@ false ); - if (io.typeHeaderOk(true)) + if (io.headerOk()) { IOdictionary timeObject ( diff --git a/applications/utilities/mesh/generation/blockMesh/blockMesh.C b/applications/utilities/mesh/generation/blockMesh/blockMesh.C index 195030cd2e..b5014c8eae 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMesh.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMesh.C @@ -149,9 +149,12 @@ int main(int argc, char *argv[]) } } - IOobject meshDictIO(systemDictIO(dictName, args, runTime, regionName)); + typeIOobject meshDictIO + ( + systemDictIO(dictName, args, runTime, regionName) + ); - if (!meshDictIO.typeHeaderOk(true)) + if (!meshDictIO.headerOk()) { FatalErrorInFunction << "Cannot find file " << meshDictIO.relativeObjectPath() diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index dc1060c05a..1aaf2d7e34 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -84,7 +84,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) { // Create dummy system/fv* { - IOobject io + typeIOobject io ( "fvSchemes", mesh.time().system(), @@ -95,9 +95,9 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) false ); - Info<< "Testing:" << io.objectPath() << endl; + Info<< "Testing:" << io.objectPath() << endl; - if (!io.typeHeaderOk(false)) + if (!io.headerOk()) { Info<< "Writing dummy " << regionName/io.name() << endl; dictionary dummyDict; @@ -112,7 +112,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) } } { - IOobject io + typeIOobject io ( "fvSolution", mesh.time().system(), @@ -123,7 +123,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) false ); - if (!io.typeHeaderOk(false)) + if (!io.headerOk()) { Info<< "Writing dummy " << regionName/io.name() << endl; dictionary dummyDict; diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index 2d2d252a6a..0e644fba5c 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -342,7 +342,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) { // Create dummy system/fv* { - IOobject io + typeIOobject io ( "fvSchemes", mesh.time().system(), @@ -353,9 +353,9 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) false ); - Info<< "Testing:" << io.objectPath() << endl; + Info<< "Testing:" << io.objectPath() << endl; - if (!io.typeHeaderOk(true)) + if (!io.headerOk()) { Info<< "Writing dummy " << regionName/io.name() << endl; dictionary dummyDict; @@ -370,7 +370,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) } } { - IOobject io + typeIOobject io ( "fvSolution", mesh.time().system(), @@ -381,7 +381,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) false ); - if (!io.typeHeaderOk(true)) + if (!io.headerOk()) { Info<< "Writing dummy " << regionName/io.name() << endl; dictionary dummyDict; @@ -2492,7 +2492,7 @@ int main(int argc, char *argv[]) { autoPtr patchFaceCentresPtr; - IOobject io + typeIOobject io ( "patchFaceCentres", mesh.pointsInstance(), @@ -2500,7 +2500,8 @@ int main(int argc, char *argv[]) mesh, IOobject::MUST_READ ); - if (io.typeHeaderOk(true)) + + if (io.headerOk()) { // Read patchFaceCentres and patchEdgeCentres Info<< "Reading patch face,edge centres : " diff --git a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C index 508c76aade..6b4a3995d4 100644 --- a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C +++ b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.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-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << endl; - IOobject Uheader + typeIOobject Uheader ( "U", runTime.timeName(), @@ -74,7 +74,7 @@ int main(int argc, char *argv[]) ); // Check U exists - if (Uheader.typeHeaderOk(true)) + if (Uheader.headerOk()) { Info<< " Reading U" << endl; volVectorField U(Uheader, mesh); diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C index a03afc206a..24b25675eb 100644 --- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C +++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C @@ -189,11 +189,11 @@ int main(int argc, char *argv[]) // Dictionary to control refinement const word dictName("refineMeshDict"); - IOobject dictIO(systemDictIO(dictName, args, runTime)); + typeIOobject dictIO(systemDictIO(dictName, args, runTime)); dictionary refineDict; if (readDict) { - if (dictIO.typeHeaderOk(true)) + if (dictIO.headerOk()) { Info<< "Refining according to " << dictIO.path(typeGlobalFile()) << nl << endl; @@ -209,7 +209,7 @@ int main(int argc, char *argv[]) } else if (!refineAllCells) { - if (dictIO.typeHeaderOk(true)) + if (dictIO.headerOk()) { Info<< "Refining according to " << dictIO.path(typeGlobalFile()) << nl << endl; diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 8a0b855962..6f6c29f9c5 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -575,7 +575,7 @@ autoPtr createRegionMesh { // Create dummy system/fv* { - IOobject io + typeIOobject io ( "fvSchemes", mesh.time().system(), @@ -586,9 +586,9 @@ autoPtr createRegionMesh false ); - Info<< "Testing:" << io.objectPath() << endl; + Info<< "Testing:" << io.objectPath() << endl; - if (!io.typeHeaderOk(true)) + if (!io.headerOk()) { Info<< "Writing dummy " << regionName/io.name() << endl; dictionary dummyDict; @@ -603,7 +603,7 @@ autoPtr createRegionMesh } } { - IOobject io + typeIOobject io ( "fvSolution", mesh.time().system(), @@ -614,8 +614,7 @@ autoPtr createRegionMesh false ); - if (!io.typeHeaderOk(true)) - // if (!exists(io.objectPath())) + if (!io.headerOk()) { Info<< "Writing dummy " << regionName/io.name() << endl; dictionary dummyDict; diff --git a/applications/utilities/mesh/manipulation/topoSet/Make/options b/applications/utilities/mesh/manipulation/topoSet/Make/options index 54c035b8f5..b90bc48df7 100644 --- a/applications/utilities/mesh/manipulation/topoSet/Make/options +++ b/applications/utilities/mesh/manipulation/topoSet/Make/options @@ -2,4 +2,5 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ + -lfiniteVolume \ -lmeshTools diff --git a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C index 14f89c3fd0..055249d662 100644 --- a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C +++ b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C @@ -89,7 +89,7 @@ bool writeZones(const word& name, const fileName& meshDir, Time& runTime) bool writeOk = false; - if (io.typeHeaderOk(false)) + if (io.headerOk()) { Info<< " Reading " << io.headerClassName() << " : " << name << endl; @@ -199,7 +199,7 @@ bool writeOptionalMeshObject bool writeOk = false; - bool haveFile = io.typeHeaderOk>(false); + bool haveFile = io.headerOk(); // Make sure all know if there is a valid class name stringList classNames(1, io.headerClassName()); diff --git a/applications/utilities/miscellaneous/foamFormatConvert/writeMeshObject.H b/applications/utilities/miscellaneous/foamFormatConvert/writeMeshObject.H index 18d2098b38..dc35152135 100644 --- a/applications/utilities/miscellaneous/foamFormatConvert/writeMeshObject.H +++ b/applications/utilities/miscellaneous/foamFormatConvert/writeMeshObject.H @@ -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 @@ -48,7 +48,7 @@ inline bool writeMeshObject bool disableHeaderChecking = false ) { - IOobject io + typeIOobject io ( name, runTime.timeName(), @@ -61,11 +61,7 @@ inline bool writeMeshObject bool writeOk = false; - if - ( - io.typeHeaderOk(false) - && io.headerClassName() == CheckType::typeName - ) + if (io.headerOk()) { Info<< " Reading " << io.headerClassName() << " : " << name << endl; diff --git a/applications/utilities/miscellaneous/patchSummary/patchSummary.C b/applications/utilities/miscellaneous/patchSummary/patchSummary.C index a0d424aade..8788cb1982 100644 --- a/applications/utilities/miscellaneous/patchSummary/patchSummary.C +++ b/applications/utilities/miscellaneous/patchSummary/patchSummary.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-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) IOobject::MUST_READ ); - if (obj.typeHeaderOk(false)) + if (obj.headerOk()) { addToFieldList(vsf, obj, objI, mesh); addToFieldList(vvf, obj, objI, mesh); diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index 22c0883f28..c23c05a043 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -382,7 +382,7 @@ int main(int argc, char *argv[]) label nProcs = fileHandler().nProcs(runTime.path(), regionDir); // Get the dictionary IO - const IOobject dictIO + const typeIOobject dictIO ( systemDictIO(dictName, args, runTime, regionName) ); @@ -432,13 +432,13 @@ int main(int argc, char *argv[]) IOobject::NO_WRITE, false ), - dictIO.objectPath() + dictIO.objectPath() ); // Decompose the mesh if (!decomposeFieldsOnly) { - mesh.decomposeMesh(dictIO.objectPath()); + mesh.decomposeMesh(dictIO.objectPath()); mesh.writeDecomposition(decomposeSets); diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C index a56541a3bd..a41c52eaa4 100644 --- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C +++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C @@ -331,9 +331,8 @@ int main(int argc, char *argv[]) // Problem: faceCompactIOList recognises both 'faceList' and - // 'faceCompactList' so we should be lenient when doing - // typeHeaderOk - if (!facesIO.typeHeaderOk(false)) + // 'faceCompactList' so we cannot check the type + if (!facesIO.headerOk()) { Info<< "No mesh." << nl << endl; continue; diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H index 47a3540da7..76b55aada7 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H @@ -16,6 +16,6 @@ for (label n1=0; n1(false); + ).headerOk(); } } diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H index d4027ad1c5..a0b096e328 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H @@ -9,7 +9,7 @@ if (Times.size() > 1) { if (Times[timeI].name() != mesh.pointsInstance()) { - IOobject io + typeIOobject io ( "points", Times[timeI].name(), @@ -17,7 +17,8 @@ if (Times.size() > 1) mesh, IOobject::NO_READ ); - if (io.typeHeaderOk(true)) + + if (io.headerOk()) { meshMoving = true; break; diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C index 0958680bff..14326151ba 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.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-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -584,10 +584,8 @@ int main(int argc, char *argv[]) IOobject::MUST_READ ); - bool fieldExists = fieldObject.typeHeaderOk> - ( - false - ); + bool fieldExists = fieldObject.headerOk(); + if (fieldType == scalarIOField::typeName) { ensightCloudField diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H index 454cb3ebb6..00a3f283b3 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H @@ -6,13 +6,13 @@ if (timeDirs.size() > 1) hasMovingMesh = true; for (label i=0; i < timeDirs.size() && hasMovingMesh; ++i) { - hasMovingMesh = IOobject + hasMovingMesh = typeIOobject ( "points", timeDirs[i].name(), polyMesh::meshSubDir, mesh, IOobject::NO_READ - ).typeHeaderOk(true); + ).headerOk(); } } diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H index 12d7674501..553d7140fc 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H @@ -13,7 +13,7 @@ && runTime.timeName() != "0" ) { - IOobject io + typeIOobject io ( "time", runTime.timeName(), @@ -24,7 +24,7 @@ false ); - if (io.typeHeaderOk(true)) + if (io.headerOk()) { io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; IOdictionary timeObject(io); @@ -34,7 +34,7 @@ else { Info<< "skip ... missing entry " - << io.objectPath() << endl; + << io.objectPath() << endl; continue; } } diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/moveMesh.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/moveMesh.H index f894e2c136..c92d52603a 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/moveMesh.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/moveMesh.H @@ -1,5 +1,5 @@ { - IOobject io + typeIOobject io ( "points", runTime.timeName(), @@ -7,7 +7,7 @@ mesh ); - if (io.typeHeaderOk(true)) + if (io.headerOk()) { // Read new points io.readOpt() = IOobject::MUST_READ; diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H index 03a76e5856..4c65e583e3 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H @@ -71,13 +71,7 @@ for (label i=0; i < nTypes; i++) IOobject::NO_READ ); - if - ( - lagrangianHeader.typeHeaderOk>> - ( - false - ) - ) + if (lagrangianHeader.headerOk()) { Cloud particles(mesh, cloud::defaultName); diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/moveMesh.H b/applications/utilities/postProcessing/dataConversion/foamToGMV/moveMesh.H index c1a1f8dee7..c85f55efaa 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/moveMesh.H +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/moveMesh.H @@ -1,4 +1,4 @@ -IOobject ioPoints +typeIOobject ioPoints ( "points", runTime.timeName(), @@ -6,7 +6,7 @@ IOobject ioPoints mesh ); -if (ioPoints.typeHeaderOk(true)) +if (ioPoints.headerOk()) { Info<< "new points available" << endl; // Reading new points diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.C b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.C index bf30c483cc..3f285ff716 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.C +++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.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-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -586,13 +586,13 @@ double* Foam::vtkPVFoam::findTimes(int& nTimeSteps) if ( - IOobject + typeIOobject ( "points", timeName, meshDir_, runTime - ).typeHeaderOk(true) + ).headerOk() ) { break; diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamFields.C b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamFields.C index a6344fc67d..8a2ffa30a2 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamFields.C +++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamFields.C @@ -120,7 +120,7 @@ void Foam::vtkPVFoam::convertFields(vtkMultiBlockDataSet* output) forAllConstIter(IOobjectList, objects, iter) { Info<< " " << iter()->name() - << " == " << iter()->objectPath() << nl; + << " == " << iter()->objectPath(false) << nl; } printMemory(); } diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamUpdateInfo.C b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamUpdateInfo.C index 70891352a0..73a764db06 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamUpdateInfo.C +++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamUpdateInfo.C @@ -124,7 +124,7 @@ Foam::wordList Foam::vtkPVFoam::getZoneNames(const word& zoneType) const false ); - if (ioObj.typeHeaderOk(false)) + if (ioObj.headerOk()) { zonesEntries zones(ioObj); @@ -321,7 +321,7 @@ void Foam::vtkPVFoam::updateInfoPatches { // Mesh not loaded - read from file // but this could fail if we've supplied a bad region name - IOobject ioObj + typeIOobject ioObj ( "boundary", dbPtr_().findInstance @@ -338,7 +338,7 @@ void Foam::vtkPVFoam::updateInfoPatches ); // This should only ever fail if the mesh region doesn't exist - if (ioObj.typeHeaderOk(true)) + if (ioObj.headerOk()) { polyBoundaryMeshEntries patchEntries(ioObj); diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H index 164602e22d..0da7ed1e0d 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H @@ -171,7 +171,7 @@ int USERD_set_filenames false ); - if (sprayHeader.typeHeaderOk>(false)) + if (sprayHeader.headerOk()) { Info<< "[Found lagrangian]" << endl; diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldScalar.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldScalar.H index 518b53bb18..2beba1f74f 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldScalar.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldScalar.H @@ -1,10 +1,9 @@ - if (nVar >= Num_variables - nSprayVariables) { return Z_UNDEF; } -IOobject fieldObjectPtr +typeIOobject fieldObjectPtr ( fieldNames[var2field[nVar]], runTime.timeName(), @@ -12,7 +11,7 @@ IOobject fieldObjectPtr IOobject::NO_READ ); -if (!fieldObjectPtr.typeHeaderOk(true)) +if (!fieldObjectPtr.headerOk()) { return Z_UNDEF; } diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldTensor.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldTensor.H index f8b45ec83c..19bb27f5e4 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldTensor.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldTensor.H @@ -4,7 +4,7 @@ if (nVar >= Num_variables - nSprayVariables) } -IOobject fieldObjectPtr +typeIOobject fieldObjectPtr ( fieldNames[var2field[nVar]], runTime.timeName(), @@ -12,7 +12,7 @@ IOobject fieldObjectPtr IOobject::NO_READ ); -if (!fieldObjectPtr.typeHeaderOk(true)) +if (!fieldObjectPtr.headerOk()) { return Z_UNDEF; } diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldVector.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldVector.H index ec94dbf460..d5652d2518 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldVector.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldVector.H @@ -4,7 +4,7 @@ if (nVar >= Num_variables - nSprayVariables) } -IOobject fieldObjectPtr +typeIOobject fieldObjectPtr ( fieldNames[var2field[nVar]], runTime.timeName(), @@ -12,7 +12,7 @@ IOobject fieldObjectPtr IOobject::NO_READ ); -if (!fieldObjectPtr.typeHeaderOk(true)) +if (!fieldObjectPtr.headerOk()) { return Z_UNDEF; } diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldScalar.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldScalar.H index 549a80f64f..b1325d9757 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldScalar.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldScalar.H @@ -5,7 +5,7 @@ if (nVar >= Num_variables - nSprayVariables) return Z_UNDEF; } -IOobject fieldObjectPtr +typeIOobject fieldObjectPtr ( fieldNames[var2field[nVar]], runTime.timeName(), @@ -13,7 +13,7 @@ IOobject fieldObjectPtr IOobject::NO_READ ); -if (!fieldObjectPtr.typeHeaderOk(true)) +if (!fieldObjectPtr.headerOk()) { return Z_UNDEF; } diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldTensor.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldTensor.H index 0aed2ac26e..b9954689fb 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldTensor.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldTensor.H @@ -5,7 +5,7 @@ if (nVar >= Num_variables - nSprayVariables) return Z_UNDEF; } -IOobject fieldObjectPtr +typeIOobject fieldObjectPtr ( fieldNames[var2field[nVar]], runTime.timeName(), @@ -13,7 +13,7 @@ IOobject fieldObjectPtr IOobject::NO_READ ); -if (!fieldObjectPtr.typeHeaderOk(true)) +if (!fieldObjectPtr.headerOk()) { return Z_UNDEF; } diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldVector.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldVector.H index 4c6fe3832f..6a8f139955 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldVector.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldVector.H @@ -5,7 +5,7 @@ if (nVar >= Num_variables - nSprayVariables) return Z_UNDEF; } -IOobject fieldObjectPtr +typeIOobject fieldObjectPtr ( fieldNames[var2field[nVar]], runTime.timeName(), @@ -13,7 +13,7 @@ IOobject fieldObjectPtr IOobject::NO_READ ); -if (!fieldObjectPtr.typeHeaderOk(true)) +if (!fieldObjectPtr.headerOk()) { return Z_UNDEF; } diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H b/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H index 83a7c12046..b257d73645 100644 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H +++ b/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H @@ -1,4 +1,4 @@ - IOobject UMeanHeader + typeIOobject UMeanHeader ( "UMean", runTime.timeName(), @@ -6,7 +6,7 @@ IOobject::MUST_READ ); - if (!UMeanHeader.typeHeaderOk(true)) + if (!UMeanHeader.headerOk()) { Info<< " No UMean field" << endl; continue; diff --git a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C index 467317e5c3..1bc77c5567 100644 --- a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C +++ b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C @@ -174,7 +174,7 @@ int main(int argc, char *argv[]) epsilon.write(); // Turbulence omega - IOobject omegaHeader + typeIOobject omegaHeader ( "omega", runTime.timeName(), @@ -184,7 +184,7 @@ int main(int argc, char *argv[]) false ); - if (omegaHeader.typeHeaderOk(true)) + if (omegaHeader.headerOk()) { volScalarField omega(omegaHeader, mesh); @@ -202,7 +202,7 @@ int main(int argc, char *argv[]) } // Turbulence nuTilda - IOobject nuTildaHeader + typeIOobject nuTildaHeader ( "nuTilda", runTime.timeName(), @@ -212,7 +212,7 @@ int main(int argc, char *argv[]) false ); - if (nuTildaHeader.typeHeaderOk(true)) + if (nuTildaHeader.headerOk()) { volScalarField nuTilda(nuTildaHeader, mesh); nuTilda = nut; diff --git a/applications/utilities/preProcessing/mapFields/Make/options b/applications/utilities/preProcessing/mapFields/Make/options index 7bd964094e..579fec7157 100644 --- a/applications/utilities/preProcessing/mapFields/Make/options +++ b/applications/utilities/preProcessing/mapFields/Make/options @@ -1,4 +1,4 @@ -EXE_INC = \ +EXE_INC = -ggdb3 \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ diff --git a/applications/utilities/preProcessing/mapFields/MapConsistentVolFields.H b/applications/utilities/preProcessing/mapFields/MapConsistentVolFields.H index 922027b677..8dcaffa00f 100644 --- a/applications/utilities/preProcessing/mapFields/MapConsistentVolFields.H +++ b/applications/utilities/preProcessing/mapFields/MapConsistentVolFields.H @@ -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 @@ -59,7 +59,7 @@ void MapConsistentVolFields // Read field fieldType fieldSource(*fieldIter(), meshSource); - IOobject fieldTargetIOobject + typeIOobject fieldTargetIOobject ( fieldIter()->name(), meshTarget.time().timeName(), @@ -68,7 +68,7 @@ void MapConsistentVolFields IOobject::AUTO_WRITE ); - if (fieldTargetIOobject.typeHeaderOk(true)) + if (fieldTargetIOobject.headerOk()) { // Read fieldTarget fieldType fieldTarget diff --git a/applications/utilities/preProcessing/mapFields/MapVolFields.H b/applications/utilities/preProcessing/mapFields/MapVolFields.H index 1e74a3e483..a570b36faa 100644 --- a/applications/utilities/preProcessing/mapFields/MapVolFields.H +++ b/applications/utilities/preProcessing/mapFields/MapVolFields.H @@ -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 @@ -53,7 +53,7 @@ void MapVolFields forAllIter(IOobjectList, fields, fieldIter) { - IOobject fieldTargetIOobject + typeIOobject fieldTargetIOobject ( fieldIter()->name(), meshTarget.time().timeName(), @@ -62,7 +62,7 @@ void MapVolFields IOobject::AUTO_WRITE ); - if (fieldTargetIOobject.typeHeaderOk(true)) + if (fieldTargetIOobject.headerOk()) { Info<< " interpolating " << fieldIter()->name() << endl; diff --git a/applications/utilities/preProcessing/mapFields/UnMapped.H b/applications/utilities/preProcessing/mapFields/UnMapped.H index 5b92eb6562..7357060be5 100644 --- a/applications/utilities/preProcessing/mapFields/UnMapped.H +++ b/applications/utilities/preProcessing/mapFields/UnMapped.H @@ -41,7 +41,7 @@ void UnMapped(const IOobjectList& objects) forAllConstIter(IOobjectList, fields, fieldIter) { - mvBak(fieldIter()->objectPath(), "unmapped"); + mvBak(fieldIter()->objectPath(false), "unmapped"); } } diff --git a/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H b/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H index d8fb072627..fae37a73a3 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H +++ b/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H @@ -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 @@ -141,7 +141,7 @@ void MapVolFields { const fieldType fieldSource(*fieldIter(), meshSource); - IOobject targetIO + typeIOobject targetIO ( fieldName, meshTarget.time().timeName(), @@ -149,7 +149,7 @@ void MapVolFields IOobject::MUST_READ ); - if (targetIO.typeHeaderOk(true)) + if (targetIO.headerOk()) { Info<< " interpolating onto existing field " << fieldName << endl; diff --git a/applications/utilities/preProcessing/mapFieldsPar/UnMapped.H b/applications/utilities/preProcessing/mapFieldsPar/UnMapped.H index 5b92eb6562..7357060be5 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/UnMapped.H +++ b/applications/utilities/preProcessing/mapFieldsPar/UnMapped.H @@ -41,7 +41,7 @@ void UnMapped(const IOobjectList& objects) forAllConstIter(IOobjectList, fields, fieldIter) { - mvBak(fieldIter()->objectPath(), "unmapped"); + mvBak(fieldIter()->objectPath(false), "unmapped"); } } diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C index 2f3f6992aa..6f91d0c1ff 100644 --- a/applications/utilities/preProcessing/setFields/setFields.C +++ b/applications/utilities/preProcessing/setFields/setFields.C @@ -58,7 +58,7 @@ bool setCellFieldType word fieldName(fieldValueStream); // Check the current time directory - IOobject fieldHeader + typeIOobject fieldHeader ( fieldName, mesh.time().timeName(), @@ -67,9 +67,9 @@ bool setCellFieldType ); // Check the "constant" directory - if (!fieldHeader.typeHeaderOk(true)) + if (!fieldHeader.headerOk()) { - fieldHeader = IOobject + fieldHeader = typeIOobject ( fieldName, mesh.time().constant(), @@ -79,7 +79,7 @@ bool setCellFieldType } // Check field exists - if (fieldHeader.typeHeaderOk(true)) + if (fieldHeader.headerOk()) { Info<< " Setting internal values of " << fieldHeader.headerClassName() @@ -204,7 +204,7 @@ bool setFaceFieldType word fieldName(fieldValueStream); // Check the current time directory - IOobject fieldHeader + typeIOobject fieldHeader ( fieldName, mesh.time().timeName(), @@ -213,9 +213,9 @@ bool setFaceFieldType ); // Check the "constant" directory - if (!fieldHeader.typeHeaderOk(true)) + if (!fieldHeader.headerOk()) { - fieldHeader = IOobject + fieldHeader = typeIOobject ( fieldName, mesh.time().constant(), @@ -225,7 +225,7 @@ bool setFaceFieldType } // Check field exists - if (fieldHeader.typeHeaderOk(true)) + if (fieldHeader.headerOk()) { Info<< " Setting patchField values of " << fieldHeader.headerClassName() diff --git a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C index 4ba1d85088..cd94c5deda 100644 --- a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C +++ b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C @@ -156,7 +156,7 @@ int main(int argc, char *argv[]) Pstream::scatterList(meshBb); } - IOobject io + typeIOobject io ( surfFileName, runTime.constant(), @@ -167,7 +167,7 @@ int main(int argc, char *argv[]) ); // Look for file (using searchableSurface rules) - const fileName actualPath(typeFilePath(io)); + const fileName actualPath(io.filePath()); fileName localPath(actualPath); localPath.replace(runTime.rootPath() + '/', ""); diff --git a/src/MomentumTransportModels/momentumTransportModels/laminar/Maxwell/Maxwell.C b/src/MomentumTransportModels/momentumTransportModels/laminar/Maxwell/Maxwell.C index 631bde75ed..f766efb810 100644 --- a/src/MomentumTransportModels/momentumTransportModels/laminar/Maxwell/Maxwell.C +++ b/src/MomentumTransportModels/momentumTransportModels/laminar/Maxwell/Maxwell.C @@ -159,7 +159,7 @@ Maxwell::Maxwell forAll(sigmas_, modei) { - IOobject header + typeIOobject header ( IOobject::groupName("sigma" + name(modei), alphaRhoPhi.group()), this->runTime_.timeName(), @@ -168,7 +168,7 @@ Maxwell::Maxwell ); // Check if mode field exists and can be read - if (header.typeHeaderOk(true)) + if (header.headerOk()) { Info<< " Reading mode stress field " << header.name() << endl; diff --git a/src/MomentumTransportModels/momentumTransportModels/momentumTransportModel.C b/src/MomentumTransportModels/momentumTransportModels/momentumTransportModel.C index 744ad74fc4..e9b853fdcb 100644 --- a/src/MomentumTransportModels/momentumTransportModels/momentumTransportModel.C +++ b/src/MomentumTransportModels/momentumTransportModels/momentumTransportModel.C @@ -45,7 +45,7 @@ Foam::IOdictionary Foam::momentumTransportModel::readModelDict bool registerObject ) { - IOobject momentumTransport + typeIOobject momentumTransport ( IOobject::groupName(typeName, group), obr.time().constant(), @@ -55,13 +55,13 @@ Foam::IOdictionary Foam::momentumTransportModel::readModelDict registerObject ); - if (momentumTransport.typeHeaderOk(true)) + if (momentumTransport.headerOk()) { return momentumTransport; } else { - IOobject turbulenceProperties + typeIOobject turbulenceProperties ( IOobject::groupName("turbulenceProperties", group), obr.time().constant(), @@ -71,7 +71,7 @@ Foam::IOdictionary Foam::momentumTransportModel::readModelDict registerObject ); - if (turbulenceProperties.typeHeaderOk(true)) + if (turbulenceProperties.headerOk()) { return turbulenceProperties; } diff --git a/src/OpenFOAM/db/IOobject/IOobject.H b/src/OpenFOAM/db/IOobject/IOobject.H index 0004f8fe54..9768f97deb 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.H +++ b/src/OpenFOAM/db/IOobject/IOobject.H @@ -61,6 +61,13 @@ Description - \par NO_WRITE No automatic write on destruction but can be written explicitly +Class + Foam::typeIOobject + +Description + Templated form of IOobject providing type information for file reading and + header type checking. + SourceFiles IOobject.C IOobjectReadHeader.C @@ -134,6 +141,7 @@ public: static const NamedEnum fileCheckTypesNames; + private: // Private Data @@ -176,6 +184,11 @@ protected: //- Set the object state to bad void setBad(const string&); + //- Read header using typeGlobalFile to find file + // and optionally check the headerClassName against Type + template + bool typeHeaderOk(const bool checkType); + public: @@ -411,11 +424,6 @@ public: return path(global)/name(); } - //- Return complete path + object name including the processor - // sub-directory for a parallel run if globalFile is false for Type - template - inline fileName objectPath() const; - //- Return the path relative to the case directory fileName relativePath() const; @@ -438,10 +446,9 @@ public: //- Read header bool readHeader(Istream&); - //- Read header (uses typeFilePath to find file) and check header - // info. Optionally checks headerClassName against type - template - bool typeHeaderOk(const bool checkType = true); + //- Read header of local object without type-checking + // Mainly used to create IOobjectLists + bool headerOk(); //- Helper: warn that type does not support re-reading template @@ -516,19 +523,6 @@ inline bool typeGlobalFile() return typeGlobal(); } -//- Template function for obtaining filePath -template -inline fileName typeFilePath(const IOobject& io) -{ - return io.filePath(Type::typeName, typeGlobalFile()); -} - -template -inline fileName IOobject::objectPath() const -{ - return objectPath(typeGlobalFile()); -} - inline IOobject unregister(const IOobject& io) { IOobject uio(io); @@ -537,6 +531,53 @@ inline IOobject unregister(const IOobject& io) } +/*---------------------------------------------------------------------------*\ + Class typeIOobject Declaration +\*---------------------------------------------------------------------------*/ + +template +class typeIOobject +: + public IOobject +{ + +public: + + // Constructors + + using IOobject::IOobject; + + typeIOobject(const IOobject& io) + : + IOobject(io) + {} + + + // Member Functions + + // Reading + + //- Read header (uses typeGlobalFile to find file) and check + bool headerOk(); + + using IOobject::objectPath; + + //- Return the object path for this Type + inline fileName objectPath() const + { + return objectPath(typeGlobalFile()); + } + + using IOobject::filePath; + + //- Return the path for the file for this Type + inline fileName filePath() const + { + return filePath(Type::typeName, typeGlobalFile()); + } +}; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C b/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C index 209d465691..465d2e7272 100644 --- a/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C +++ b/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C @@ -28,6 +28,12 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +bool Foam::IOobject::headerOk() +{ + return typeHeaderOk(false); +} + + bool Foam::IOobject::readHeader(Istream& is) { if (IOobject::debug) diff --git a/src/OpenFOAM/db/IOobject/IOobjectTemplates.C b/src/OpenFOAM/db/IOobject/IOobjectTemplates.C index 658479d010..b997a26151 100644 --- a/src/OpenFOAM/db/IOobject/IOobjectTemplates.C +++ b/src/OpenFOAM/db/IOobject/IOobjectTemplates.C @@ -49,7 +49,10 @@ bool Foam::IOobject::typeHeaderOk(const bool checkType) // Determine local status if (!masterOnly || Pstream::master()) { - const fileName fName(typeFilePath(*this)); + const fileName fName + ( + filePath(Type::typeName, typeGlobalFile()) + ); ok = fp.readHeader(*this, fName, Type::typeName); if (ok && checkType && headerClassName_ != Type::typeName) @@ -88,4 +91,11 @@ void Foam::IOobject::warnNoRereading() const } +template +bool Foam::typeIOobject::headerOk() +{ + return typeHeaderOk(true); +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/db/IOobjectList/IOobjectList.C b/src/OpenFOAM/db/IOobjectList/IOobjectList.C index c698c1df49..ea64485816 100644 --- a/src/OpenFOAM/db/IOobjectList/IOobjectList.C +++ b/src/OpenFOAM/db/IOobjectList/IOobjectList.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-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,6 @@ License #include "IOobjectList.H" #include "Time.H" #include "OSspecific.H" -#include "IOList.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -57,7 +56,6 @@ Foam::IOobjectList::IOobjectList newInstance ); - forAll(ObjectNames, i) { IOobject* objectPtr = new IOobject @@ -72,7 +70,7 @@ Foam::IOobjectList::IOobjectList ); // Use object with local scope - if (objectPtr->typeHeaderOk>(false)) + if (objectPtr->headerOk()) { insert(ObjectNames[i], objectPtr); } diff --git a/src/OpenFOAM/db/regIOobject/regIOobject.C b/src/OpenFOAM/db/regIOobject/regIOobject.C index 74c556ff0c..1dfe88a1de 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobject.C +++ b/src/OpenFOAM/db/regIOobject/regIOobject.C @@ -421,15 +421,15 @@ Foam::fileName Foam::regIOobject::filePath() const bool Foam::regIOobject::headerOk() { - // Note: Should be consistent with IOobject::typeHeaderOk(false) + // Note: Should be consistent with typeIOobject::headerOk() bool ok = true; - fileName fName(filePath()); + const fileName fName(filePath()); ok = Foam::fileHandler().readHeader(*this, fName, type()); - if (!ok && IOobject::debug) + if (IOobject::debug && (!ok || headerClassName() != type())) { IOWarningInFunction(fName) << "failed to read header of file " << objectPath() diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index 37259eab28..f2410313f3 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -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 @@ -110,10 +110,7 @@ bool Foam::GeometricField::readIfPresent() else if ( this->readOpt() == IOobject::READ_IF_PRESENT - && this->template typeHeaderOk> - ( - true - ) + && this->headerOk() ) { readFields(); @@ -141,7 +138,7 @@ template class PatchField, class GeoMesh> bool Foam::GeometricField::readOldTimeIfPresent() { // Read the old time field if present - IOobject field0 + typeIOobject> field0 ( this->name() + "_0", this->time().timeName(), @@ -151,13 +148,7 @@ bool Foam::GeometricField::readOldTimeIfPresent() this->registerObject() ); - if - ( - field0.template typeHeaderOk> - ( - true - ) - ) + if (field0.headerOk()) { if (debug) { diff --git a/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C b/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C index f3a75c7ca7..8b2e57ae51 100644 --- a/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C +++ b/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C @@ -370,9 +370,8 @@ bool Foam::fileOperation::exists(IOobject& io) const } else { - ok = - isFile(objPath) - && io.typeHeaderOk>(false);// object with local scope + // IOobject::headerOk assumes local scope + ok = isFile(objPath) && io.headerOk(); } if (!ok) @@ -389,9 +388,8 @@ bool Foam::fileOperation::exists(IOobject& io) const } else { - ok = - isFile(originalPath) - && io.typeHeaderOk>(false); + // IOobject::headerOk assumes local scope + ok = isFile(originalPath) && io.headerOk(); } } } diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index a8903d8317..28ffabfa4d 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.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-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -1858,7 +1858,7 @@ const Foam::labelList& Foam::globalMeshData::sharedPointGlobalLabels() const ); labelList& sharedPointGlobalLabels = sharedPointGlobalLabelsPtr_(); - IOobject addrHeader + typeIOobject addrHeader ( "pointProcAddressing", mesh_.facesInstance()/mesh_.meshSubDir, @@ -1866,7 +1866,7 @@ const Foam::labelList& Foam::globalMeshData::sharedPointGlobalLabels() const IOobject::MUST_READ ); - if (addrHeader.typeHeaderOk(true)) + if (addrHeader.headerOk()) { // There is a pointProcAddressing file so use it to get labels // on the original mesh diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index c638081595..2337430f95 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -137,7 +137,7 @@ void Foam::polyMesh::calcDirections() const Foam::autoPtr Foam::polyMesh::readTetBasePtIs() const { - IOobject io + typeIOobject io ( "tetBasePtIs", instance(), @@ -147,7 +147,7 @@ Foam::autoPtr Foam::polyMesh::readTetBasePtIs() const IOobject::NO_WRITE ); - if (io.typeHeaderOk()) + if (io.headerOk()) { return autoPtr(new labelIOList(io)); } @@ -1250,7 +1250,7 @@ Foam::IOobject Foam::polyMesh::points0IO { // Check that points0 are actually in constant directory - IOobject io + typeIOobject io ( "points0", instance, @@ -1261,7 +1261,7 @@ Foam::IOobject Foam::polyMesh::points0IO false ); - if (io.typeHeaderOk()) + if (io.headerOk()) { return io; } diff --git a/src/OpenFOAM/meshes/preservePatchTypes/preservePatchTypes.C b/src/OpenFOAM/meshes/preservePatchTypes/preservePatchTypes.C index 160c92e6e8..331d7b370e 100644 --- a/src/OpenFOAM/meshes/preservePatchTypes/preservePatchTypes.C +++ b/src/OpenFOAM/meshes/preservePatchTypes/preservePatchTypes.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-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,7 +46,7 @@ void Foam::preservePatchTypes // Read boundary file as single dictionary { - IOobject patchEntriesHeader + typeIOobject patchEntriesHeader ( "boundary", meshInstance, @@ -57,7 +57,7 @@ void Foam::preservePatchTypes false ); - if (patchEntriesHeader.typeHeaderOk(true)) + if (patchEntriesHeader.headerOk()) { // Create a list of entries from the boundary file. polyBoundaryMeshEntries patchEntries(patchEntriesHeader); diff --git a/src/ThermophysicalTransportModels/laminar/laminarThermophysicalTransportModel/laminarThermophysicalTransportModel.C b/src/ThermophysicalTransportModels/laminar/laminarThermophysicalTransportModel/laminarThermophysicalTransportModel.C index 154fec2113..14c8508ec3 100644 --- a/src/ThermophysicalTransportModels/laminar/laminarThermophysicalTransportModel/laminarThermophysicalTransportModel.C +++ b/src/ThermophysicalTransportModels/laminar/laminarThermophysicalTransportModel/laminarThermophysicalTransportModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -82,7 +82,7 @@ Foam::laminarThermophysicalTransportModel const thermoModel& thermo ) { - IOobject header + typeIOobject header ( IOobject::groupName ( @@ -96,7 +96,7 @@ Foam::laminarThermophysicalTransportModel false ); - if (header.typeHeaderOk(true)) + if (header.headerOk()) { IOdictionary modelDict(header); diff --git a/src/ThermophysicalTransportModels/turbulence/LES/LESThermophysicalTransportModel/LESThermophysicalTransportModel.C b/src/ThermophysicalTransportModels/turbulence/LES/LESThermophysicalTransportModel/LESThermophysicalTransportModel.C index 8d82ef73d9..e9f7d994fc 100644 --- a/src/ThermophysicalTransportModels/turbulence/LES/LESThermophysicalTransportModel/LESThermophysicalTransportModel.C +++ b/src/ThermophysicalTransportModels/turbulence/LES/LESThermophysicalTransportModel/LESThermophysicalTransportModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -82,7 +82,7 @@ Foam::LESThermophysicalTransportModel const thermoModel& thermo ) { - IOobject header + typeIOobject header ( IOobject::groupName ( @@ -96,7 +96,7 @@ Foam::LESThermophysicalTransportModel false ); - if (header.typeHeaderOk(true)) + if (header.headerOk()) { IOdictionary modelDict(header); diff --git a/src/ThermophysicalTransportModels/turbulence/RAS/RASThermophysicalTransportModel/RASThermophysicalTransportModel.C b/src/ThermophysicalTransportModels/turbulence/RAS/RASThermophysicalTransportModel/RASThermophysicalTransportModel.C index 12f30e60fe..e00596da93 100644 --- a/src/ThermophysicalTransportModels/turbulence/RAS/RASThermophysicalTransportModel/RASThermophysicalTransportModel.C +++ b/src/ThermophysicalTransportModels/turbulence/RAS/RASThermophysicalTransportModel/RASThermophysicalTransportModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -82,7 +82,7 @@ Foam::RASThermophysicalTransportModel const thermoModel& thermo ) { - IOobject header + typeIOobject header ( IOobject::groupName ( @@ -96,7 +96,7 @@ Foam::RASThermophysicalTransportModel false ); - if (header.typeHeaderOk(true)) + if (header.headerOk()) { IOdictionary modelDict(header); diff --git a/src/combustionModels/combustionModel/combustionModel.C b/src/combustionModels/combustionModel/combustionModel.C index 60545c1c19..056ffe4f98 100644 --- a/src/combustionModels/combustionModel/combustionModel.C +++ b/src/combustionModels/combustionModel/combustionModel.C @@ -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 @@ -47,7 +47,7 @@ Foam::IOobject Foam::combustionModel::createIOobject const word& combustionProperties ) const { - IOobject io + typeIOobject io ( thermo.phasePropertyName(combustionProperties), thermo.T().mesh().time().constant(), @@ -56,7 +56,7 @@ Foam::IOobject Foam::combustionModel::createIOobject IOobject::NO_WRITE ); - if (io.typeHeaderOk(true)) + if (io.headerOk()) { io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; return io; diff --git a/src/combustionModels/combustionModel/combustionModelNew.C b/src/combustionModels/combustionModel/combustionModelNew.C index 28f64d8415..526ed49284 100644 --- a/src/combustionModels/combustionModel/combustionModelNew.C +++ b/src/combustionModels/combustionModel/combustionModelNew.C @@ -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 @@ -35,7 +35,7 @@ Foam::autoPtr Foam::combustionModel::New const word& combustionProperties ) { - IOobject combIO + typeIOobject combIO ( IOobject ( @@ -49,7 +49,7 @@ Foam::autoPtr Foam::combustionModel::New ); word modelType(combustionModels::noCombustion::typeName); - if (combIO.typeHeaderOk(false)) + if (combIO.headerOk()) { IOdictionary(combIO).lookup(combustionModel::typeName) >> modelType; } diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C index fa86056ea4..784f410673 100644 --- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C +++ b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C @@ -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 @@ -30,9 +30,9 @@ License Foam::autoPtr Foam::dynamicFvMesh::New(const IOobject& io) { - IOobject dictHeader(dynamicMeshDictIOobject(io)); + typeIOobject dictHeader(dynamicMeshDictIOobject(io)); - if (dictHeader.typeHeaderOk(true)) + if (dictHeader.headerOk()) { IOdictionary dict(dictHeader); diff --git a/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.C b/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.C index ee139a34aa..09549824dc 100644 --- a/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.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-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -111,19 +111,16 @@ Foam::componentDisplacementMotionSolver::componentDisplacementMotionSolver << "Number of points in mesh " << mesh.nPoints() << " differs from number of points " << points0_.size() << " read from file " - << typeFilePath - ( - IOobject - ( - "points", - mesh.time().constant(), - polyMesh::meshSubDir, - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ) - ) + << typeIOobject + ( + "points", + mesh.time().constant(), + polyMesh::meshSubDir, + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ).filePath() << exit(FatalError); } } diff --git a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C index 01adf0ced7..311cee53ea 100644 --- a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,19 +51,16 @@ Foam::points0MotionSolver::points0MotionSolver << "Number of points in mesh " << mesh.nPoints() << " differs from number of points " << points0_.size() << " read from file " - << typeFilePath - ( - IOobject - ( - "points", - mesh.time().constant(), - polyMesh::meshSubDir, - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ) - ) + << typeIOobject + ( + "points", + mesh.time().constant(), + polyMesh::meshSubDir, + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ).filePath() << exit(FatalError); } } diff --git a/src/dynamicMesh/pointInterpolator/dynamicMeshPointInterpolator.C b/src/dynamicMesh/pointInterpolator/dynamicMeshPointInterpolator.C index f77a81d7fc..88f9c6ad81 100644 --- a/src/dynamicMesh/pointInterpolator/dynamicMeshPointInterpolator.C +++ b/src/dynamicMesh/pointInterpolator/dynamicMeshPointInterpolator.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,7 +52,7 @@ Foam::dynamicMeshPointInterpolator::dynamicMeshPointInterpolator forAll(allTimes, i) { - IOobject io + typeIOobject io ( fieldName_, allTimes[i].name(), @@ -61,7 +61,8 @@ Foam::dynamicMeshPointInterpolator::dynamicMeshPointInterpolator IOobject::NO_WRITE, false ); - if (io.typeHeaderOk(false)) + + if (io.headerOk()) { names.append(allTimes[i].name()); values.append(allTimes[i].value()); diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C index 983a9afe29..0d5be0102e 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,11 +39,11 @@ License Foam::hexRef8Data::hexRef8Data(const IOobject& io) { { - IOobject rio(io); + typeIOobject rio(io); rio.rename("cellLevel"); bool haveFile = returnReduce ( - rio.typeHeaderOk(true), + rio.headerOk(), orOp() ); if (haveFile) @@ -53,11 +53,11 @@ Foam::hexRef8Data::hexRef8Data(const IOobject& io) } } { - IOobject rio(io); + typeIOobject rio(io); rio.rename("pointLevel"); bool haveFile = returnReduce ( - rio.typeHeaderOk(true), + rio.headerOk(), orOp() ); if (haveFile) @@ -67,11 +67,11 @@ Foam::hexRef8Data::hexRef8Data(const IOobject& io) } } { - IOobject rio(io); + typeIOobject rio(io); rio.rename("level0Edge"); bool haveFile = returnReduce ( - rio.typeHeaderOk(true), + rio.headerOk(), orOp() ); if (haveFile) @@ -81,11 +81,11 @@ Foam::hexRef8Data::hexRef8Data(const IOobject& io) } } { - IOobject rio(io); + typeIOobject rio(io); rio.rename("refinementHistory"); bool haveFile = returnReduce ( - rio.typeHeaderOk(true), + rio.headerOk(), orOp() ); if (haveFile) diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index bfe0298e47..9a1b74d2c5 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -470,4 +470,10 @@ fvConstraints = $(general)/fvConstraints $(fvConstraints)/fvConstraint.C $(fvConstraints)/fvConstraints.C +cellSources = sets/cellSources +$(cellSources)/fieldToCell/fieldToCell.C + +faceSources = sets/faceSources +$(faceSources)/patchFluxToFace/patchFluxToFace.C + LIB = $(FOAM_LIBBIN)/libfiniteVolume diff --git a/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.C b/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.C index 35c9e0919a..14970e005f 100644 --- a/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.C +++ b/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,7 +34,7 @@ Foam::IOobject Foam::IOMRFZoneList::createIOobject const fvMesh& mesh ) const { - IOobject io + typeIOobject io ( "MRFProperties", mesh.time().constant(), @@ -43,7 +43,7 @@ Foam::IOobject Foam::IOMRFZoneList::createIOobject IOobject::NO_WRITE ); - if (io.typeHeaderOk(true)) + if (io.headerOk()) { Info<< "Creating MRF zone list from " << io.name() << endl; diff --git a/src/finiteVolume/cfdTools/general/fvConstraints/fvConstraints.C b/src/finiteVolume/cfdTools/general/fvConstraints/fvConstraints.C index 3cc6dd6c9a..0fddcd59d6 100644 --- a/src/finiteVolume/cfdTools/general/fvConstraints/fvConstraints.C +++ b/src/finiteVolume/cfdTools/general/fvConstraints/fvConstraints.C @@ -42,7 +42,7 @@ Foam::IOobject Foam::fvConstraints::createIOobject const fvMesh& mesh ) const { - IOobject io + typeIOobject io ( typeName, mesh.time().system(), @@ -51,7 +51,7 @@ Foam::IOobject Foam::fvConstraints::createIOobject IOobject::NO_WRITE ); - if (io.typeHeaderOk(true)) + if (io.headerOk()) { Info<< "Creating fvConstraints from " << io.instance()/io.name() << nl @@ -66,7 +66,7 @@ Foam::IOobject Foam::fvConstraints::createIOobject // check if the fvOptions file is in system io.rename("fvOptions"); - if (io.typeHeaderOk(true)) + if (io.headerOk()) { Warning << "Creating fvConstraints from " @@ -82,7 +82,7 @@ Foam::IOobject Foam::fvConstraints::createIOobject // check if the fvOptions file is in constant io.instance() = mesh.time().constant(); - if (io.typeHeaderOk(true)) + if (io.headerOk()) { Warning << "Creating fvConstraints from " diff --git a/src/finiteVolume/cfdTools/general/fvModels/fvModels.C b/src/finiteVolume/cfdTools/general/fvModels/fvModels.C index 014a5a62e4..5f8d1212d7 100644 --- a/src/finiteVolume/cfdTools/general/fvModels/fvModels.C +++ b/src/finiteVolume/cfdTools/general/fvModels/fvModels.C @@ -42,7 +42,7 @@ Foam::IOobject Foam::fvModels::createIOobject const fvMesh& mesh ) const { - IOobject io + typeIOobject io ( typeName, mesh.time().constant(), @@ -51,7 +51,7 @@ Foam::IOobject Foam::fvModels::createIOobject IOobject::NO_WRITE ); - if (io.typeHeaderOk(true)) + if (io.headerOk()) { Info<< "Creating fvModels from " << io.instance()/io.name() << nl @@ -66,7 +66,7 @@ Foam::IOobject Foam::fvModels::createIOobject // check if the fvOptions file is in constant io.rename("fvOptions"); - if (io.typeHeaderOk(true)) + if (io.headerOk()) { Warning << "Creating fvModels from " @@ -82,7 +82,7 @@ Foam::IOobject Foam::fvModels::createIOobject // check if the fvOptions file is in system io.instance() = mesh.time().system(); - if (io.typeHeaderOk(true)) + if (io.headerOk()) { Warning << "Creating fvModels from " diff --git a/src/finiteVolume/cfdTools/general/include/checkRadiationModel.H b/src/finiteVolume/cfdTools/general/include/checkRadiationModel.H index 8decaf9bc9..afdf9f52f4 100644 --- a/src/finiteVolume/cfdTools/general/include/checkRadiationModel.H +++ b/src/finiteVolume/cfdTools/general/include/checkRadiationModel.H @@ -1,6 +1,6 @@ if (!mesh.foundObject("radiationProperties")) { - IOobject radiationProperties + typeIOobject radiationProperties ( "radiationProperties", runTime.constant(), @@ -10,7 +10,7 @@ if (!mesh.foundObject("radiationProperties")) false ); - if (radiationProperties.typeHeaderOk(false)) + if (radiationProperties.headerOk()) { const word modelType ( diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C index a873a32828..9699838e8d 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,7 +34,7 @@ Foam::IOobject Foam::IOporosityModelList::createIOobject const fvMesh& mesh ) const { - IOobject io + typeIOobject io ( "porosityProperties", mesh.time().constant(), @@ -43,7 +43,7 @@ Foam::IOobject Foam::IOporosityModelList::createIOobject IOobject::NO_WRITE ); - if (io.typeHeaderOk(true)) + if (io.headerOk()) { Info<< "Creating porosity model list from " << io.name() << nl << endl; diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C index 02ed57bad1..b4a0eb78dc 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C @@ -120,12 +120,12 @@ CrankNicolsonDdtScheme::ddt0_ runTime.timeIndex() == runTime.startTimeIndex() || runTime.timeIndex() == runTime.startTimeIndex() + 1 ) - && IOobject + && typeIOobject> ( name, startTimeName, mesh() - ).typeHeaderOk>() + ).headerOk() ) { regIOobject::store diff --git a/src/meshTools/sets/cellSources/fieldToCell/fieldDictionary.H b/src/finiteVolume/sets/cellSources/fieldToCell/fieldDictionary.H similarity index 97% rename from src/meshTools/sets/cellSources/fieldToCell/fieldDictionary.H rename to src/finiteVolume/sets/cellSources/fieldToCell/fieldDictionary.H index 839e00b381..9001b56806 100644 --- a/src/meshTools/sets/cellSources/fieldToCell/fieldDictionary.H +++ b/src/finiteVolume/sets/cellSources/fieldToCell/fieldDictionary.H @@ -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 diff --git a/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C b/src/finiteVolume/sets/cellSources/fieldToCell/fieldToCell.C similarity index 76% rename from src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C rename to src/finiteVolume/sets/cellSources/fieldToCell/fieldToCell.C index ee6ff3c007..3038e9a641 100644 --- a/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.C +++ b/src/finiteVolume/sets/cellSources/fieldToCell/fieldToCell.C @@ -29,6 +29,7 @@ License #include "Time.H" #include "IFstream.H" #include "fieldDictionary.H" +#include "volFields.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -125,8 +126,7 @@ void Foam::fieldToCell::applyToSet topoSet& set ) const { - // Try to load field - IOobject fieldObject + typeIOobject fieldObject ( fieldName_, mesh().time().timeName(), @@ -136,41 +136,68 @@ void Foam::fieldToCell::applyToSet false ); - // Note: should check for volScalarField but that introduces dependency - // on volMesh so just use another type with processor-local scope - if (!fieldObject.typeHeaderOk(false)) + if (!fieldObject.IOobject::headerOk()) { WarningInFunction << "Cannot read field " << fieldName_ << " from time " << mesh().time().timeName() << endl; } - else if (fieldObject.headerClassName() == "volScalarField") + else if (fieldObject.IOobject::headerOk()) { - IFstream str(typeFilePath(fieldObject)); + IFstream str(fieldObject.filePath()); // Read dictionary - fieldDictionary fieldDict(fieldObject, fieldObject.headerClassName()); + const fieldDictionary fieldDict + ( + fieldObject, + volScalarField::typeName + ); - scalarField internalVals("internalField", fieldDict, mesh().nCells()); + const scalarField internalVals + ( + "internalField", + fieldDict, mesh().nCells() + ); applyToSet(action, internalVals, set); } - else if (fieldObject.headerClassName() == "volVectorField") - { - IFstream str(typeFilePath(fieldObject)); - - // Read dictionary - fieldDictionary fieldDict(fieldObject, fieldObject.headerClassName()); - - vectorField internalVals("internalField", fieldDict, mesh().nCells()); - - applyToSet(action, mag(internalVals), set); - } else { - WarningInFunction + typeIOobject fieldObject + ( + fieldName_, + mesh().time().timeName(), + mesh(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE, + false + ); + + if (fieldObject.IOobject::headerOk()) + { + IFstream str(fieldObject.filePath()); + + // Read dictionary + const fieldDictionary fieldDict + ( + fieldObject, + volVectorField::typeName + ); + + const vectorField internalVals + ( + "internalField", + fieldDict, mesh().nCells() + ); + + applyToSet(action, mag(internalVals), set); + } + else + { + WarningInFunction << "Cannot handle fields of type " << fieldObject.headerClassName() << endl; + } } } diff --git a/src/meshTools/sets/cellSources/fieldToCell/fieldToCell.H b/src/finiteVolume/sets/cellSources/fieldToCell/fieldToCell.H similarity index 100% rename from src/meshTools/sets/cellSources/fieldToCell/fieldToCell.H rename to src/finiteVolume/sets/cellSources/fieldToCell/fieldToCell.H diff --git a/src/meshTools/sets/faceSources/patchFluxToFace/patchFluxToFace.C b/src/finiteVolume/sets/faceSources/patchFluxToFace/patchFluxToFace.C similarity index 89% rename from src/meshTools/sets/faceSources/patchFluxToFace/patchFluxToFace.C rename to src/finiteVolume/sets/faceSources/patchFluxToFace/patchFluxToFace.C index 10a96eb4eb..fc26b5e036 100644 --- a/src/meshTools/sets/faceSources/patchFluxToFace/patchFluxToFace.C +++ b/src/finiteVolume/sets/faceSources/patchFluxToFace/patchFluxToFace.C @@ -29,6 +29,7 @@ License #include "Time.H" #include "IFstream.H" #include "fieldDictionary.H" +#include "surfaceFields.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -132,8 +133,7 @@ void Foam::patchFluxToFace::applyToSet topoSet& set ) const { - // Try to load field - IOobject fieldObject + typeIOobject fieldObject ( fieldName_, mesh().time().timeName(), @@ -143,17 +143,9 @@ void Foam::patchFluxToFace::applyToSet false ); - // Note: should check for surfaceScalarField but that introduces dependency - // on volMesh so just use another type with processor-local scope - if (!fieldObject.typeHeaderOk(false)) + if (fieldObject.headerOk()) { - WarningInFunction - << "Cannot read flux field " << fieldName_ - << " from time " << mesh().time().timeName() << endl; - } - else if (fieldObject.headerClassName() == "surfaceScalarField") - { - IFstream str(typeFilePath(fieldObject)); + IFstream str(fieldObject.filePath()); // Read dictionary const fieldDictionary fieldDict @@ -174,8 +166,8 @@ void Foam::patchFluxToFace::applyToSet else { WarningInFunction - << "Incorrect flux field type " << fieldObject.headerClassName() - << endl; + << "Cannot read flux field " << fieldName_ + << " from time " << mesh().time().timeName() << endl; } } diff --git a/src/meshTools/sets/faceSources/patchFluxToFace/patchFluxToFace.H b/src/finiteVolume/sets/faceSources/patchFluxToFace/patchFluxToFace.H similarity index 100% rename from src/meshTools/sets/faceSources/patchFluxToFace/patchFluxToFace.H rename to src/finiteVolume/sets/faceSources/patchFluxToFace/patchFluxToFace.H diff --git a/src/functionObjects/field/fieldAverage/fieldAverage.C b/src/functionObjects/field/fieldAverage/fieldAverage.C index 794bca26bb..1a67f8e973 100644 --- a/src/functionObjects/field/fieldAverage/fieldAverage.C +++ b/src/functionObjects/field/fieldAverage/fieldAverage.C @@ -243,7 +243,7 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties() } else { - IOobject propsDictHeader + typeIOobject propsDictHeader ( name() + "Properties", obr_.time().timeName(obr_.time().startTime().value()), @@ -254,7 +254,7 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties() false ); - if (!propsDictHeader.typeHeaderOk()) + if (!propsDictHeader.headerOk()) { Log << " Starting averaging at time " << obr_.time().timeName() << nl; diff --git a/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C b/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C index 8b44b3fb23..5204f7dc79 100644 --- a/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C +++ b/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.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-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,7 +79,7 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform } else { - IOobject fieldHeader + typeIOobject fieldHeader ( fieldName, mesh_.time().timeName(), @@ -88,11 +88,7 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform IOobject::NO_WRITE ); - if - ( - fieldHeader.typeHeaderOk(false) - && fieldHeader.headerClassName() == VolFieldType::typeName - ) + if (fieldHeader.headerOk()) { DebugInfo << type() << ": Field " << fieldName << " read from file" @@ -103,20 +99,28 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform mesh_.lookupObject(fieldName) ); } - else if - ( - fieldHeader.typeHeaderOk(false) - && fieldHeader.headerClassName() == SurfaceFieldType::typeName - ) + else { - DebugInfo - << type() << ": Field " << fieldName << " read from file" - << endl; - - transformField + typeIOobject fieldHeader ( - mesh_.lookupObject(fieldName) + fieldName, + mesh_.time().timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::NO_WRITE ); + + if (fieldHeader.headerOk()) + { + DebugInfo + << type() << ": Field " << fieldName << " read from file" + << endl; + + transformField + ( + mesh_.lookupObject(fieldName) + ); + } } } } diff --git a/src/functionObjects/field/readFields/readFieldsTemplates.C b/src/functionObjects/field/readFields/readFieldsTemplates.C index db024808c1..4d3f19eeb3 100644 --- a/src/functionObjects/field/readFields/readFieldsTemplates.C +++ b/src/functionObjects/field/readFields/readFieldsTemplates.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-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,7 +55,7 @@ void Foam::functionObjects::readFields::loadField } else { - IOobject fieldHeader + typeIOobject fieldHeader ( fieldName, mesh_.time().timeName(), @@ -64,11 +64,7 @@ void Foam::functionObjects::readFields::loadField IOobject::NO_WRITE ); - if - ( - fieldHeader.typeHeaderOk(false) - && fieldHeader.headerClassName() == VolFieldType::typeName - ) + if (fieldHeader.headerOk()) { // Store field locally Log << " Reading " << fieldName << endl; @@ -77,18 +73,26 @@ void Foam::functionObjects::readFields::loadField vflds.setSize(sz+1); vflds.set(sz, new VolFieldType(fieldHeader, mesh_)); } - else if - ( - fieldHeader.typeHeaderOk(false) - && fieldHeader.headerClassName() == SurfaceFieldType::typeName - ) + else { - // Store field locally - Log << " Reading " << fieldName << endl; + typeIOobject fieldHeader + ( + fieldName, + mesh_.time().timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::NO_WRITE + ); - label sz = sflds.size(); - sflds.setSize(sz+1); - sflds.set(sz, new SurfaceFieldType(fieldHeader, mesh_)); + if (fieldHeader.headerOk()) + { + // Store field locally + Log << " Reading " << fieldName << endl; + + label sz = sflds.size(); + sflds.setSize(sz+1); + sflds.set(sz, new SurfaceFieldType(fieldHeader, mesh_)); + } } } } diff --git a/src/functionObjects/utilities/writeDictionary/writeDictionary.C b/src/functionObjects/utilities/writeDictionary/writeDictionary.C index 80633bab6d..1993f4cad6 100644 --- a/src/functionObjects/utilities/writeDictionary/writeDictionary.C +++ b/src/functionObjects/utilities/writeDictionary/writeDictionary.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,7 @@ bool Foam::functionObjects::writeDictionary::tryDirectory bool& firstDict ) { - IOobject dictIO + typeIOobject dictIO ( dictNames_[dictI], location, @@ -66,7 +66,7 @@ bool Foam::functionObjects::writeDictionary::tryDirectory false ); - if (dictIO.typeHeaderOk(true)) + if (dictIO.headerOk()) { IOdictionary dict(dictIO); diff --git a/src/fvModels/derived/heatTransfer/heatTransferModels/constant/constant.C b/src/fvModels/derived/heatTransfer/heatTransferModels/constant/constant.C index 6a7a130896..0e68770c1c 100644 --- a/src/fvModels/derived/heatTransfer/heatTransferModels/constant/constant.C +++ b/src/fvModels/derived/heatTransfer/heatTransferModels/constant/constant.C @@ -47,7 +47,7 @@ namespace heatTransferModels void Foam::fv::heatTransferModels::constant::readCoeffs() { - IOobject htcIO + typeIOobject htcIO ( "htc", mesh().time().constant(), @@ -67,7 +67,7 @@ void Foam::fv::heatTransferModels::constant::readCoeffs() ); htcPtr_.clear(); } - else if (htcIO.typeHeaderOk(false)) + else if (htcIO.headerOk()) { htc_ = dimensionedScalar("htc", dimPower/dimTemperature/dimArea, NaN); htcPtr_.set(new volScalarField(htcIO, mesh())); @@ -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() << exit(FatalIOError); } } diff --git a/src/fvModels/derived/heatTransfer/heatTransferModels/heatTransferModel/heatTransferModel.C b/src/fvModels/derived/heatTransfer/heatTransferModels/heatTransferModel/heatTransferModel.C index 8cdd71bdea..e8f655b297 100644 --- a/src/fvModels/derived/heatTransfer/heatTransferModels/heatTransferModel/heatTransferModel.C +++ b/src/fvModels/derived/heatTransfer/heatTransferModels/heatTransferModel/heatTransferModel.C @@ -42,7 +42,7 @@ namespace fv void Foam::fv::heatTransferModel::readCoeffs() { - IOobject AoVIO + typeIOobject AoVIO ( "AoV", mesh().time().constant(), @@ -56,7 +56,7 @@ void Foam::fv::heatTransferModel::readCoeffs() AoV_ = dimensionedScalar("AoV", dimless/dimLength, coeffs()); AoVPtr_.clear(); } - else if (AoVIO.typeHeaderOk(false)) + else if (AoVIO.headerOk()) { AoV_ = dimensionedScalar("AoV", dimless/dimLength, NaN); AoVPtr_.set(new volScalarField(AoVIO, mesh())); @@ -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() << exit(FatalIOError); } } diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C index bce940015b..c040801887 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.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-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -88,7 +88,7 @@ Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver : -1 ) { - IOobject io + typeIOobject io ( "pointLocation", fvMesh_.time().timeName(), @@ -105,7 +105,7 @@ Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver } - if (io.typeHeaderOk(true)) + if (io.headerOk()) { pointLocation_.reset ( diff --git a/src/lagrangian/basic/Cloud/CloudIO.C b/src/lagrangian/basic/Cloud/CloudIO.C index 6c2a99fe81..ee665d2799 100644 --- a/src/lagrangian/basic/Cloud/CloudIO.C +++ b/src/lagrangian/basic/Cloud/CloudIO.C @@ -39,7 +39,7 @@ Foam::word Foam::Cloud::cloudPropertiesName("cloudProperties"); template void Foam::Cloud::readCloudUniformProperties() { - IOobject dictObj + typeIOobject dictObj ( cloudPropertiesName, time().timeName(), @@ -50,7 +50,7 @@ void Foam::Cloud::readCloudUniformProperties() false ); - if (dictObj.typeHeaderOk(true)) + if (dictObj.headerOk()) { const timeIOdictionary uniformPropsDict(dictObj); diff --git a/src/lagrangian/basic/particle/particleTemplates.C b/src/lagrangian/basic/particle/particleTemplates.C index a284a07b63..0578a38ec5 100644 --- a/src/lagrangian/basic/particle/particleTemplates.C +++ b/src/lagrangian/basic/particle/particleTemplates.C @@ -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 @@ -44,9 +44,12 @@ void Foam::particle::readFields(TrackCloudType& c) { bool valid = c.size(); - IOobject procIO(c.fieldIOobject("origProcId", IOobject::MUST_READ)); + typeIOobject> procIO + ( + c.fieldIOobject("origProcId", IOobject::MUST_READ) + ); - bool haveFile = procIO.typeHeaderOk>(true); + bool haveFile = procIO.headerOk(); IOField