diff --git a/README.md b/README.md index be42f46afc..fde9c6ac91 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ OpenCFD Limited, owner of the OpenFOAM Trademark, has granted the use of the Tra # Useful Links - [Download and installation instructions](http://www.openfoam.com/releases) - [Documentation](http://www.openfoam.com/documentation) -- [Reporting bugs/issues (including bugs/suggestions/feature requests) in OpenFOAM+](http://www.openfoam.com/???) -- [Collaborative and Community-based Developments](http://www.openfoam.com/development/community-projects.php) +- [Reporting bugs/issues (including bugs/suggestions/feature requests) in OpenFOAM+](http://www.openfoam.com/code/bug-reporting.php) +- [Collaborative and Community-based Developments](http://www.openfoam.com/services/community-projects.php) - [Contacting OpenCFD](http://www.openfoam.com/contact) Copyright 2016 OpenCFD Ltd diff --git a/applications/solvers/electromagnetics/mhdFoam/createPhiB.H b/applications/solvers/electromagnetics/mhdFoam/createPhiB.H index 9b8aea9ae2..be0fbfaf83 100644 --- a/applications/solvers/electromagnetics/mhdFoam/createPhiB.H +++ b/applications/solvers/electromagnetics/mhdFoam/createPhiB.H @@ -9,7 +9,7 @@ surfaceScalarField* phiBPtr; - if (phiBHeader.headerOk()) + if (phiBHeader.typeHeaderOk(true)) { Info<< "Reading field phiB\n" << endl; diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H index d80e053727..10e9aa08ab 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H @@ -76,7 +76,7 @@ IOobject::AUTO_WRITE ); - if (betavSolidIO.headerOk()) + if (betavSolidIO.typeHeaderOk(true)) { betavSolid.set ( diff --git a/applications/solvers/heatTransfer/thermoFoam/setAlphaEff.H b/applications/solvers/heatTransfer/thermoFoam/setAlphaEff.H index 4af3af3ce4..cfc3923256 100644 --- a/applications/solvers/heatTransfer/thermoFoam/setAlphaEff.H +++ b/applications/solvers/heatTransfer/thermoFoam/setAlphaEff.H @@ -25,7 +25,7 @@ IOobject::MUST_READ ); - if (turbulenceHeader.headerOk()) + if (turbulenceHeader.typeHeaderOk(true)) { autoPtr turbulence ( @@ -40,7 +40,7 @@ talphaEff = turbulence->alphaEff(); } - else if (RASHeader.headerOk()) + else if (RASHeader.typeHeaderOk(true)) { autoPtr turbulence ( @@ -55,7 +55,7 @@ talphaEff = turbulence->alphaEff(); } - else if (LESHeader.headerOk()) + else if (LESHeader.typeHeaderOk(true)) { autoPtr turbulence ( diff --git a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/createFields.H b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/createFields.H index c8b4dbc4f5..6a516727e3 100644 --- a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/createFields.H @@ -79,7 +79,7 @@ autoPtr HPtr; - if (Hheader.headerOk()) + if (Hheader.typeHeaderOk(true)) { Info<< "\nReading field H\n" << endl; @@ -97,7 +97,7 @@ autoPtr HdotGradHPtr; - if (HdotGradHheader.headerOk()) + if (HdotGradHheader.typeHeaderOk(true)) { Info<< "Reading field HdotGradH" << endl; diff --git a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/createNonInertialFrameFields.H b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/createNonInertialFrameFields.H index abaede9385..731a8196da 100644 --- a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/createNonInertialFrameFields.H +++ b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/createNonInertialFrameFields.H @@ -11,7 +11,13 @@ autoPtr linearAccelerationPtr; - if (linearAccelerationHeader.headerOk()) + if + ( + linearAccelerationHeader.typeHeaderOk + ( + true + ) + ) { Info<< " Reading " << linearAccelerationHeader.name() << endl; @@ -33,7 +39,7 @@ autoPtr angularVelocityPtr; - if (angularVelocityHeader.headerOk()) + if (angularVelocityHeader.typeHeaderOk(true)) { Info<< " Reading " << angularVelocityHeader.name() << endl; @@ -55,7 +61,13 @@ autoPtr angularAccelerationPtr; - if (angularAccelerationHeader.headerOk()) + if + ( + angularAccelerationHeader.typeHeaderOk + ( + true + ) + ) { Info<< " Reading " << angularAccelerationHeader.name() << endl; @@ -77,7 +89,13 @@ autoPtr centreOfRotationPtr; - if (centreOfRotationHeader.headerOk()) + if + ( + centreOfRotationHeader.typeHeaderOk + ( + true + ) + ) { Info<< " Reading " << centreOfRotationHeader.name() << endl; diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C index 9dc9f2bf80..10dd3e0a56 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C @@ -122,7 +122,7 @@ Foam::phaseModel::phaseModel IOobject::NO_READ ); - if (phiHeader.headerOk()) + if (phiHeader.typeHeaderOk(true)) { Info<< "Reading face flux field " << phiName << endl; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C index 74c6b7b46a..0b87f228ff 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C @@ -54,7 +54,7 @@ Foam::MovingPhaseModel::phi(const volVectorField& U) const IOobject::NO_READ ); - if (phiHeader.headerOk()) + if (phiHeader.typeHeaderOk(true)) { Info<< "Reading face flux field " << phiName << endl; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C index b0b5a591b3..a9fa972e11 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C @@ -120,7 +120,7 @@ Foam::phaseModel::phaseModel IOobject::NO_READ ); - if (phiHeader.headerOk()) + if (phiHeader.typeHeaderOk(true)) { Info<< "Reading face flux field " << phiName << endl; diff --git a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C index ea342de863..085e658729 100644 --- a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C +++ b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C @@ -1174,7 +1174,7 @@ int main(int argc, char *argv[]) } } - Info << nl << "End" << endl; + Info<< "\nEnd\n" << endl; return 0; } diff --git a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C index ed30517153..26e716eb3f 100644 --- a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C +++ b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C @@ -650,7 +650,7 @@ int main(int argc, char *argv[]) // corrector for mesh motion twoDPointCorrector* correct2DPtr = NULL; - if (motionObj.headerOk()) + if (motionObj.typeHeaderOk(true)) { 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 b3af03b509..26e65a8ae5 100644 --- a/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C +++ b/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C @@ -238,7 +238,7 @@ int main(int argc, char *argv[]) runTime ); - if (!readLevel && refHeader.headerOk()) + if (!readLevel && refHeader.typeHeaderOk(true)) { 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 2affa40535..980219c970 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 | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -82,7 +82,7 @@ Foam::edgeStats::edgeStats(const polyMesh& mesh) IOobject::NO_WRITE ); - if (motionObj.headerOk()) + if (motionObj.typeHeaderOk(true)) { 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 d21b64fdc1..11b8993f28 100644 --- a/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H +++ b/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H @@ -19,7 +19,7 @@ false ); - if (io.headerOk()) + if (io.typeHeaderOk(true)) { IOdictionary timeObject ( diff --git a/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H b/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H index d21b64fdc1..11b8993f28 100644 --- a/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H +++ b/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H @@ -19,7 +19,7 @@ false ); - if (io.headerOk()) + if (io.typeHeaderOk(true)) { IOdictionary timeObject ( diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C index 6e050b39dd..9ca43fab5f 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) false ); - if (!meshDictIO.headerOk()) + if (!meshDictIO.typeHeaderOk(true)) { FatalErrorInFunction << meshDictIO.objectPath() diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index c4773342d4..66272620be 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -96,7 +96,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) Info<< "Testing:" << io.objectPath() << endl; - if (!io.headerOk()) + if (!io.typeHeaderOk(false)) { Info<< "Writing dummy " << regionName/io.name() << endl; dictionary dummyDict; @@ -122,7 +122,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) false ); - if (!io.headerOk()) + if (!io.typeHeaderOk(false)) { 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 1174444fe0..2e58aad627 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -366,7 +366,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) Info<< "Testing:" << io.objectPath() << endl; - if (!io.headerOk()) + if (!io.typeHeaderOk(true)) { Info<< "Writing dummy " << regionName/io.name() << endl; dictionary dummyDict; @@ -392,7 +392,7 @@ void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) false ); - if (!io.headerOk()) + if (!io.typeHeaderOk(true)) { Info<< "Writing dummy " << regionName/io.name() << endl; dictionary dummyDict; @@ -2655,7 +2655,7 @@ int main(int argc, char *argv[]) mesh, IOobject::MUST_READ ); - if (io.headerOk()) + if (io.typeHeaderOk(true)) { // Read patchFaceCentres and patchEdgeCentres Info<< "Reading patch face,edge centres : " diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.C index eb88c43578..4831560f5d 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.C @@ -70,7 +70,7 @@ Foam::DelaunayMesh::DelaunayMesh ) ); - if (pts.headerOk()) + if (pts.typeHeaderOk(true)) { labelIOField types ( diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C index ba65ebd638..75c028fe8e 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -394,7 +394,7 @@ Foam::cellShapeControlMesh::cellShapeControlMesh(const Time& runTime) false ); - if (io.headerOk()) + if (io.typeHeaderOk(true)) { pointScalarField sizes(io, pointMesh::New(mesh)); diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.C index bea71b9b5c..7229f68010 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.C @@ -75,43 +75,65 @@ pointFile::pointFile List pointFile::initialPoints() const { - pointIOField points - ( - IOobject + pointField points; + { + // Look for points + IOobject pointsIO ( pointFileName_.name(), time().timeName(), time(), IOobject::MUST_READ, IOobject::NO_WRITE - ) - ); + ); - Info<< " Inserting points from file " << pointFileName_ << endl; + Info<< " Inserting points from file " << pointFileName_ << endl; - if (points.empty()) - { - FatalErrorInFunction - << "Point file contain no points" - << exit(FatalError) << endl; - } - - if (Pstream::parRun()) - { - // Testing filePath to see if the file originated in a processor - // directory, if so, assume that the points in each processor file - // are unique. They are unlikely to belong on the current - // processor as the background mesh is unlikely to be the same. - - const bool isParentFile = (points.objectPath() != points.filePath()); - - if (!isParentFile) + // See if processor local file + if (pointsIO.typeHeaderOk(true)) { - decomposition().distributePoints(points); + // Found it (processor local) + points = pointIOField(pointsIO); + + if (points.empty()) + { + FatalErrorIn("List pointFile::initialPoints() const") + << "Point file contain no points" + << exit(FatalError) << endl; + } + + if (Pstream::parRun()) + { + // assume that the points in each processor file + // are unique. They are unlikely to belong on the current + // processor as the background mesh is unlikely to be the same. + decomposition().distributePoints(points); + } } - else + else if (Pstream::parRun()) { - // Otherwise, this is assumed to be points covering the whole + // See if points can be found in parent directory + // (only if timeName = constant) + points = pointIOField + ( + IOobject + ( + pointFileName_.name(), + time().caseConstant(), + time(), + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + if (points.empty()) + { + FatalErrorIn("List pointFile::initialPoints() const") + << "Point file contain no points" + << exit(FatalError) << endl; + } + + // Points are assumed to be covering the whole // domain, so filter the points to be only those on this processor boolList procPt(decomposition().positionOnThisProcessor(points)); @@ -146,6 +168,12 @@ List pointFile::initialPoints() const inplaceSubset(procPt, points); } + else + { + FatalErrorIn("List pointFile::initialPoints() const") + << "Cannot find points file " << pointsIO.objectPath() + << exit(FatalError) << endl; + } } Field insidePoints(points.size(), true); diff --git a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C index a542323874..58f7447506 100644 --- a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C +++ b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C @@ -74,7 +74,7 @@ int main(int argc, char *argv[]) ); // Check U exists - if (Uheader.headerOk()) + if (Uheader.typeHeaderOk(true)) { 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 05a548eeee..4877c45319 100644 --- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C +++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C @@ -187,7 +187,7 @@ int main(int argc, char *argv[]) IOobject::MUST_READ ); - if (!dictIO.headerOk()) + if (!dictIO.typeHeaderOk(true)) { FatalErrorInFunction << "Cannot open specified refinement dictionary " @@ -209,7 +209,7 @@ int main(int argc, char *argv[]) IOobject::MUST_READ ); - if (dictIO.headerOk()) + if (dictIO.typeHeaderOk(true)) { Info<< "Refining according to " << dictName << nl << endl; diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index dc32e24366..b44a3cfe7f 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -599,7 +599,7 @@ autoPtr createRegionMesh Info<< "Testing:" << io.objectPath() << endl; - if (!io.headerOk()) + if (!io.typeHeaderOk(true)) // if (!exists(io.objectPath())) { Info<< "Writing dummy " << regionName/io.name() << endl; @@ -626,7 +626,7 @@ autoPtr createRegionMesh false ); - if (!io.headerOk()) + if (!io.typeHeaderOk(true)) //if (!exists(io.objectPath())) { Info<< "Writing dummy " << regionName/io.name() << endl; diff --git a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C index 32054b8310..715af2481a 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.headerOk()) + if (io.typeHeaderOk(false)) { Info<< " Reading " << io.headerClassName() << " : " << name << endl; diff --git a/applications/utilities/miscellaneous/foamFormatConvert/writeMeshObject.H b/applications/utilities/miscellaneous/foamFormatConvert/writeMeshObject.H index 2c0909436e..06c064e077 100644 --- a/applications/utilities/miscellaneous/foamFormatConvert/writeMeshObject.H +++ b/applications/utilities/miscellaneous/foamFormatConvert/writeMeshObject.H @@ -61,7 +61,7 @@ inline bool writeMeshObject bool writeOk = false; - if (io.headerOk()) + if (io.typeHeaderOk(false)) { Info<< " Reading " << io.headerClassName() << " : " << name << endl; diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundary.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundary.C index c47a661cef..5052b76a14 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundary.C +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundary.C @@ -122,7 +122,7 @@ void Foam::helpTypes::helpBoundary::execute ); // Check for any type of volField - if (fieldHeader.headerOk()) + if (fieldHeader.typeHeaderOk(false)) { if (args.optionFound("fixedValue")) { diff --git a/applications/utilities/miscellaneous/patchSummary/patchSummary.C b/applications/utilities/miscellaneous/patchSummary/patchSummary.C index c5951b3865..7682893b13 100644 --- a/applications/utilities/miscellaneous/patchSummary/patchSummary.C +++ b/applications/utilities/miscellaneous/patchSummary/patchSummary.C @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) IOobject::MUST_READ ); - if (obj.headerOk()) + if (obj.typeHeaderOk(false)) { addToFieldList(vsf, obj, objI, mesh); addToFieldList(vvf, obj, objI, mesh); diff --git a/applications/utilities/parallelProcessing/redistributePar/parLagrangianRedistributor.C b/applications/utilities/parallelProcessing/redistributePar/parLagrangianRedistributor.C index 2e775f2ef8..16bf0a5137 100644 --- a/applications/utilities/parallelProcessing/redistributePar/parLagrangianRedistributor.C +++ b/applications/utilities/parallelProcessing/redistributePar/parLagrangianRedistributor.C @@ -293,27 +293,9 @@ Foam::parLagrangianRedistributor::redistributeLagrangianPositions const word& cloudName ) const { - (void)srcMesh_.tetBasePtIs(); - (void)tgtMesh_.tetBasePtIs(); - - // Temporarily: override master-only checking - regIOobject::fileCheckTypes oldCheckType = - regIOobject::fileModificationChecking; - - if (oldCheckType == regIOobject::timeStampMaster) - { - regIOobject::fileModificationChecking = regIOobject::timeStamp; - } - else if (oldCheckType == regIOobject::inotifyMaster) - { - regIOobject::fileModificationChecking = regIOobject::inotify; - } - // Load cloud and send particle passiveParticleCloud lpi(srcMesh_, cloudName, false); - regIOobject::fileModificationChecking = oldCheckType; - return redistributeLagrangianPositions(lpi); } diff --git a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C index c2667c60d7..8b66353f38 100644 --- a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C +++ b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C @@ -1436,7 +1436,7 @@ void readProcAddressing // mesh, // IOobject::MUST_READ //); - //if (io.headerOk()) + //if (io.typeHeaderOk(true)) //{ // Pout<< "Reading addressing from " << io.name() << " at " // << mesh.facesInstance() << nl << endl; @@ -1786,28 +1786,12 @@ void readLagrangian forAll(cloudNames, i) { - { - // Note: disable master-only reading of uniform/cloudProperties - regIOobject::fileCheckTypes oldCheckType = - regIOobject::fileModificationChecking; - - if (oldCheckType == regIOobject::timeStampMaster) - { - regIOobject::fileModificationChecking = regIOobject::timeStamp; - } - else if (oldCheckType == regIOobject::inotifyMaster) - { - regIOobject::fileModificationChecking = regIOobject::inotify; - } - - clouds.set - ( - i, - new unmappedPassiveParticleCloud(mesh, cloudNames[i], false) - ); - - regIOobject::fileModificationChecking = oldCheckType; - } + //Pout<< "Loading cloud " << cloudNames[i] << endl; + clouds.set + ( + i, + new unmappedPassiveParticleCloud(mesh, cloudNames[i], false) + ); //forAllConstIter @@ -2434,7 +2418,7 @@ int main(int argc, char *argv[]) meshSubDir, runTime, IOobject::READ_IF_PRESENT - ).headerOk(); + ).typeHeaderOk(true); } else { diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H index 76b55aada7..47a3540da7 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); } } diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H index 8657a9cc21..d4027ad1c5 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H @@ -17,7 +17,7 @@ if (Times.size() > 1) mesh, IOobject::NO_READ ); - if (io.headerOk()) + if (io.typeHeaderOk(true)) { meshMoving = true; break; diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C index efddb780e8..0e391d462c 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C @@ -706,7 +706,10 @@ int main(int argc, char *argv[]) IOobject::MUST_READ ); - bool fieldExists = fieldObject.headerOk(); + bool fieldExists = fieldObject.typeHeaderOk > + ( + false + ); if (fieldType == scalarIOField::typeName) { ensightCloudField diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H index a5a2dd7d2d..454cb3ebb6 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H @@ -13,6 +13,6 @@ if (timeDirs.size() > 1) polyMesh::meshSubDir, mesh, IOobject::NO_READ - ).headerOk(); + ).typeHeaderOk(true); } } diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H index 53e234939e..2b25364099 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H @@ -24,7 +24,7 @@ false ); - if (io.headerOk()) + if (io.typeHeaderOk(true)) { io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; IOdictionary timeObject(io); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/moveMesh.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/moveMesh.H index 284a0df35b..f894e2c136 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/moveMesh.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/moveMesh.H @@ -7,7 +7,7 @@ mesh ); - if (io.headerOk()) + if (io.typeHeaderOk(true)) { // 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 a6c0c7dd36..b00aca4d17 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H @@ -71,7 +71,13 @@ for (label i=0; i < nTypes; i++) IOobject::NO_READ ); - if (lagrangianHeader.headerOk()) + if + ( + lagrangianHeader.typeHeaderOk > > + ( + false + ) + ) { Cloud particles(mesh); diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/moveMesh.H b/applications/utilities/postProcessing/dataConversion/foamToGMV/moveMesh.H index e84837fd1c..c1a1f8dee7 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/moveMesh.H +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/moveMesh.H @@ -6,7 +6,7 @@ IOobject ioPoints mesh ); -if (ioPoints.headerOk()) +if (ioPoints.typeHeaderOk(true)) { Info<< "new points available" << endl; // Reading new points diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index 054582768f..fedacab22d 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -567,7 +567,13 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps) if ( isFile(runTime.path()/timeName/meshDir_/"points") - && IOobject("points", timeName, meshDir_, runTime).headerOk() + && IOobject + ( + "points", + timeName, + meshDir_, + runTime + ).typeHeaderOk(true) ) { break; diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C index 842a301ed7..fde516ee44 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C @@ -124,7 +124,7 @@ Foam::wordList Foam::vtkPV3Foam::getZoneNames(const word& zoneType) const false ); - if (ioObj.headerOk()) + if (ioObj.typeHeaderOk(false)) { zonesEntries zones(ioObj); @@ -333,7 +333,7 @@ void Foam::vtkPV3Foam::updateInfoPatches ); // this should only ever fail if the mesh region doesn't exist - if (ioObj.headerOk()) + if (ioObj.typeHeaderOk(true)) { polyBoundaryMeshEntries patchEntries(ioObj); diff --git a/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/vtkPV4Foam/vtkPV4Foam.C b/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/vtkPV4Foam/vtkPV4Foam.C index 960883af34..4e31b83811 100644 --- a/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/vtkPV4Foam/vtkPV4Foam.C +++ b/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/vtkPV4Foam/vtkPV4Foam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -567,7 +567,13 @@ double* Foam::vtkPV4Foam::findTimes(int& nTimeSteps) if ( isFile(runTime.path()/timeName/meshDir_/"points") - && IOobject("points", timeName, meshDir_, runTime).headerOk() + && IOobject + ( + "points", + timeName, + meshDir_, + runTime + ).typeHeaderOk(true) ) { break; diff --git a/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/vtkPV4Foam/vtkPV4FoamUpdateInfo.C b/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/vtkPV4Foam/vtkPV4FoamUpdateInfo.C index 9598d5de4a..5357717a61 100644 --- a/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/vtkPV4Foam/vtkPV4FoamUpdateInfo.C +++ b/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/vtkPV4Foam/vtkPV4FoamUpdateInfo.C @@ -124,7 +124,7 @@ Foam::wordList Foam::vtkPV4Foam::getZoneNames(const word& zoneType) const false ); - if (ioObj.headerOk()) + if (ioObj.typeHeaderOk(false)) { zonesEntries zones(ioObj); @@ -333,7 +333,7 @@ void Foam::vtkPV4Foam::updateInfoPatches ); // this should only ever fail if the mesh region doesn't exist - if (ioObj.headerOk()) + if (ioObj.typeHeaderOk(true)) { 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 fdb7c38c9f..ba26142e3e 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.headerOk()) + if (sprayHeader.typeHeaderOk >(false)) { Info<< "[Found lagrangian]" << endl; diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldScalar.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldScalar.H index eaa8e78a82..a66e4c53c6 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldScalar.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldScalar.H @@ -12,7 +12,7 @@ IOobject fieldObjectPtr IOobject::NO_READ ); -if (!fieldObjectPtr.headerOk()) +if (!fieldObjectPtr.typeHeaderOk(true)) { return Z_UNDEF; } diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldTensor.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldTensor.H index c2c729ba2b..a7b72c65b3 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldTensor.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldTensor.H @@ -12,7 +12,7 @@ IOobject fieldObjectPtr IOobject::NO_READ ); -if (!fieldObjectPtr.headerOk()) +if (!fieldObjectPtr.typeHeaderOk(true)) { return Z_UNDEF; } diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldVector.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldVector.H index 5ae68d2a52..90f9fd4717 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldVector.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getFieldVector.H @@ -12,7 +12,7 @@ IOobject fieldObjectPtr IOobject::NO_READ ); -if (!fieldObjectPtr.headerOk()) +if (!fieldObjectPtr.typeHeaderOk(true)) { return Z_UNDEF; } diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldScalar.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldScalar.H index 46f4f46d8d..549a80f64f 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldScalar.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldScalar.H @@ -13,7 +13,7 @@ IOobject fieldObjectPtr IOobject::NO_READ ); -if (!fieldObjectPtr.headerOk()) +if (!fieldObjectPtr.typeHeaderOk(true)) { return Z_UNDEF; } diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldTensor.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldTensor.H index 9321619b33..0aed2ac26e 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldTensor.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldTensor.H @@ -13,7 +13,7 @@ IOobject fieldObjectPtr IOobject::NO_READ ); -if (!fieldObjectPtr.headerOk()) +if (!fieldObjectPtr.typeHeaderOk(true)) { return Z_UNDEF; } diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldVector.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldVector.H index fa8441bb5f..4c6fe3832f 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldVector.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getPatchFieldVector.H @@ -13,7 +13,7 @@ IOobject fieldObjectPtr IOobject::NO_READ ); -if (!fieldObjectPtr.headerOk()) +if (!fieldObjectPtr.typeHeaderOk(true)) { return Z_UNDEF; } diff --git a/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C b/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C index b9c321b87a..eed7d90376 100644 --- a/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C +++ b/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -62,7 +62,11 @@ namespace Foam IOobject::MUST_READ ); - if (obj.headerOk() && obj.headerClassName() == fieldType::typeName) + if + ( + obj.typeHeaderOk(false) + && obj.headerClassName() == fieldType::typeName + ) { list.set(index++, new fieldType(obj, mesh)); } diff --git a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C index 0680449a3e..2baabfa331 100644 --- a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C +++ b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C @@ -306,7 +306,7 @@ void calc false ); - if (turbulencePropertiesHeader.headerOk()) + if (turbulencePropertiesHeader.typeHeaderOk(true)) { singlePhaseTransportModel laminarTransport(U, phi); @@ -364,7 +364,7 @@ void calc false ); - if (turbulencePropertiesHeader.headerOk()) + if (turbulencePropertiesHeader.typeHeaderOk(true)) { autoPtr turbulenceModel ( diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H b/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H index e0ce9b1f6d..83a7c12046 100644 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H +++ b/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H @@ -6,7 +6,7 @@ IOobject::MUST_READ ); - if (!UMeanHeader.headerOk()) + if (!UMeanHeader.typeHeaderOk(true)) { Info<< " No UMean field" << endl; continue; diff --git a/applications/utilities/postProcessing/miscellaneous/ptot/ptot.C b/applications/utilities/postProcessing/miscellaneous/ptot/ptot.C index 3f3213cd3e..0f47e54d6a 100644 --- a/applications/utilities/postProcessing/miscellaneous/ptot/ptot.C +++ b/applications/utilities/postProcessing/miscellaneous/ptot/ptot.C @@ -69,7 +69,11 @@ int main(int argc, char *argv[]) // Check p and U exist - if (pheader.headerOk() && Uheader.headerOk()) + if + ( + pheader.typeHeaderOk(true) + && Uheader.typeHeaderOk(true) + ) { mesh.readUpdate(); @@ -106,7 +110,7 @@ int main(int argc, char *argv[]) ); // Check rho exists - if (rhoheader.headerOk()) + if (rhoheader.typeHeaderOk(true)) { Info<< " Reading rho" << endl; volScalarField rho(rhoheader, mesh); diff --git a/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C b/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C index acdc968fa7..ab8507b9b7 100644 --- a/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C +++ b/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) ); // Check field exists - if (io.headerOk()) + if (io.typeHeaderOk(false)) { mesh.readUpdate(); diff --git a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C index c0a96503c9..e17f43cf29 100644 --- a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C +++ b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) ); // Check field exists - if (fieldHeader.headerOk()) + if (fieldHeader.typeHeaderOk(false)) { mesh.readUpdate(); diff --git a/applications/utilities/postProcessing/scalarField/pPrime2/pPrime2.C b/applications/utilities/postProcessing/scalarField/pPrime2/pPrime2.C index f03ed13570..46b11f79f2 100644 --- a/applications/utilities/postProcessing/scalarField/pPrime2/pPrime2.C +++ b/applications/utilities/postProcessing/scalarField/pPrime2/pPrime2.C @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) ); // Check p exists - if (pheader.headerOk()) + if (pheader.typeHeaderOk(true)) { mesh.readUpdate(); diff --git a/applications/utilities/postProcessing/stressField/stressComponents/stressComponents.C b/applications/utilities/postProcessing/stressField/stressComponents/stressComponents.C index 86ffee3d6a..c985bc8190 100644 --- a/applications/utilities/postProcessing/stressField/stressComponents/stressComponents.C +++ b/applications/utilities/postProcessing/stressField/stressComponents/stressComponents.C @@ -62,7 +62,7 @@ int main(int argc, char *argv[]) ); // Check U exists - if (Uheader.headerOk()) + if (Uheader.typeHeaderOk(true)) { mesh.readUpdate(); diff --git a/applications/utilities/postProcessing/turbulence/R/R.C b/applications/utilities/postProcessing/turbulence/R/R.C index 490ae2eeb9..2d7bab324c 100644 --- a/applications/utilities/postProcessing/turbulence/R/R.C +++ b/applications/utilities/postProcessing/turbulence/R/R.C @@ -78,7 +78,7 @@ void calcCompressibleR IOobject::NO_WRITE ); - if (!rhoHeader.headerOk()) + if (!rhoHeader.typeHeaderOk(true)) { Info<< " no " << rhoHeader.name() <<" field" << endl; return; @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) IOobject::NO_WRITE ); - if (UHeader.headerOk()) + if (UHeader.typeHeaderOk(true)) { Info<< "Reading field " << UHeader.name() << nl << endl; volVectorField U(UHeader, mesh); @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) basicThermo::dictName, runTime.constant(), mesh - ).headerOk() + ).typeHeaderOk(true) ) { calcCompressibleR(mesh, runTime, U); diff --git a/applications/utilities/postProcessing/turbulence/createTurbulenceFields/createTurbulenceFields.C b/applications/utilities/postProcessing/turbulence/createTurbulenceFields/createTurbulenceFields.C index f1d37ed6a5..06ceb70f49 100644 --- a/applications/utilities/postProcessing/turbulence/createTurbulenceFields/createTurbulenceFields.C +++ b/applications/utilities/postProcessing/turbulence/createTurbulenceFields/createTurbulenceFields.C @@ -76,7 +76,11 @@ int main(int argc, char *argv[]) if (findStrings(fieldPatterns, "k")) { - if (!IOobject("k", runTime.timeName(), mesh).headerOk()) + if + ( + !IOobject("k", runTime.timeName(), mesh). + typeHeaderOk(true) + ) { Info<< " Writing turbulence field k" << endl; const volScalarField k(RASModel->k()); @@ -90,7 +94,11 @@ int main(int argc, char *argv[]) if (findStrings(fieldPatterns, "epsilon")) { - if (!IOobject("epsilon", runTime.timeName(), mesh).headerOk()) + if + ( + !IOobject("epsilon", runTime.timeName(), mesh). + typeHeaderOk(true) + ) { Info<< " Writing turbulence field epsilon" << endl; const volScalarField epsilon(RASModel->epsilon()); @@ -104,7 +112,11 @@ int main(int argc, char *argv[]) if (findStrings(fieldPatterns, "R")) { - if (!IOobject("R", runTime.timeName(), mesh).headerOk()) + if + ( + !IOobject("R", runTime.timeName(), mesh). + typeHeaderOk(true) + ) { Info<< " Writing turbulence field R" << endl; const volSymmTensorField R(RASModel->R()); @@ -118,7 +130,11 @@ int main(int argc, char *argv[]) if (findStrings(fieldPatterns, "omega")) { - if (!IOobject("omega", runTime.timeName(), mesh).headerOk()) + if + ( + !IOobject("omega", runTime.timeName(), mesh). + typeHeaderOk(true) + ) { const scalar Cmu = 0.09; diff --git a/applications/utilities/postProcessing/velocityField/Co/Co.C b/applications/utilities/postProcessing/velocityField/Co/Co.C index 03718ef523..95f11893c2 100644 --- a/applications/utilities/postProcessing/velocityField/Co/Co.C +++ b/applications/utilities/postProcessing/velocityField/Co/Co.C @@ -50,7 +50,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) IOobject::MUST_READ ); - if (phiHeader.headerOk()) + if (phiHeader.typeHeaderOk(true)) { volScalarField Co ( diff --git a/applications/utilities/postProcessing/velocityField/Lambda2/Lambda2.C b/applications/utilities/postProcessing/velocityField/Lambda2/Lambda2.C index 7ab06c392d..3208b5beeb 100644 --- a/applications/utilities/postProcessing/velocityField/Lambda2/Lambda2.C +++ b/applications/utilities/postProcessing/velocityField/Lambda2/Lambda2.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,7 +48,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) IOobject::MUST_READ ); - if (Uheader.headerOk()) + if (Uheader.typeHeaderOk(true)) { Info<< " Reading U" << endl; volVectorField U(Uheader, mesh); diff --git a/applications/utilities/postProcessing/velocityField/Mach/Mach.C b/applications/utilities/postProcessing/velocityField/Mach/Mach.C index a65eb0a07c..9914a3a098 100644 --- a/applications/utilities/postProcessing/velocityField/Mach/Mach.C +++ b/applications/utilities/postProcessing/velocityField/Mach/Mach.C @@ -58,7 +58,11 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) ); // Check U and T exists - if (Uheader.headerOk() && Theader.headerOk()) + if + ( + Uheader.typeHeaderOk(true) + && Theader.typeHeaderOk(true) + ) { autoPtr MachPtr; @@ -71,7 +75,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) basicThermo::dictName, runTime.constant(), mesh - ).headerOk() + ).typeHeaderOk(false) ) { // thermophysical Mach diff --git a/applications/utilities/postProcessing/velocityField/Mach/thermodynamicMach.H b/applications/utilities/postProcessing/velocityField/Mach/thermodynamicMach.H index 00d1717f7d..14c6fcda46 100644 --- a/applications/utilities/postProcessing/velocityField/Mach/thermodynamicMach.H +++ b/applications/utilities/postProcessing/velocityField/Mach/thermodynamicMach.H @@ -24,7 +24,11 @@ // Check U exists - if (Uheader.headerOk() && Theader.headerOk()) + if + ( + Uheader.typeHeaderOk(true) + && Theader.typeHeaderOk(true) + ) { mesh.readUpdate(); diff --git a/applications/utilities/postProcessing/velocityField/Mach/thermophysicalMach.H b/applications/utilities/postProcessing/velocityField/Mach/thermophysicalMach.H index 7125bd33af..af0601762a 100644 --- a/applications/utilities/postProcessing/velocityField/Mach/thermophysicalMach.H +++ b/applications/utilities/postProcessing/velocityField/Mach/thermophysicalMach.H @@ -14,7 +14,7 @@ IOobject::MUST_READ ); - if (Uheader.headerOk()) + if (Uheader.typeHeaderOk(true)) { volVectorField U(Uheader, mesh); diff --git a/applications/utilities/postProcessing/velocityField/Pe/Pe.C b/applications/utilities/postProcessing/velocityField/Pe/Pe.C index 9c115c078d..69c4964429 100644 --- a/applications/utilities/postProcessing/velocityField/Pe/Pe.C +++ b/applications/utilities/postProcessing/velocityField/Pe/Pe.C @@ -55,7 +55,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) IOobject::MUST_READ ); - if (phiHeader.headerOk()) + if (phiHeader.typeHeaderOk(true)) { autoPtr PePtr; @@ -87,7 +87,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0)) { - if (turbulencePropertiesHeader.headerOk()) + if (turbulencePropertiesHeader.typeHeaderOk(true)) { singlePhaseTransportModel laminarTransport(U, phi); @@ -144,7 +144,8 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) ( "Pef", runTime.timeName(), - mesh + mesh, + IOobject::NO_READ ), mag(phi) /( @@ -158,7 +159,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) } else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0)) { - if (turbulencePropertiesHeader.headerOk()) + if (turbulencePropertiesHeader.typeHeaderOk(true)) { autoPtr thermo(fluidThermo::New(mesh)); diff --git a/applications/utilities/postProcessing/velocityField/Q/Q.C b/applications/utilities/postProcessing/velocityField/Q/Q.C index 0f9c6d8d8c..b54a4ce399 100644 --- a/applications/utilities/postProcessing/velocityField/Q/Q.C +++ b/applications/utilities/postProcessing/velocityField/Q/Q.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,7 +51,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) IOobject::MUST_READ ); - if (Uheader.headerOk()) + if (Uheader.typeHeaderOk(true)) { Info<< " Reading U" << endl; volVectorField U(Uheader, mesh); diff --git a/applications/utilities/postProcessing/velocityField/enstrophy/enstrophy.C b/applications/utilities/postProcessing/velocityField/enstrophy/enstrophy.C index fd7fe2798a..ea681d69d9 100644 --- a/applications/utilities/postProcessing/velocityField/enstrophy/enstrophy.C +++ b/applications/utilities/postProcessing/velocityField/enstrophy/enstrophy.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,7 +49,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) IOobject::MUST_READ ); - if (Uheader.headerOk()) + if (Uheader.typeHeaderOk(true)) { Info<< " Reading U" << endl; volVectorField U(Uheader, mesh); diff --git a/applications/utilities/postProcessing/velocityField/flowType/flowType.C b/applications/utilities/postProcessing/velocityField/flowType/flowType.C index 317b6a2704..309393d19d 100644 --- a/applications/utilities/postProcessing/velocityField/flowType/flowType.C +++ b/applications/utilities/postProcessing/velocityField/flowType/flowType.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -57,7 +57,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) IOobject::MUST_READ ); - if (Uheader.headerOk()) + if (Uheader.typeHeaderOk(true)) { Info<< " Reading U" << endl; volVectorField U(Uheader, mesh); diff --git a/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C b/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C index 620c4fdb78..120c197a91 100644 --- a/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C +++ b/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) IOobject::NO_READ ); - if (phiHeader.headerOk()) + if (phiHeader.typeHeaderOk(true)) { mesh.readUpdate(); diff --git a/applications/utilities/postProcessing/velocityField/uprime/uprime.C b/applications/utilities/postProcessing/velocityField/uprime/uprime.C index 0922cb65ee..8b1b9f15b0 100644 --- a/applications/utilities/postProcessing/velocityField/uprime/uprime.C +++ b/applications/utilities/postProcessing/velocityField/uprime/uprime.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,7 +49,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) IOobject::MUST_READ ); - if (kheader.headerOk()) + if (kheader.typeHeaderOk(true)) { Info<< " Reading k" << endl; volScalarField k(kheader, mesh); diff --git a/applications/utilities/postProcessing/velocityField/vorticity/vorticity.C b/applications/utilities/postProcessing/velocityField/vorticity/vorticity.C index 7ecf36a529..7662dff311 100644 --- a/applications/utilities/postProcessing/velocityField/vorticity/vorticity.C +++ b/applications/utilities/postProcessing/velocityField/vorticity/vorticity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,7 +49,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) IOobject::MUST_READ ); - if (Uheader.headerOk()) + if (Uheader.typeHeaderOk(true)) { Info<< " Reading U" << endl; volVectorField U(Uheader, mesh); diff --git a/applications/utilities/postProcessing/wall/wallGradU/wallGradU.C b/applications/utilities/postProcessing/wall/wallGradU/wallGradU.C index 7d58220a59..49e1454485 100644 --- a/applications/utilities/postProcessing/wall/wallGradU/wallGradU.C +++ b/applications/utilities/postProcessing/wall/wallGradU/wallGradU.C @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) ); // Check U exists - if (Uheader.headerOk()) + if (Uheader.typeHeaderOk(true)) { mesh.readUpdate(); @@ -109,7 +109,7 @@ int main(int argc, char *argv[]) } } - Info<< "End" << endl; + Info<< "End\n" << endl; return 0; } diff --git a/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C b/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C index 6f6609c2fd..248893451f 100644 --- a/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C +++ b/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C @@ -88,7 +88,7 @@ void calcCompressible IOobject::NO_WRITE ); - if (!rhoHeader.headerOk()) + if (!rhoHeader.typeHeaderOk(true)) { Info<< " no rho field" << endl; return; @@ -169,7 +169,7 @@ int main(int argc, char *argv[]) IOobject::NO_WRITE ); - if (UHeader.headerOk()) + if (UHeader.typeHeaderOk(true)) { Info<< "Reading field U\n" << endl; volVectorField U(UHeader, mesh); @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) basicThermo::dictName, runTime.constant(), mesh - ).headerOk() + ).typeHeaderOk(true) ) { calcCompressible(mesh, runTime, U, wallShearStress); diff --git a/applications/utilities/postProcessing/wall/yPlus/yPlus.C b/applications/utilities/postProcessing/wall/yPlus/yPlus.C index f2815ef895..04d80ab6c0 100644 --- a/applications/utilities/postProcessing/wall/yPlus/yPlus.C +++ b/applications/utilities/postProcessing/wall/yPlus/yPlus.C @@ -149,7 +149,7 @@ void calcCompressibleYPlus IOobject::NO_WRITE ); - if (!rhoHeader.headerOk()) + if (!rhoHeader.typeHeaderOk(true)) { Info<< " no rho field" << endl; return; @@ -216,7 +216,7 @@ int main(int argc, char *argv[]) IOobject::NO_WRITE ); - if (UHeader.headerOk()) + if (UHeader.typeHeaderOk(true)) { Info<< "Reading field U\n" << endl; volVectorField U(UHeader, mesh); @@ -228,7 +228,7 @@ int main(int argc, char *argv[]) basicThermo::dictName, runTime.constant(), mesh - ).headerOk() + ).typeHeaderOk(true) ) { calcCompressibleYPlus(mesh, runTime, U, yPlus); diff --git a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C index 94c7f53f84..2759555e07 100644 --- a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C +++ b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -163,7 +163,7 @@ void calcOmega false ); - if (omegaHeader.headerOk()) + if (omegaHeader.typeHeaderOk(true)) { volScalarField omega(omegaHeader, mesh); dimensionedScalar k0("SMALL", k.dimensions(), SMALL); @@ -200,7 +200,7 @@ void setField false ); - if (fldHeader.headerOk()) + if (fldHeader.typeHeaderOk(true)) { volScalarField fld(fldHeader, mesh); fld = value; @@ -388,7 +388,7 @@ int main(int argc, char *argv[]) basicThermo::dictName, runTime.constant(), mesh - ).headerOk() + ).typeHeaderOk(true) ) { calcCompressible(mesh, mask, U, y, ybl); diff --git a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C index 8f8bdcbaba..78a4a29908 100644 --- a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C +++ b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C @@ -628,7 +628,7 @@ int main(int argc, char *argv[]) false ); - if (fieldHeader.headerOk()) + if (fieldHeader.typeHeaderOk(false)) { IOdictionary fieldDict(fieldHeader); diff --git a/applications/utilities/preProcessing/createZeroDirectory/boundaryTemplates.C b/applications/utilities/preProcessing/createZeroDirectory/boundaryTemplates.C index 193334e37d..77381e362e 100644 --- a/applications/utilities/preProcessing/createZeroDirectory/boundaryTemplates.C +++ b/applications/utilities/preProcessing/createZeroDirectory/boundaryTemplates.C @@ -90,7 +90,7 @@ Foam::boundaryTemplates::boundaryTemplates IOobject::MUST_READ ); - if (io.headerOk()) + if (io.typeHeaderOk(true)) { IOdictionary dict(io); regionTemplate.subDict(patchTypes[i]).merge(dict); diff --git a/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C b/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C index becbc614ad..4bea82a295 100644 --- a/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C +++ b/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -57,7 +57,7 @@ Foam::word Foam::solverTemplate::readFromDict const word& entryName ) const { - if (!dictHeader.headerOk()) + if (!dictHeader.typeHeaderOk(true)) { FatalErrorInFunction << "Unable to open file " diff --git a/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C b/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C index ea1559aac2..77db19822a 100644 --- a/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C +++ b/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C @@ -74,7 +74,8 @@ void rewriteBoundary HashTable& nbrNames ) { - Info<< "Reading boundary from " << io.filePath() << endl; + Info<< "Reading boundary from " << typeFilePath >(io) + << endl; // Read PtrList of dictionary. const word oldTypeName = IOPtrList::typeName; @@ -446,7 +447,7 @@ int main(int argc, char *argv[]) false ); - if (io.headerOk()) + if (io.typeHeaderOk >(false)) { rewriteBoundary ( @@ -480,7 +481,7 @@ int main(int argc, char *argv[]) false ); - if (io.headerOk()) + if (io.typeHeaderOk >(false)) { rewriteBoundary ( diff --git a/applications/utilities/preProcessing/mapFields/MapConsistentVolFields.H b/applications/utilities/preProcessing/mapFields/MapConsistentVolFields.H index 672573e8c3..14f6827515 100644 --- a/applications/utilities/preProcessing/mapFields/MapConsistentVolFields.H +++ b/applications/utilities/preProcessing/mapFields/MapConsistentVolFields.H @@ -44,13 +44,12 @@ void MapConsistentVolFields const CombineOp& cop ) { + typedef GeometricField fieldType; + const fvMesh& meshSource = meshToMesh0Interp.fromMesh(); const fvMesh& meshTarget = meshToMesh0Interp.toMesh(); - word fieldClassName - ( - GeometricField::typeName - ); + word fieldClassName(fieldType::typeName); IOobjectList fields = objects.lookupClass(fieldClassName); @@ -60,11 +59,7 @@ void MapConsistentVolFields << endl; // Read field - GeometricField fieldSource - ( - *fieldIter(), - meshSource - ); + fieldType fieldSource(*fieldIter(), meshSource); IOobject fieldTargetIOobject ( @@ -75,14 +70,10 @@ void MapConsistentVolFields IOobject::AUTO_WRITE ); - if (fieldTargetIOobject.headerOk()) + if (fieldTargetIOobject.typeHeaderOk(true)) { // Read fieldTarget - GeometricField fieldTarget - ( - fieldTargetIOobject, - meshTarget - ); + fieldType fieldTarget(fieldTargetIOobject, meshTarget); // Interpolate field meshToMesh0Interp.interpolate @@ -101,7 +92,7 @@ void MapConsistentVolFields fieldTargetIOobject.readOpt() = IOobject::NO_READ; // Interpolate field - GeometricField fieldTarget + fieldType fieldTarget ( fieldTargetIOobject, meshToMesh0Interp.interpolate diff --git a/applications/utilities/preProcessing/mapFields/MapVolFields.H b/applications/utilities/preProcessing/mapFields/MapVolFields.H index c72e70962a..f5be235de1 100644 --- a/applications/utilities/preProcessing/mapFields/MapVolFields.H +++ b/applications/utilities/preProcessing/mapFields/MapVolFields.H @@ -44,13 +44,12 @@ void MapVolFields const CombineOp& cop ) { + typedef GeometricField fieldType; + const fvMesh& meshSource = meshToMesh0Interp.fromMesh(); const fvMesh& meshTarget = meshToMesh0Interp.toMesh(); - word fieldClassName - ( - GeometricField::typeName - ); + word fieldClassName(fieldType::typeName); IOobjectList fields = objects.lookupClass(fieldClassName); @@ -65,20 +64,20 @@ void MapVolFields IOobject::AUTO_WRITE ); - if (fieldTargetIOobject.headerOk()) + if (fieldTargetIOobject.typeHeaderOk(true)) { Info<< " interpolating " << fieldIter()->name() << endl; // Read field fieldSource - GeometricField fieldSource + fieldType fieldSource ( *fieldIter(), meshSource ); // Read fieldTarget - GeometricField fieldTarget + fieldType fieldTarget ( fieldTargetIOobject, meshTarget diff --git a/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H b/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H index ac5c18b077..c365bbddf6 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H +++ b/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H @@ -69,7 +69,7 @@ void MapVolFields IOobject::MUST_READ ); - if (targetIO.headerOk()) + if (targetIO.typeHeaderOk(true)) { fieldType fieldTarget(targetIO, meshTarget); diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C index eedce844bc..c20c2e51f5 100644 --- a/applications/utilities/preProcessing/setFields/setFields.C +++ b/applications/utilities/preProcessing/setFields/setFields.C @@ -64,7 +64,7 @@ bool setCellFieldType ); // Check the "constant" directory - if (!fieldHeader.headerOk()) + if (!fieldHeader.typeHeaderOk(true)) { fieldHeader = IOobject ( @@ -76,7 +76,7 @@ bool setCellFieldType } // Check field exists - if (fieldHeader.headerOk()) + if (fieldHeader.typeHeaderOk(true)) { Info<< " Setting internal values of " << fieldHeader.headerClassName() @@ -208,7 +208,7 @@ bool setFaceFieldType ); // Check the "constant" directory - if (!fieldHeader.headerOk()) + if (!fieldHeader.typeHeaderOk(true)) { fieldHeader = IOobject ( @@ -220,7 +220,7 @@ bool setFaceFieldType } // Check field exists - if (fieldHeader.headerOk()) + if (fieldHeader.typeHeaderOk(true)) { Info<< " Setting patchField values of " << fieldHeader.headerClassName() diff --git a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C index 17e22f8c07..e5f280e658 100644 --- a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C +++ b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C @@ -194,7 +194,7 @@ int main(int argc, char *argv[]) } - if (!csDictIoPtr->headerOk()) + if (!csDictIoPtr->typeHeaderOk(false)) { FatalErrorInFunction << csDictIoPtr->objectPath() << nl diff --git a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C index 4b8d230080..d9c98b3e74 100644 --- a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C +++ b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C @@ -174,7 +174,7 @@ int main(int argc, char *argv[]) } - if (!ioPtr->headerOk()) + if (!ioPtr->typeHeaderOk(false)) { FatalErrorInFunction << ioPtr->objectPath() << nl diff --git a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C index 2bf0c9c014..708d5ab5ba 100644 --- a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C +++ b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C @@ -187,7 +187,7 @@ int main(int argc, char *argv[]) } - if (!ioPtr->headerOk()) + if (!ioPtr->typeHeaderOk(false)) { FatalErrorInFunction << ioPtr->objectPath() << nl diff --git a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C index 5a9674cf1a..2b69ddad73 100644 --- a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C +++ b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C @@ -42,6 +42,7 @@ Note #include "polyMesh.H" #include "distributedTriSurfaceMesh.H" #include "mapDistribute.H" +#include "localIOdictionary.H" using namespace Foam; @@ -165,23 +166,6 @@ int main(int argc, char *argv[]) Pstream::scatterList(meshBb); } - - - // Temporarily: override master-only checking - regIOobject::fileCheckTypes oldCheckType = - regIOobject::fileModificationChecking; - - if (oldCheckType == regIOobject::timeStampMaster) - { - regIOobject::fileModificationChecking = regIOobject::timeStamp; - } - else if (oldCheckType == regIOobject::inotifyMaster) - { - regIOobject::fileModificationChecking = regIOobject::inotify; - } - - - IOobject io ( surfFileName, // name @@ -193,7 +177,8 @@ int main(int argc, char *argv[]) IOobject::AUTO_WRITE ); - const fileName actualPath(io.filePath()); + // Look for file (using searchableSurface rules) + const fileName actualPath(typeFilePath(io)); fileName localPath(actualPath); localPath.replace(runTime.rootPath() + '/', ""); @@ -271,10 +256,6 @@ int main(int argc, char *argv[]) Info<< "Writing surface." << nl << endl; surfMesh.objectRegistry::write(); - - regIOobject::fileModificationChecking = oldCheckType; - - Info<< "End\n" << endl; return 0; diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index f6d3379ecf..8d9b38f21f 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -183,11 +183,17 @@ $(functionEntries)/inputModeEntry/inputModeEntry.C $(functionEntries)/removeEntry/removeEntry.C IOdictionary = db/IOobjects/IOdictionary +$(IOdictionary)/baseIOdictionary.C +$(IOdictionary)/baseIOdictionaryIO.C $(IOdictionary)/IOdictionary.C -$(IOdictionary)/IOdictionaryIO.C +$(IOdictionary)/localIOdictionary.C +$(IOdictionary)/unwatchedIOdictionary.C db/IOobjects/IOMap/IOMapName.C +db/IOobjects/GlobalIOList/globalIOLists.C + + IOobject = db/IOobject $(IOobject)/IOobject.C $(IOobject)/IOobjectIO.C @@ -592,6 +598,9 @@ $(Fields)/quaternionField/quaternionIOField.C $(Fields)/triadField/triadIOField.C $(Fields)/transformField/transformField.C +$(Fields)/globalFields/globalIOFields.C + + pointPatchFields = fields/pointPatchFields $(pointPatchFields)/pointPatchField/pointPatchFields.C diff --git a/src/OpenFOAM/db/IOobject/IOobject.C b/src/OpenFOAM/db/IOobject/IOobject.C index 80a33b94b0..3643d1ee22 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.C +++ b/src/OpenFOAM/db/IOobject/IOobject.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,11 +32,87 @@ License namespace Foam { defineTypeNameAndDebug(IOobject, 0); + + template<> + const char* NamedEnum + < + IOobject::fileCheckTypes, + 4 + >::names[] = + { + "timeStamp", + "timeStampMaster", + "inotify", + "inotifyMaster" + }; +} + + +const Foam::NamedEnum + Foam::IOobject::fileCheckTypesNames; + +// Default fileCheck type +Foam::IOobject::fileCheckTypes Foam::IOobject::fileModificationChecking +( + fileCheckTypesNames.read + ( + debug::optimisationSwitches().lookup + ( + "fileModificationChecking" + ) + ) +); + +namespace Foam +{ + // Register re-reader + class addfileModificationCheckingToOpt + : + public ::Foam::simpleRegIOobject + { + public: + + addfileModificationCheckingToOpt(const char* name) + : + ::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name) + {} + + virtual ~addfileModificationCheckingToOpt() + {} + + virtual void readData(Foam::Istream& is) + { + IOobject::fileModificationChecking = + IOobject::fileCheckTypesNames.read(is); + } + + virtual void writeData(Foam::Ostream& os) const + { + os << IOobject::fileCheckTypesNames + [IOobject::fileModificationChecking]; + } + }; + + addfileModificationCheckingToOpt addfileModificationCheckingToOpt_ + ( + "fileModificationChecking" + ); } // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // +// Return components following the IOobject requirements +// +// behaviour +// input IOobject(instance, local, name) +// ----- ------ +// "foo" ("", "", "foo") +// "foo/bar" ("foo", "", "bar") +// "/XXX/bar" ("/XXX", "", "bar") +// "foo/bar/" ERROR - no name +// "foo/xxx/bar" ("foo", "xxx", "bar") +// "foo/xxx/yyy/bar" ("foo", "xxx/yyy", "bar") bool Foam::IOobject::fileNameComponents ( const fileName& path, @@ -129,6 +205,7 @@ Foam::IOobject::IOobject rOpt_(ro), wOpt_(wo), registerObject_(registerObject), + globalObject_(false), objState_(GOOD) { if (objectRegistry::debug) @@ -148,7 +225,8 @@ Foam::IOobject::IOobject const objectRegistry& registry, readOption ro, writeOption wo, - bool registerObject + bool registerObject, + bool globalObject ) : name_(name), @@ -160,6 +238,7 @@ Foam::IOobject::IOobject rOpt_(ro), wOpt_(wo), registerObject_(registerObject), + globalObject_(globalObject), objState_(GOOD) { if (objectRegistry::debug) @@ -177,7 +256,8 @@ Foam::IOobject::IOobject const objectRegistry& registry, readOption ro, writeOption wo, - bool registerObject + bool registerObject, + bool globalObject ) : name_(), @@ -189,6 +269,7 @@ Foam::IOobject::IOobject rOpt_(ro), wOpt_(wo), registerObject_(registerObject), + globalObject_(globalObject), objState_(GOOD) { if (!fileNameComponents(path, instance_, local_, name_)) @@ -207,6 +288,26 @@ Foam::IOobject::IOobject } +Foam::IOobject::IOobject +( + const IOobject& io, + const objectRegistry& registry +) +: + name_(io.name_), + headerClassName_(io.headerClassName_), + note_(io.note_), + instance_(io.instance_), + local_(io.local_), + db_(registry), + rOpt_(io.rOpt_), + wOpt_(io.wOpt_), + registerObject_(io.registerObject_), + globalObject_(io.globalObject_), + objState_(io.objState_) +{} + + Foam::IOobject::IOobject ( const IOobject& io, @@ -222,6 +323,7 @@ Foam::IOobject::IOobject rOpt_(io.rOpt_), wOpt_(io.wOpt_), registerObject_(io.registerObject_), + globalObject_(io.globalObject_), objState_(io.objState_) {} @@ -312,11 +414,12 @@ Foam::fileName Foam::IOobject::path } -Foam::fileName Foam::IOobject::filePath() const +Foam::fileName Foam::IOobject::localFilePath() const { if (instance().isAbsolute()) { fileName objectPath = instance()/name(); + if (isFile(objectPath)) { return objectPath; @@ -337,25 +440,6 @@ Foam::fileName Foam::IOobject::filePath() const } else { - if - ( - time().processorCase() - && ( - instance() == time().system() - || instance() == time().constant() - ) - ) - { - fileName parentObjectPath = - rootPath()/time().globalCaseName() - /instance()/db_.dbDir()/local()/name(); - - if (isFile(parentObjectPath)) - { - return parentObjectPath; - } - } - if (!isDir(path)) { word newInstancePath = time().findInstancePath @@ -384,9 +468,107 @@ Foam::fileName Foam::IOobject::filePath() const } -Foam::Istream* Foam::IOobject::objectStream() +Foam::fileName Foam::IOobject::globalFilePath() const { - return objectStream(filePath()); + if (instance().isAbsolute()) + { + fileName objectPath = instance()/name(); + if (isFile(objectPath)) + { + if (objectRegistry::debug) + { + Pout<< "globalFilePath : returning absolute:" << objectPath + << endl; + } + return objectPath; + } + else + { + if (objectRegistry::debug) + { + Pout<< "globalFilePath : absolute not found:" << objectPath + << endl; + } + return fileName::null; + } + } + else + { + fileName path = this->path(); + fileName objectPath = path/name(); + + if (isFile(objectPath)) + { + if (objectRegistry::debug) + { + Pout<< "globalFilePath : returning time:" << objectPath << endl; + } + return objectPath; + } + else + { + if + ( + time().processorCase() + && ( + instance() == time().system() + || instance() == time().constant() + ) + ) + { + // Constant & system can come from global case + + fileName parentObjectPath = + rootPath()/time().globalCaseName() + /instance()/db().dbDir()/local()/name(); + + if (isFile(parentObjectPath)) + { + if (objectRegistry::debug) + { + Pout<< "globalFilePath : returning parent:" + << parentObjectPath << endl; + } + return parentObjectPath; + } + } + + // Check for approximately same time + if (!isDir(path)) + { + word newInstancePath = time().findInstancePath + ( + instant(instance()) + ); + + if (newInstancePath.size()) + { + fileName fName + ( + rootPath()/caseName() + /newInstancePath/db().dbDir()/local()/name() + ); + + if (isFile(fName)) + { + if (objectRegistry::debug) + { + Pout<< "globalFilePath : returning similar time:" + << fName << endl; + } + + return fName; + } + } + } + } + + if (objectRegistry::debug) + { + Pout<< "globalFilePath : time not found:" << objectPath << endl; + } + return fileName::null; + } } @@ -413,47 +595,6 @@ Foam::Istream* Foam::IOobject::objectStream(const fileName& fName) } -bool Foam::IOobject::headerOk() -{ - bool ok = true; - - Istream* isPtr = objectStream(); - - // If the stream has failed return - if (!isPtr) - { - if (objectRegistry::debug) - { - Info - << "IOobject::headerOk() : " - << "file " << objectPath() << " could not be opened" - << endl; - } - - ok = false; - } - else - { - // Try reading header - if (!readHeader(*isPtr)) - { - if (objectRegistry::debug) - { - IOWarningInFunction((*isPtr)) - << "failed to read header of file " << objectPath() - << endl; - } - - ok = false; - } - } - - delete isPtr; - - return ok; -} - - void Foam::IOobject::setBad(const string& s) { if (objState_ != GOOD) @@ -482,6 +623,7 @@ void Foam::IOobject::operator=(const IOobject& io) local_ = io.local_; rOpt_ = io.rOpt_; wOpt_ = io.wOpt_; + globalObject_ = io.globalObject_; objState_ = io.objState_; } diff --git a/src/OpenFOAM/db/IOobject/IOobject.H b/src/OpenFOAM/db/IOobject/IOobject.H index 15f4465e9f..4eb60a7452 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.H +++ b/src/OpenFOAM/db/IOobject/IOobject.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -76,6 +76,7 @@ SourceFiles #include "typeInfo.H" #include "autoPtr.H" #include "InfoProxy.H" +#include "NamedEnum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -119,6 +120,16 @@ public: NO_WRITE = 1 }; + //- Enumeration defining the file checking options + enum fileCheckTypes + { + timeStamp, + timeStampMaster, + inotify, + inotifyMaster + }; + + static const NamedEnum fileCheckTypesNames; private: @@ -151,6 +162,9 @@ private: //- Register object created from this IOobject with registry if true bool registerObject_; + //- Is object same for all processors + bool globalObject_; + //- IOobject state objectState objState_; @@ -159,10 +173,6 @@ protected: // Protected Member Functions - //- Construct and return an IFstream for the object. - // The results is NULL if the stream construction failed - Istream* objectStream(); - //- Construct and return an IFstream for the object given the // exact file. The results is NULL if the stream construction failed Istream* objectStream(const fileName&); @@ -180,14 +190,6 @@ public: // Static Member Functions //- Split path into instance, local, name components - // input IOobject(instance, local, name) - // ----- ------ - // "foo" ("", "", "foo") - // "foo/bar" ("foo", "", "bar") - // "/XXX/bar" ("/XXX", "", "bar") - // "foo/bar/" ERROR - no name - // "foo/xxx/bar" ("foo", "xxx", "bar") - // "foo/xxx/yyy/bar" ("foo", "xxx/yyy", "bar") static bool fileNameComponents ( const fileName& path, @@ -199,6 +201,9 @@ public: template static inline word groupName(Name name, const word& group); + //- Type of file modification checking + static fileCheckTypes fileModificationChecking; + // Constructors @@ -222,7 +227,8 @@ public: const objectRegistry& registry, readOption r=NO_READ, writeOption w=NO_WRITE, - bool registerObject=true + bool registerObject=true, + bool globalObject = false ); //- Construct from path, registry, io options @@ -233,7 +239,15 @@ public: const objectRegistry& registry, readOption r=NO_READ, writeOption w=NO_WRITE, - bool registerObject=true + bool registerObject=true, + bool globalObject = false + ); + + //- Construct as copy resetting registry + IOobject + ( + const IOobject& io, + const objectRegistry& registry ); //- Construct as copy resetting name @@ -244,11 +258,17 @@ public: ); //- Clone - Foam::autoPtr clone() const + autoPtr clone() const { return autoPtr(new IOobject(*this)); } + //- Clone resetting registry + autoPtr clone(const objectRegistry& registry) const + { + return autoPtr(new IOobject(*this, registry)); + } + //- Destructor virtual ~IOobject(); @@ -306,6 +326,18 @@ public: return registerObject_; } + //- Is object same for all processors + bool& globalObject() + { + return globalObject_; + } + + //- Is object same for all processors + bool globalObject() const + { + return globalObject_; + } + // Read/write options @@ -373,9 +405,11 @@ public: return path()/name(); } - //- Return complete path + object name if the file exists - // either in the case/processor or case otherwise null - fileName filePath() const; + //- Helper for filePath that searches locally + fileName localFilePath() const; + + //- Helper for filePath that searches up if in parallel + fileName globalFilePath() const; // Reading @@ -383,9 +417,14 @@ public: //- Read header bool readHeader(Istream&); - //- Read and check header info - bool headerOk(); + //- Read header (uses typeFilePath to find file) and check header + // info. Optionally checks headerClassName against type + template + bool typeHeaderOk(const bool checkType = true); + //- Helper: warn that type does not support re-reading + template + void warnNoRereading() const; // Writing @@ -442,6 +481,21 @@ template<> Ostream& operator<<(Ostream& os, const InfoProxy& ip); +//- Template function for obtaining global status +template +inline bool typeGlobal() +{ + return false; +} + +//- Template function for obtaining filePath +template +inline fileName typeFilePath(const IOobject& io) +{ + return (typeGlobal() ? io.globalFilePath() : io.localFilePath()); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam @@ -452,6 +506,12 @@ Ostream& operator<<(Ostream& os, const InfoProxy& ip); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository +# include "IOobjectTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/OpenFOAM/db/IOobject/IOobjectIO.C b/src/OpenFOAM/db/IOobject/IOobjectIO.C index 58664653dc..d1a51dddb5 100644 --- a/src/OpenFOAM/db/IOobject/IOobjectIO.C +++ b/src/OpenFOAM/db/IOobject/IOobjectIO.C @@ -36,6 +36,9 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const InfoProxy& ip) os << "IOobject: " << io.type() << token::SPACE << io.name() << token::SPACE + << "readOpt:" << token::SPACE << io.readOpt() << token::SPACE + << "writeOpt:" << token::SPACE << io.writeOpt() << token::SPACE + << "globalObject:" << token::SPACE << io.globalObject() << token::SPACE << io.path() << endl; return os; diff --git a/src/OpenFOAM/db/IOobject/IOobjectTemplates.C b/src/OpenFOAM/db/IOobject/IOobjectTemplates.C new file mode 100644 index 0000000000..b1e39564a5 --- /dev/null +++ b/src/OpenFOAM/db/IOobject/IOobjectTemplates.C @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "IOobject.H" +#include "Istream.H" + +#include "IOstreams.H" +#include "Pstream.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::IOobject::typeHeaderOk(const bool checkType) +{ + bool ok = true; + + // Everyone check or just master + bool masterOnly = + typeGlobal() + && ( + IOobject::fileModificationChecking == timeStampMaster + || IOobject::fileModificationChecking == inotifyMaster + ); + + + // Determine local status + if (!masterOnly || Pstream::master()) + { + Istream* isPtr = objectStream(typeFilePath(*this)); + + // If the stream has failed return + if (!isPtr) + { + if (IOobject::debug) + { + InfoInFunction + << "file " << objectPath() << " could not be opened" + << endl; + } + + ok = false; + } + else + { + // Try reading header + if (readHeader(*isPtr)) + { + if (checkType && headerClassName_ != Type::typeName) + { + IOWarningInFunction(*isPtr) + << "unexpected class name " << headerClassName_ + << " expected " << Type::typeName << endl; + + ok = false; + } + } + else + { + if (IOobject::debug) + { + IOWarningInFunction(*isPtr) + << "failed to read header of file " << objectPath() + << endl; + } + + ok = false; + } + } + + delete isPtr; + } + + // If masterOnly make sure all processors know about it + if (masterOnly) + { + Pstream::scatter(ok); + } + + return ok; +} + + +template +void Foam::IOobject::warnNoRereading() const +{ + if (readOpt() == IOobject::MUST_READ_IF_MODIFIED) + { + WarningInFunction + << Type::typeName << ' ' << name() + << " constructed with IOobject::MUST_READ_IF_MODIFIED" + " but " << Type::typeName + << " does not support automatic rereading." + << endl; + } +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/db/IOobjectList/IOobjectList.C b/src/OpenFOAM/db/IOobjectList/IOobjectList.C index b1f2643c9e..1ff7afedd4 100644 --- a/src/OpenFOAM/db/IOobjectList/IOobjectList.C +++ b/src/OpenFOAM/db/IOobjectList/IOobjectList.C @@ -26,7 +26,7 @@ License #include "IOobjectList.H" #include "Time.H" #include "OSspecific.H" - +#include "IOList.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -77,7 +77,8 @@ Foam::IOobjectList::IOobjectList registerObject ); - if (objectPtr->headerOk()) + // Use object with local scope + if (objectPtr->typeHeaderOk >(false)) { insert(ObjectNames[i], objectPtr); } diff --git a/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOField.C b/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOField.C new file mode 100644 index 0000000000..84c9cc3771 --- /dev/null +++ b/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOField.C @@ -0,0 +1,134 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "GlobalIOField.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::GlobalIOField::GlobalIOField(const IOobject& io) +: + regIOobject(io) +{ + // Check for MUST_READ_IF_MODIFIED + warnNoRereading >(); + + readHeaderOk(IOstream::BINARY, typeName); +} + + +template +Foam::GlobalIOField::GlobalIOField(const IOobject& io, const label size) +: + regIOobject(io) +{ + // Check for MUST_READ_IF_MODIFIED + warnNoRereading >(); + + if (!readHeaderOk(IOstream::BINARY, typeName)) + { + Field::setSize(size); + } +} + + +template +Foam::GlobalIOField::GlobalIOField +( + const IOobject& io, + const Field& f +) +: + regIOobject(io) +{ + // Check for MUST_READ_IF_MODIFIED + warnNoRereading >(); + + if (!readHeaderOk(IOstream::BINARY, typeName)) + { + Field::operator=(f); + } +} + + +template +Foam::GlobalIOField::GlobalIOField +( + const IOobject& io, + const Xfer >& f +) +: + regIOobject(io) +{ + // Check for MUST_READ_IF_MODIFIED + warnNoRereading >(); + + Field::transfer(f()); + + readHeaderOk(IOstream::BINARY, typeName); +} + + +// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * // + +template +Foam::GlobalIOField::~GlobalIOField() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::GlobalIOField::readData(Istream& is) +{ + is >> *this; + return is.good(); +} + + +template +bool Foam::GlobalIOField::writeData(Ostream& os) const +{ + return (os << static_cast&>(*this)).good(); +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +template +void Foam::GlobalIOField::operator=(const GlobalIOField& rhs) +{ + Field::operator=(rhs); +} + + +template +void Foam::GlobalIOField::operator=(const Field& rhs) +{ + Field::operator=(rhs); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOField.H b/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOField.H new file mode 100644 index 0000000000..db33e9ef8c --- /dev/null +++ b/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOField.H @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::GlobalIOField + +Description + IOField with global data (so optionally read from master) + +SourceFiles + GlobalIOField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef GlobalIOField_H +#define GlobalIOField_H + +#include "regIOobject.H" +#include "Field.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class GlobalIOField Declaration +\*---------------------------------------------------------------------------*/ + +template +class GlobalIOField +: + public regIOobject, + public Field +{ + +public: + + TypeName("Field"); + + + // Constructors + + //- Construct from IOobject + GlobalIOField(const IOobject&); + + //- Construct from IOobject and size (does not set values) + GlobalIOField(const IOobject&, const label size); + + //- Construct from components + GlobalIOField(const IOobject&, const Field&); + + //- Construct by transferring the Field contents + GlobalIOField(const IOobject&, const Xfer >&); + + + //- Destructor + virtual ~GlobalIOField(); + + + // Member functions + + //- Is object global + virtual bool global() const + { + return true; + } + + //- Return complete path + object name if the file exists + // either in the case/processor or case otherwise null + virtual fileName filePath() const + { + return globalFilePath(); + } + + //- ReadData function required for regIOobject read operation + virtual bool readData(Istream&); + + //- WriteData function required for regIOobject write operation + bool writeData(Ostream&) const; + + + // Member operators + + void operator=(const GlobalIOField&); + + void operator=(const Field&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "GlobalIOField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.C b/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.C new file mode 100644 index 0000000000..51130e9b21 --- /dev/null +++ b/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.C @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "GlobalIOList.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::GlobalIOList::GlobalIOList(const IOobject& io) +: + regIOobject(io) +{ + // Check for MUST_READ_IF_MODIFIED + warnNoRereading >(); + + readHeaderOk(IOstream::BINARY, typeName); +} + + +template +Foam::GlobalIOList::GlobalIOList(const IOobject& io, const label size) +: + regIOobject(io) +{ + // Check for MUST_READ_IF_MODIFIED + warnNoRereading >(); + + if (!readHeaderOk(IOstream::BINARY, typeName)) + { + List::setSize(size); + } +} + + +template +Foam::GlobalIOList::GlobalIOList(const IOobject& io, const List& f) +: + regIOobject(io) +{ + // Check for MUST_READ_IF_MODIFIED + warnNoRereading >(); + + if (!readHeaderOk(IOstream::BINARY, typeName)) + { + List::operator=(f); + } +} + + +template +Foam::GlobalIOList::GlobalIOList +( + const IOobject& io, + const Xfer >& f +) +: + regIOobject(io) +{ + // Check for MUST_READ_IF_MODIFIED + warnNoRereading >(); + + List::transfer(f()); + + readHeaderOk(IOstream::BINARY, typeName); +} + + +// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * // + +template +Foam::GlobalIOList::~GlobalIOList() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::GlobalIOList::readData(Istream& is) +{ + is >> *this; + return is.good(); +} + + +template +bool Foam::GlobalIOList::writeData(Ostream& os) const +{ + return (os << *this).good(); +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +template +void Foam::GlobalIOList::operator=(const GlobalIOList& rhs) +{ + List::operator=(rhs); +} + + +template +void Foam::GlobalIOList::operator=(const List& rhs) +{ + List::operator=(rhs); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H b/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H new file mode 100644 index 0000000000..f2ef2ee73e --- /dev/null +++ b/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::GlobalIOList + +Description + IOList with global data (so optionally read from master) + +SourceFiles + GlobalIOList.C + +\*---------------------------------------------------------------------------*/ + +#ifndef GlobalIOList_H +#define GlobalIOList_H + +#include "List.H" +#include "regIOobject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class GlobalIOList Declaration +\*---------------------------------------------------------------------------*/ + +template +class GlobalIOList +: + public regIOobject, + public List +{ + +public: + + TypeName("List"); + + + // Constructors + + //- Construct from IOobject + GlobalIOList(const IOobject&); + + //- Construct from IOobject + GlobalIOList(const IOobject&, const label size); + + //- Construct from IOobject and a List + GlobalIOList(const IOobject&, const List&); + + //- Construct by transferring the List contents + GlobalIOList(const IOobject&, const Xfer >&); + + + //- Destructor + virtual ~GlobalIOList(); + + + // Member functions + + //- Is object global + virtual bool global() const + { + return true; + } + + //- Return complete path + object name if the file exists + // either in the case/processor or case otherwise null + virtual fileName filePath() const + { + return globalFilePath(); + } + + //- ReadData function required for regIOobject read operation + virtual bool readData(Istream&); + + //- WriteData function required for regIOobject write operation + bool writeData(Ostream&) const; + + + // Member operators + + void operator=(const GlobalIOList&); + + void operator=(const List&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "GlobalIOList.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/db/IOobjects/GlobalIOList/globalIOLists.C b/src/OpenFOAM/db/IOobjects/GlobalIOList/globalIOLists.C new file mode 100644 index 0000000000..d7e1214fb5 --- /dev/null +++ b/src/OpenFOAM/db/IOobjects/GlobalIOList/globalIOLists.C @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "globalIOLists.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTemplateTypeNameWithName(labelGlobalIOList, "labelList"); + defineTemplateTypeNameWithName(scalarGlobalIOList, "scalarList"); + defineTemplateTypeNameWithName(vectorGlobalIOList, "vectorList"); + defineTemplateTypeNameWithName + ( + sphericalTensorGlobalIOList, + "sphericalTensorList" + ); + defineTemplateTypeNameWithName(symmTensorGlobalIOList, "symmTensorList"); + defineTemplateTypeNameWithName(tensorGlobalIOList, "tensorList"); +} + +// ************************************************************************* // diff --git a/src/OpenFOAM/db/IOobjects/GlobalIOList/globalIOLists.H b/src/OpenFOAM/db/IOobjects/GlobalIOList/globalIOLists.H new file mode 100644 index 0000000000..c65a5619c6 --- /dev/null +++ b/src/OpenFOAM/db/IOobjects/GlobalIOList/globalIOLists.H @@ -0,0 +1,88 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Typedef + Foam::globalIOLists + +Description + Typedefs for globalIOLists of primitive types. These are fully compatible + with 'normal' IOLists except have global filePath() scope. + +\*---------------------------------------------------------------------------*/ + +#ifndef globalIOLists_H +#define globalIOLists_H + +#include "primitiveFields.H" +#include "GlobalIOList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef GlobalIOList