From 9a2a22a03a1f9172260da507110b464845bfd88a Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Wed, 17 Mar 2021 11:02:10 +0100 Subject: [PATCH] ENH: provide setter methods for IOobject read/write options etc. - simplifies local toggling. - centralize fileModification static variables into IOobject. They were previously scattered between IOobject and regIOobject --- .../readMechanicalProperties.H | 6 +-- .../readThermalProperties.H | 6 +-- applications/test/IOField/Test-IOField.C | 6 +-- .../utilities/mesh/advanced/PDRMesh/PDRMesh.C | 22 ++++----- .../manipulation/renumberMesh/renumberMesh.C | 16 +++---- .../manipulation/setsToZones/setsToZones.C | 7 +-- .../singleCellMesh/singleCellMesh.C | 4 +- .../splitMeshRegions/splitMeshRegions.C | 8 ++-- .../foamFormatConvert/foamFormatConvert.C | 4 +- .../decomposePar/domainDecomposition.C | 8 ++-- .../redistributePar/loadOrCreateMesh.C | 6 +-- .../redistributePar/redistributePar.C | 4 +- .../foamToEnsight/getTimeIndex.H | 2 +- .../dataConversion/foamToGMV/moveMesh.H | 2 +- .../changeDictionary/changeDictionary.C | 4 +- .../foamUpgradeCyclics/foamUpgradeCyclics.C | 4 +- .../mapFields/MapConsistentVolFields.H | 4 +- .../preProcessing/mapFieldsPar/MapVolFields.H | 4 +- .../surfaceRedistributePar.C | 4 +- .../MSwindows/fileMonitor/fileMonitor.C | 6 +-- .../POSIX/fileMonitor/fileMonitor.C | 6 +-- src/OpenFOAM/db/IOobject/IOobject.C | 24 ++++++++++ src/OpenFOAM/db/IOobject/IOobject.H | 47 ++++++++++++++----- src/OpenFOAM/db/IOobject/IOobjectI.H | 26 ++++++---- .../IOdictionary/unwatchedIOdictionary.C | 4 +- src/OpenFOAM/db/Time/Time.C | 10 ++-- src/OpenFOAM/db/Time/TimeIO.C | 6 +-- src/OpenFOAM/db/Time/TimePaths.H | 6 +-- src/OpenFOAM/db/Time/TimePathsI.H | 12 ++--- .../functionEntries/codeStream/codeStream.C | 14 +++--- .../db/dynamicLibrary/codedBase/codedBase.C | 14 +++--- .../db/objectRegistry/objectRegistry.C | 4 +- src/OpenFOAM/db/regIOobject/regIOobject.C | 28 +---------- src/OpenFOAM/db/regIOobject/regIOobject.H | 6 +-- src/OpenFOAM/db/regIOobject/regIOobjectRead.C | 8 ++-- .../db/regIOobject/regIOobjectWrite.C | 4 +- .../GeometricField/GeometricField.C | 8 ++-- src/OpenFOAM/global/argList/argList.C | 30 +++++------- .../collatedFileOperation.C | 29 ++++-------- .../fileOperation/fileOperation.C | 19 ++++---- .../masterUncollatedFileOperation.C | 24 ++++------ .../uncollatedFileOperation.C | 10 ++-- src/OpenFOAM/meshes/polyMesh/polyMesh.C | 12 ++--- src/OpenFOAM/meshes/polyMesh/polyMeshIO.C | 18 +++---- .../combustionModel/combustionModel.C | 10 ++-- src/conversion/ccm/reader/ccmReaderMesh.C | 2 +- src/conversion/common/reader/meshReader.C | 2 +- src/conversion/common/tables/cellTable.C | 4 +- .../dynamicMotionSolverListFvMesh.C | 6 +-- .../dynamicMultiMotionSolverFvMesh.C | 4 +- .../simplifiedDynamicFvMeshTemplates.C | 6 +-- .../fvMeshSubsetProxyTemplates.C | 8 ++-- src/dynamicMesh/fvMeshTools/fvMeshTools.C | 14 +++--- .../codedPoints0/codedPoints0MotionSolver.C | 4 +- .../points0/points0MotionSolver.C | 4 +- .../motionSolvers/motionSolver/motionSolver.C | 4 +- .../polyTopoChange/hexRef8/hexRef8.C | 4 +- .../polyTopoChange/hexRef8/hexRef8Data.C | 10 ++-- .../polyTopoChanger/polyTopoChanger.C | 4 +- src/faOptions/faOption/faOptions.C | 13 +++-- src/finiteArea/faMesh/faMesh.C | 4 +- .../cfdTools/compressible/createDpdt.H | 6 +-- .../cfdTools/general/MRF/IOMRFZoneList.C | 10 ++-- .../cfdTools/general/fvOptions/fvOptions.C | 13 +++-- .../porosityModel/IOporosityModelList.C | 5 +- src/finiteVolume/fvMesh/fvMeshGeometry.C | 4 +- .../columnFvMesh/columnFvMesh.C | 6 +-- .../nearWallFields/nearWallFieldsTemplates.C | 6 +-- .../stabilityBlendingFactor.C | 4 +- .../ensight/ensightOutputCloudTemplates.C | 4 +- .../blockMesh/PDRblockMesh/PDRblockCreate.C | 4 +- .../polyTopoChange/polyTopoChangeTemplates.C | 4 +- src/meshTools/sets/topoSets/topoSet.C | 14 ++---- .../variablesSet/variablesSetTemplates.C | 2 +- .../trackingInverseDistance/voxelMeshSearch.C | 6 +-- .../MovingPhaseModel/MovingPhaseModel.C | 3 +- .../phaseSystem/phaseSystem.C | 4 +- .../MeshedSurfaceIOAllocator.C | 6 +-- src/surfMesh/surfMesh/surfMeshIO.C | 6 +-- .../TDACChemistryModel/TDACChemistryModel.C | 6 +-- .../radiativeIntensityRay.C | 4 +- .../radiationModel/radiationModel.C | 6 +-- .../linearValveFvMesh/linearValveFvMesh.C | 4 +- .../mixerFvMesh/mixerFvMesh.C | 4 +- src/waveModels/waveModel/waveModel.C | 4 +- 85 files changed, 370 insertions(+), 364 deletions(-) diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H index 80d92971a25..b1f35b15ff7 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H @@ -47,7 +47,7 @@ } else if (rhoType == "field") { - rhoIO.readOpt() = IOobject::MUST_READ; + rhoIO.readOpt(IOobject::MUST_READ); rhoPtr.reset ( @@ -102,7 +102,7 @@ } else if (EType == "field") { - EHeader.readOpt() = IOobject::MUST_READ; + EHeader.readOpt(IOobject::MUST_READ); EPtr.reset ( @@ -156,7 +156,7 @@ } else if (nuType == "field") { - nuIO.readOpt() = IOobject::MUST_READ; + nuIO.readOpt(IOobject::MUST_READ); nuPtr.reset ( new volScalarField diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H index 8d9ccda5e4d..98711e36c43 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H @@ -81,7 +81,7 @@ if (thermalStress) } else if (CType == "field") { - CIO.readOpt() = IOobject::MUST_READ; + CIO.readOpt(IOobject::MUST_READ); CPtr.reset ( @@ -136,7 +136,7 @@ if (thermalStress) } else if (kType == "field") { - rhoKIO.readOpt() = IOobject::MUST_READ; + rhoKIO.readOpt(IOobject::MUST_READ); rhoKPtr.reset ( @@ -191,7 +191,7 @@ if (thermalStress) } else if (alphaType == "field") { - alphaIO.readOpt() = IOobject::MUST_READ; + alphaIO.readOpt(IOobject::MUST_READ); alphaPtr.reset ( diff --git a/applications/test/IOField/Test-IOField.C b/applications/test/IOField/Test-IOField.C index 943e8314a89..97a4774b61a 100644 --- a/applications/test/IOField/Test-IOField.C +++ b/applications/test/IOField/Test-IOField.C @@ -89,7 +89,7 @@ void writeAndRead const IOobject& io, const label sz, const word& writeType, - const IOobject::readOption readOpt, + const IOobject::readOption rOpt, const word& readType ) { @@ -112,7 +112,7 @@ void writeAndRead // Read IOobject readIO(io); - readIO.readOpt() = readOpt; + readIO.readOpt(rOpt); Pout<< "Reading:" << fileHandler().filePath(readIO.objectPath()) << endl; doRead<Type>(readIO, sz); @@ -134,7 +134,7 @@ void readIfPresent // Read Pout<< "Reading:" << fileHandler().filePath(io.objectPath()) << endl; - io.readOpt() = IOobject::READ_IF_PRESENT; + io.readOpt(IOobject::READ_IF_PRESENT); doRead<Type>(io, sz); } diff --git a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C index 09ed0da884e..c7625cd4141 100644 --- a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C +++ b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2018 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1025,54 +1025,54 @@ int main(int argc, char *argv[]) forAll(scalarFlds, i) { scalarFlds[i].rename(scalarNames[i]); - scalarFlds[i].writeOpt() = IOobject::AUTO_WRITE; + scalarFlds[i].writeOpt(IOobject::AUTO_WRITE); } forAll(vectorFlds, i) { vectorFlds[i].rename(vectorNames[i]); - vectorFlds[i].writeOpt() = IOobject::AUTO_WRITE; + vectorFlds[i].writeOpt(IOobject::AUTO_WRITE); } forAll(sphTensorFlds, i) { sphTensorFlds[i].rename(sphTensorNames[i]); - sphTensorFlds[i].writeOpt() = IOobject::AUTO_WRITE; + sphTensorFlds[i].writeOpt(IOobject::AUTO_WRITE); } forAll(symmTensorFlds, i) { symmTensorFlds[i].rename(symmTensorNames[i]); - symmTensorFlds[i].writeOpt() = IOobject::AUTO_WRITE; + symmTensorFlds[i].writeOpt(IOobject::AUTO_WRITE); } forAll(tensorFlds, i) { tensorFlds[i].rename(tensorNames[i]); - tensorFlds[i].writeOpt() = IOobject::AUTO_WRITE; + tensorFlds[i].writeOpt(IOobject::AUTO_WRITE); } // Surface ones. forAll(surfScalarFlds, i) { surfScalarFlds[i].rename(surfScalarNames[i]); - surfScalarFlds[i].writeOpt() = IOobject::AUTO_WRITE; + surfScalarFlds[i].writeOpt(IOobject::AUTO_WRITE); } forAll(surfVectorFlds, i) { surfVectorFlds[i].rename(surfVectorNames[i]); - surfVectorFlds[i].writeOpt() = IOobject::AUTO_WRITE; + surfVectorFlds[i].writeOpt(IOobject::AUTO_WRITE); } forAll(surfSphericalTensorFlds, i) { surfSphericalTensorFlds[i].rename(surfSphTensorNames[i]); - surfSphericalTensorFlds[i].writeOpt() = IOobject::AUTO_WRITE; + surfSphericalTensorFlds[i].writeOpt(IOobject::AUTO_WRITE); } forAll(surfSymmTensorFlds, i) { surfSymmTensorFlds[i].rename(surfSymmTensorNames[i]); - surfSymmTensorFlds[i].writeOpt() = IOobject::AUTO_WRITE; + surfSymmTensorFlds[i].writeOpt(IOobject::AUTO_WRITE); } forAll(surfTensorNames, i) { surfTensorFlds[i].rename(surfTensorNames[i]); - surfTensorFlds[i].writeOpt() = IOobject::AUTO_WRITE; + surfTensorFlds[i].writeOpt(IOobject::AUTO_WRITE); } subsetter.subMesh().write(); diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index 352fdbac33f..d8a17b7e910 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -1106,12 +1106,12 @@ int main(int argc, char *argv[]) { Info<< "Not writing inconsistent processor cell decomposition" << " map " << cellProcAddressing.filePath() << endl; - cellProcAddressing.writeOpt() = IOobject::NO_WRITE; + cellProcAddressing.writeOpt(IOobject::NO_WRITE); } } else { - cellProcAddressing.writeOpt() = IOobject::NO_WRITE; + cellProcAddressing.writeOpt(IOobject::NO_WRITE); } if (faceProcAddressing.headerOk()) @@ -1147,12 +1147,12 @@ int main(int argc, char *argv[]) { Info<< "Not writing inconsistent processor face decomposition" << " map " << faceProcAddressing.filePath() << endl; - faceProcAddressing.writeOpt() = IOobject::NO_WRITE; + faceProcAddressing.writeOpt(IOobject::NO_WRITE); } } else { - faceProcAddressing.writeOpt() = IOobject::NO_WRITE; + faceProcAddressing.writeOpt(IOobject::NO_WRITE); } if (pointProcAddressing.headerOk()) @@ -1173,12 +1173,12 @@ int main(int argc, char *argv[]) { Info<< "Not writing inconsistent processor point decomposition" << " map " << pointProcAddressing.filePath() << endl; - pointProcAddressing.writeOpt() = IOobject::NO_WRITE; + pointProcAddressing.writeOpt(IOobject::NO_WRITE); } } else { - pointProcAddressing.writeOpt() = IOobject::NO_WRITE; + pointProcAddressing.writeOpt(IOobject::NO_WRITE); } if (boundaryProcAddressing.headerOk()) @@ -1196,12 +1196,12 @@ int main(int argc, char *argv[]) { Info<< "Not writing inconsistent processor patch decomposition" << " map " << boundaryProcAddressing.filePath() << endl; - boundaryProcAddressing.writeOpt() = IOobject::NO_WRITE; + boundaryProcAddressing.writeOpt(IOobject::NO_WRITE); } } else { - boundaryProcAddressing.writeOpt() = IOobject::NO_WRITE; + boundaryProcAddressing.writeOpt(IOobject::NO_WRITE); } diff --git a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C index 8e69c3fcb84..d192600447d 100644 --- a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C +++ b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -134,7 +135,7 @@ int main(int argc, char *argv[]) zn = pointLabels; - mesh.pointZones().writeOpt() = IOobject::AUTO_WRITE; + mesh.pointZones().writeOpt(IOobject::AUTO_WRITE); mesh.pointZones().instance() = mesh.facesInstance(); } @@ -261,7 +262,7 @@ int main(int argc, char *argv[]) flipMap.shrink() ); - mesh.faceZones().writeOpt() = IOobject::AUTO_WRITE; + mesh.faceZones().writeOpt(IOobject::AUTO_WRITE); mesh.faceZones().instance() = mesh.facesInstance(); } @@ -297,7 +298,7 @@ int main(int argc, char *argv[]) zn = cellLabels; - mesh.cellZones().writeOpt() = IOobject::AUTO_WRITE; + mesh.cellZones().writeOpt(IOobject::AUTO_WRITE); mesh.cellZones().instance() = mesh.facesInstance(); } } diff --git a/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C b/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C index 1aaae4e7971..6f132837bb6 100644 --- a/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C +++ b/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation - Copyright (C) 2016 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -67,7 +67,7 @@ void interpolateFields { tmp<GeoField> scFld = scMesh.interpolate(flds[i]); GeoField* scFldPtr = scFld.ptr(); - scFldPtr->writeOpt() = IOobject::AUTO_WRITE; + scFldPtr->writeOpt(IOobject::AUTO_WRITE); scFldPtr->store(); } } diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index aa84e3c65a8..194b29809fe 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -192,7 +192,7 @@ void subsetVolFields // Store on subMesh GeoField* subFld = tSubFld.ptr(); subFld->rename(fld.name()); - subFld->writeOpt() = IOobject::AUTO_WRITE; + subFld->writeOpt(IOobject::AUTO_WRITE); subFld->store(); } } @@ -246,7 +246,7 @@ void subsetSurfaceFields // Store on subMesh GeoField* subFld = tSubFld.ptr(); subFld->rename(fld.name()); - subFld->writeOpt() = IOobject::AUTO_WRITE; + subFld->writeOpt(IOobject::AUTO_WRITE); subFld->store(); } } @@ -1886,7 +1886,7 @@ int main(int argc, char *argv[]) << zoneI << ' ' << cellZones[zoneI].name() << endl; } } - mesh.cellZones().writeOpt() = IOobject::AUTO_WRITE; + mesh.cellZones().writeOpt(IOobject::AUTO_WRITE); if (!overwrite) { diff --git a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C index e3cd0db6714..f21eac25a24 100644 --- a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C +++ b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -294,7 +294,7 @@ int main(int argc, char *argv[]) // Make sure we do not use the master-only reading since we read // fields (different per processor) as dictionaries. - regIOobject::fileModificationChecking = regIOobject::timeStamp; + IOobject::fileModificationChecking = IOobject::timeStamp; fileName meshDir = polyMesh::meshSubDir; diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index 49d12e091b0..40efd741514 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -570,7 +570,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) if (pz.size()) { // Force writing on all processors - procMesh.pointZones().writeOpt() = IOobject::AUTO_WRITE; + procMesh.pointZones().writeOpt(IOobject::AUTO_WRITE); } } @@ -664,7 +664,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) if (fz.size()) { // Force writing on all processors - procMesh.faceZones().writeOpt() = IOobject::AUTO_WRITE; + procMesh.faceZones().writeOpt(IOobject::AUTO_WRITE); } } @@ -728,7 +728,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) if (cz.size()) { // Force writing on all processors - procMesh.cellZones().writeOpt() = IOobject::AUTO_WRITE; + procMesh.cellZones().writeOpt(IOobject::AUTO_WRITE); } } diff --git a/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C b/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C index 5983fc8538c..85131c9169a 100644 --- a/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C +++ b/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2017 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -163,8 +163,8 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh // Create dummy mesh. Only used on procs that don't have mesh. IOobject noReadIO(io); - noReadIO.readOpt() = IOobject::NO_READ; - noReadIO.writeOpt() = IOobject::AUTO_WRITE; + noReadIO.readOpt(IOobject::NO_READ); + noReadIO.writeOpt(IOobject::AUTO_WRITE); fvMesh dummyMesh(noReadIO, Zero, false); // Add patches diff --git a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C index 7e0900da8cf..a6756003a4a 100644 --- a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C +++ b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C @@ -648,7 +648,7 @@ void readFields { const word& name = masterNames[i]; IOobject& io = *objects[name]; - io.writeOpt() = IOobject::AUTO_WRITE; + io.writeOpt(IOobject::AUTO_WRITE); // Load field (but not oldTime) readField(io, mesh, i, fields); @@ -714,7 +714,7 @@ void readFields { const word& name = masterNames[i]; IOobject& io = *objects[name]; - io.writeOpt() = IOobject::AUTO_WRITE; + io.writeOpt(IOobject::AUTO_WRITE); // Load field (but not oldtime) readField(io, mesh, i, fields); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/getTimeIndex.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/getTimeIndex.H index aeb83110064..0d8487fcaca 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/getTimeIndex.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/getTimeIndex.H @@ -26,7 +26,7 @@ label timeIndex = 0; if (io.typeHeaderOk<IOdictionary>(true, false)) { - io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; + io.readOpt(IOobject::MUST_READ_IF_MODIFIED); IOdictionary timeObject(io); timeObject.readEntry("index", timeIndex); diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/moveMesh.H b/applications/utilities/postProcessing/dataConversion/foamToGMV/moveMesh.H index 50db68176ce..11f692b6847 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/moveMesh.H +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/moveMesh.H @@ -14,7 +14,7 @@ { Info<< "new points available" << endl; // Read new points - io.readOpt() = IOobject::MUST_READ; + io.readOpt(IOobject::MUST_READ); mesh.movePoints(pointIOField(io)); } } diff --git a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C index 7feceb54ded..8951d73ba76 100644 --- a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C +++ b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -507,7 +507,7 @@ int main(int argc, char *argv[]) // Make sure we do not use the master-only reading since we read // fields (different per processor) as dictionaries. - regIOobject::fileModificationChecking = regIOobject::timeStamp; + IOobject::fileModificationChecking = IOobject::timeStamp; // Get the replacement rules from a dictionary diff --git a/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C b/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C index 5b508cc37b0..e04f6d7deb5 100644 --- a/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C +++ b/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -422,7 +422,7 @@ int main(int argc, char *argv[]) // Make sure we do not use the master-only reading since we read // fields (different per processor) as dictionaries. - regIOobject::fileModificationChecking = regIOobject::timeStamp; + IOobject::fileModificationChecking = IOobject::timeStamp; instantList timeDirs = timeSelector::select0(runTime, args); diff --git a/applications/utilities/preProcessing/mapFields/MapConsistentVolFields.H b/applications/utilities/preProcessing/mapFields/MapConsistentVolFields.H index 6d45818442a..4b55d582ed0 100644 --- a/applications/utilities/preProcessing/mapFields/MapConsistentVolFields.H +++ b/applications/utilities/preProcessing/mapFields/MapConsistentVolFields.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -90,7 +90,7 @@ void MapConsistentVolFields } else { - fieldTargetIOobject.readOpt() = IOobject::NO_READ; + fieldTargetIOobject.readOpt(IOobject::NO_READ); // Interpolate field fieldType fieldTarget diff --git a/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H b/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H index abd4a036bc7..6a3c1ffcc39 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H +++ b/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -172,7 +172,7 @@ void MapVolFields Info<< " creating new field " << fieldName << endl; - targetIO.readOpt() = IOobject::NO_READ; + targetIO.readOpt(IOobject::NO_READ); tmp<fieldType> tfieldTarget ( diff --git a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C index 9ef2bbdb9fd..b50d924bd18 100644 --- a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C +++ b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -261,7 +261,7 @@ int main(int argc, char *argv[]) // Construct distributedTrisurfaceMesh from components IOobject notReadIO(io); - notReadIO.readOpt() = IOobject::NO_READ; + notReadIO.readOpt(IOobject::NO_READ); surfMeshPtr.reset(new distributedTriSurfaceMesh(notReadIO, s, dict)); } diff --git a/src/OSspecific/MSwindows/fileMonitor/fileMonitor.C b/src/OSspecific/MSwindows/fileMonitor/fileMonitor.C index 284673bf7d5..db66c0c443c 100644 --- a/src/OSspecific/MSwindows/fileMonitor/fileMonitor.C +++ b/src/OSspecific/MSwindows/fileMonitor/fileMonitor.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,7 +32,7 @@ License #include "PackedList.H" #include "PstreamReduceOps.H" #include "OSspecific.H" -#include "regIOobject.H" // for fileModificationSkew symbol +#include "IOobject.H" // for fileModificationSkew symbol #ifdef _WIN32 #undef FOAM_USE_INOTIFY @@ -410,7 +410,7 @@ void Foam::fileMonitor::checkFiles() const } else { - if (newTime > (oldTime + regIOobject::fileModificationSkew)) + if (newTime > (oldTime + IOobject::fileModificationSkew)) { localState_[watchFd] = MODIFIED; } diff --git a/src/OSspecific/POSIX/fileMonitor/fileMonitor.C b/src/OSspecific/POSIX/fileMonitor/fileMonitor.C index cf1aa6124a7..19af5b42439 100644 --- a/src/OSspecific/POSIX/fileMonitor/fileMonitor.C +++ b/src/OSspecific/POSIX/fileMonitor/fileMonitor.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,7 +32,7 @@ License #include "PackedList.H" #include "PstreamReduceOps.H" #include "OSspecific.H" -#include "regIOobject.H" // for fileModificationSkew symbol +#include "IOobject.H" // for fileModificationSkew symbol #ifdef FOAM_USE_INOTIFY #include <unistd.h> @@ -406,7 +406,7 @@ void Foam::fileMonitor::checkFiles() const } else { - if (newTime > (oldTime + regIOobject::fileModificationSkew)) + if (newTime > (oldTime + IOobject::fileModificationSkew)) { localState_[watchFd] = MODIFIED; } diff --git a/src/OpenFOAM/db/IOobject/IOobject.C b/src/OpenFOAM/db/IOobject/IOobject.C index 5419a5abd6a..66f39bded28 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.C +++ b/src/OpenFOAM/db/IOobject/IOobject.C @@ -29,6 +29,7 @@ License #include "IOobject.H" #include "Time.H" #include "Istream.H" +#include "registerSwitch.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -72,6 +73,29 @@ Foam::IOobject::fileCheckTypes Foam::IOobject::fileModificationChecking ); +float Foam::IOobject::fileModificationSkew +( + Foam::debug::floatOptimisationSwitch("fileModificationSkew", 30) +); +registerOptSwitch +( + "fileModificationSkew", + float, + Foam::IOobject::fileModificationSkew +); + +int Foam::IOobject::maxFileModificationPolls +( + Foam::debug::optimisationSwitch("maxFileModificationPolls", 1) +); +registerOptSwitch +( + "maxFileModificationPolls", + int, + Foam::IOobject::maxFileModificationPolls +); + + //! \cond file-scope namespace Foam { diff --git a/src/OpenFOAM/db/IOobject/IOobject.H b/src/OpenFOAM/db/IOobject/IOobject.H index 5877b1a2a21..41096629a08 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.H +++ b/src/OpenFOAM/db/IOobject/IOobject.H @@ -229,7 +229,7 @@ protected: //- with optional meta information. static void writeHeaderContent ( - dictionary& os, + dictionary& dict, const IOobject& io, const word& objectType, IOstreamOption streamOpt, @@ -246,7 +246,7 @@ public: TypeName("IOobject"); - // Static Data Members + // Static Data //- Character for scoping object names (':' or '_') // Change with caution. @@ -255,6 +255,12 @@ public: //- Type of file modification checking static fileCheckTypes fileModificationChecking; + //- Time skew (seconds) for file modification checks + static float fileModificationSkew; + + //- Max number of times to poll for file modification changes + static int maxFileModificationPolls; + // Static Functions @@ -382,7 +388,7 @@ public: const objectRegistry& registry, readOption r=NO_READ, writeOption w=NO_WRITE, - bool registerObject=true, + bool registerObject = true, bool globalObject = false ); @@ -455,14 +461,14 @@ public: //- Should object created with this IOobject be registered? inline bool registerObject() const noexcept; - //- Should object created with this IOobject be registered? - inline bool& registerObject() noexcept; + //- Change registration preference, return previous value + inline bool registerObject(bool on) noexcept; //- Is object same for all processors? inline bool globalObject() const noexcept; - //- Is object same for all processors? - inline bool& globalObject() noexcept; + //- Change global-object status, return previous value + inline bool globalObject(bool on) noexcept; //- The sizeof (label) in bytes, possibly read from the header inline unsigned labelByteSize() const noexcept; @@ -492,14 +498,14 @@ public: //- The read option inline readOption readOpt() const noexcept; - //- Non-constant access to the read option - inline readOption& readOpt() noexcept; + //- Change the read option, return previous value + inline readOption readOpt(readOption opt) noexcept; //- The write option inline writeOption writeOpt() const noexcept; - //- Non-constant access to the write option - inline writeOption& writeOpt() noexcept; + //- Change the write option, return previous value + inline writeOption writeOpt(writeOption opt) noexcept; // Path components @@ -636,6 +642,25 @@ public: // Member Operators void operator=(const IOobject& io); + + + // Housekeeping + + //- Access to the read option + // \deprecated(2021-03) - use readOpt(readOption) + readOption& readOpt() noexcept { return rOpt_; } + + //- Access to the write option + // \deprecated(2021-03) - use writeOpt(writeOption) + writeOption& writeOpt() noexcept { return wOpt_; } + + //- Access to the register object option + // \deprecated(2021-03) - use registerObject(bool) + bool& registerObject() noexcept { return registerObject_; } + + //- Access to the global object option + // \deprecated(2021-03) - use globalObject(bool) + bool& globalObject() noexcept { return globalObject_; } }; diff --git a/src/OpenFOAM/db/IOobject/IOobjectI.H b/src/OpenFOAM/db/IOobject/IOobjectI.H index 2bbb65836b4..c7ee333ea68 100644 --- a/src/OpenFOAM/db/IOobject/IOobjectI.H +++ b/src/OpenFOAM/db/IOobject/IOobjectI.H @@ -115,9 +115,11 @@ inline bool Foam::IOobject::registerObject() const noexcept } -inline bool& Foam::IOobject::registerObject() noexcept +inline bool Foam::IOobject::registerObject(bool on) noexcept { - return registerObject_; + bool old(registerObject_); + registerObject_ = on; + return old; } @@ -127,9 +129,11 @@ inline bool Foam::IOobject::globalObject() const noexcept } -inline bool& Foam::IOobject::globalObject() noexcept +inline bool Foam::IOobject::globalObject(bool on) noexcept { - return globalObject_; + bool old(globalObject_); + globalObject_ = on; + return old; } @@ -168,9 +172,12 @@ inline Foam::IOobject::readOption Foam::IOobject::readOpt() const noexcept } -inline Foam::IOobject::readOption& Foam::IOobject::readOpt() noexcept +inline Foam::IOobject::readOption +Foam::IOobject::readOpt(readOption opt) noexcept { - return rOpt_; + readOption old(rOpt_); + rOpt_ = opt; + return old; } @@ -180,9 +187,12 @@ inline Foam::IOobject::writeOption Foam::IOobject::writeOpt() const noexcept } -inline Foam::IOobject::writeOption& Foam::IOobject::writeOpt() noexcept +inline Foam::IOobject::writeOption +Foam::IOobject::writeOpt(writeOption opt) noexcept { - return wOpt_; + writeOption old(wOpt_); + wOpt_ = opt; + return old; } diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.C b/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.C index b9f2d6c2e1e..66fa0940bca 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.C +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.C @@ -131,8 +131,8 @@ void Foam::unwatchedIOdictionary::addWatch() bool masterOnly = global() && ( - regIOobject::fileModificationChecking == timeStampMaster - || regIOobject::fileModificationChecking == inotifyMaster + IOobject::fileModificationChecking == IOobject::timeStampMaster + || IOobject::fileModificationChecking == IOobject::inotifyMaster ); if (masterOnly && Pstream::parRun()) diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 3b05a0af1d4..80a1902f362 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -476,7 +476,7 @@ Foam::Time::Time // Explicitly set read flags on objectRegistry so anything constructed // from it reads as well (e.g. fvSolution). - readOpt() = IOobject::MUST_READ_IF_MODIFIED; + readOpt(IOobject::MUST_READ_IF_MODIFIED); setControls(); setMonitoring(); @@ -560,7 +560,7 @@ Foam::Time::Time // Explicitly set read flags on objectRegistry so anything constructed // from it reads as well (e.g. fvSolution). - readOpt() = IOobject::MUST_READ_IF_MODIFIED; + readOpt(IOobject::MUST_READ_IF_MODIFIED); setControls(); @@ -637,10 +637,10 @@ Foam::Time::Time // Explicitly set read flags on objectRegistry so anything constructed // from it reads as well (e.g. fvSolution). - readOpt() = IOobject::MUST_READ_IF_MODIFIED; + readOpt(IOobject::MUST_READ_IF_MODIFIED); // Since could not construct regIOobject with setting: - controlDict_.readOpt() = IOobject::MUST_READ_IF_MODIFIED; + controlDict_.readOpt(IOobject::MUST_READ_IF_MODIFIED); setControls(); setMonitoring(); diff --git a/src/OpenFOAM/db/Time/TimeIO.C b/src/OpenFOAM/db/Time/TimeIO.C index dfe975357db..cc95ef4bf19 100644 --- a/src/OpenFOAM/db/Time/TimeIO.C +++ b/src/OpenFOAM/db/Time/TimeIO.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -478,8 +478,8 @@ void Foam::Time::readModifiedObjects() fileHandler().updateStates ( ( - regIOobject::fileModificationChecking == inotifyMaster - || regIOobject::fileModificationChecking == timeStampMaster + IOobject::fileModificationChecking == IOobject::inotifyMaster + || IOobject::fileModificationChecking == IOobject::timeStampMaster ), Pstream::parRun() ); diff --git a/src/OpenFOAM/db/Time/TimePaths.H b/src/OpenFOAM/db/Time/TimePaths.H index 0293cbc37b6..58dc264403b 100644 --- a/src/OpenFOAM/db/Time/TimePaths.H +++ b/src/OpenFOAM/db/Time/TimePaths.H @@ -113,13 +113,13 @@ public: //- True if case running with parallel distributed directories //- (ie. not NFS mounted) - inline bool distributed() const; + inline bool distributed() const noexcept; //- Return true if this is a processor case - inline bool processorCase() const; + inline bool processorCase() const noexcept; //- Set processor case status. Return old one - inline bool processorCase(const bool isProcessorCase); + inline bool processorCase(const bool isProcessorCase) noexcept; //- Return root path inline const fileName& rootPath() const; diff --git a/src/OpenFOAM/db/Time/TimePathsI.H b/src/OpenFOAM/db/Time/TimePathsI.H index d7e7a2dea0d..62d7fbc7a1e 100644 --- a/src/OpenFOAM/db/Time/TimePathsI.H +++ b/src/OpenFOAM/db/Time/TimePathsI.H @@ -27,23 +27,23 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline bool Foam::TimePaths::distributed() const +inline bool Foam::TimePaths::distributed() const noexcept { return distributed_; } -inline bool Foam::TimePaths::processorCase() const +inline bool Foam::TimePaths::processorCase() const noexcept { return processorCase_; } -inline bool Foam::TimePaths::processorCase(const bool newProcCase) +inline bool Foam::TimePaths::processorCase(bool isProcessorCase) noexcept { - const bool oldProcCase = processorCase_; - processorCase_ = newProcCase; - return oldProcCase; + bool old(processorCase_); + processorCase_ = isProcessorCase; + return old; } diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C index 0d877cb5f60..97eeb427679 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -161,7 +161,7 @@ Foam::functionEntries::codeStream::getFunction { const bool create = Pstream::master() - || (regIOobject::fileModificationSkew <= 0); // not NFS + || (IOobject::fileModificationSkew <= 0); // not NFS if (create) { @@ -205,7 +205,7 @@ Foam::functionEntries::codeStream::getFunction if ( !doingMasterOnlyReading(topDict) - && regIOobject::fileModificationSkew > 0 + && IOobject::fileModificationSkew > 0 ) { //- Since the library has only been compiled on the master the @@ -220,8 +220,8 @@ Foam::functionEntries::codeStream::getFunction for ( label iter = 0; - iter < regIOobject::maxFileModificationPolls; - iter++ + iter < IOobject::maxFileModificationPolls; + ++iter ) { DebugPout @@ -257,10 +257,10 @@ Foam::functionEntries::codeStream::getFunction << " not of same size (" << mySize << ") as master (" << masterSize << "). Waiting for " - << regIOobject::fileModificationSkew + << IOobject::fileModificationSkew << " seconds." << endl; - Foam::sleep(regIOobject::fileModificationSkew); + Foam::sleep(IOobject::fileModificationSkew); // Recheck local size mySize = Foam::fileSize(libPath); diff --git a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C index 0f6cc586d93..7d9fbbc7212 100644 --- a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C +++ b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -175,7 +175,7 @@ void Foam::codedBase::createLibrary { bool create = Pstream::master() - || (regIOobject::fileModificationSkew <= 0); // not NFS + || (IOobject::fileModificationSkew <= 0); // not NFS if (create) { @@ -206,7 +206,7 @@ void Foam::codedBase::createLibrary // all processes must wait for compile to finish - if (regIOobject::fileModificationSkew > 0) + if (IOobject::fileModificationSkew > 0) { //- Since the library has only been compiled on the master the // other nodes need to pick this library up through NFS @@ -222,8 +222,8 @@ void Foam::codedBase::createLibrary for ( label iter = 0; - iter < regIOobject::maxFileModificationPolls; - iter++ + iter < IOobject::maxFileModificationPolls; + ++iter ) { DebugPout @@ -259,10 +259,10 @@ void Foam::codedBase::createLibrary << " not of same size (" << mySize << ") as master (" << masterSize << "). Waiting for " - << regIOobject::fileModificationSkew + << IOobject::fileModificationSkew << " seconds." << endl; - Foam::sleep(regIOobject::fileModificationSkew); + Foam::sleep(IOobject::fileModificationSkew); // Recheck local size mySize = Foam::fileSize(libPath); diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.C b/src/OpenFOAM/db/objectRegistry/objectRegistry.C index 9621daf6aaf..1ada4259502 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -134,7 +134,7 @@ Foam::objectRegistry::objectRegistry(const IOobject& io, const label nObjects) dbDir_(parent_.dbDir()/local()/name()), event_(1) { - writeOpt() = IOobject::AUTO_WRITE; + writeOpt(IOobject::AUTO_WRITE); } diff --git a/src/OpenFOAM/db/regIOobject/regIOobject.C b/src/OpenFOAM/db/regIOobject/regIOobject.C index 94e77b8cc7c..dcb7ed0cdc9 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobject.C +++ b/src/OpenFOAM/db/regIOobject/regIOobject.C @@ -31,7 +31,6 @@ License #include "polyMesh.H" #include "dictionary.H" #include "fileOperation.H" -#include "registerSwitch.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -40,29 +39,6 @@ namespace Foam defineTypeNameAndDebug(regIOobject, 0); } -float Foam::regIOobject::fileModificationSkew -( - Foam::debug::floatOptimisationSwitch("fileModificationSkew", 30) -); -registerOptSwitch -( - "fileModificationSkew", - float, - Foam::regIOobject::fileModificationSkew -); - -int Foam::regIOobject::maxFileModificationPolls -( - Foam::debug::optimisationSwitch("maxFileModificationPolls", 1) -); -registerOptSwitch -( - "maxFileModificationPolls", - int, - Foam::regIOobject::maxFileModificationPolls -); - - bool Foam::regIOobject::masterOnlyReading = false; @@ -319,8 +295,8 @@ void Foam::regIOobject::addWatch() bool masterOnly = global() && ( - regIOobject::fileModificationChecking == timeStampMaster - || regIOobject::fileModificationChecking == inotifyMaster + IOobject::fileModificationChecking == IOobject::timeStampMaster + || IOobject::fileModificationChecking == IOobject::inotifyMaster ); if (masterOnly && Pstream::parRun()) diff --git a/src/OpenFOAM/db/regIOobject/regIOobject.H b/src/OpenFOAM/db/regIOobject/regIOobject.H index 8c1a7c52073..8ace12cc3be 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobject.H +++ b/src/OpenFOAM/db/regIOobject/regIOobject.H @@ -131,15 +131,11 @@ public: friend class fileOperations::uncollatedFileOperation; - // Static data + // Static Data //- Runtime type information TypeName("regIOobject"); - static float fileModificationSkew; - - static int maxFileModificationPolls; - // Constructors diff --git a/src/OpenFOAM/db/regIOobject/regIOobjectRead.C b/src/OpenFOAM/db/regIOobject/regIOobjectRead.C index f987de06340..46d6760191e 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobjectRead.C +++ b/src/OpenFOAM/db/regIOobject/regIOobjectRead.C @@ -45,8 +45,8 @@ bool Foam::regIOobject::readHeaderOk bool masterOnly = global() && ( - regIOobject::fileModificationChecking == timeStampMaster - || regIOobject::fileModificationChecking == inotifyMaster + IOobject::fileModificationChecking == IOobject::timeStampMaster + || IOobject::fileModificationChecking == IOobject::inotifyMaster ); @@ -227,8 +227,8 @@ bool Foam::regIOobject::read() bool masterOnly = global() && ( - regIOobject::fileModificationChecking == timeStampMaster - || regIOobject::fileModificationChecking == inotifyMaster + IOobject::fileModificationChecking == IOobject::timeStampMaster + || IOobject::fileModificationChecking == IOobject::inotifyMaster ); // Note: IOstream::binary flag is for all the processor comms. (Only for diff --git a/src/OpenFOAM/db/regIOobject/regIOobjectWrite.C b/src/OpenFOAM/db/regIOobject/regIOobjectWrite.C index 867aff11cfc..2a53ec68538 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobjectWrite.C +++ b/src/OpenFOAM/db/regIOobject/regIOobjectWrite.C @@ -98,8 +98,8 @@ bool Foam::regIOobject::writeObject bool masterOnly = isGlobal && ( - regIOobject::fileModificationChecking == timeStampMaster - || regIOobject::fileModificationChecking == inotifyMaster + IOobject::fileModificationChecking == IOobject::timeStampMaster + || IOobject::fileModificationChecking == IOobject::inotifyMaster ); bool osGood = false; diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index 43c3f1536c2..4f45d6905a7 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -466,7 +466,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField ); } - this->writeOpt() = IOobject::NO_WRITE; + this->writeOpt(IOobject::NO_WRITE); } @@ -485,7 +485,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField DebugInFunction << "Constructing from tmp" << nl << this->info() << endl; - this->writeOpt() = IOobject::NO_WRITE; + this->writeOpt(IOobject::NO_WRITE); tgf.clear(); } @@ -827,7 +827,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::storeOldTime() const if (field0Ptr_->field0Ptr_) { - field0Ptr_->writeOpt() = this->writeOpt(); + field0Ptr_->writeOpt(this->writeOpt()); } } } diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index edb9fc92a96..b16bee5039b 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -33,7 +33,7 @@ License #include "IOobject.H" #include "JobInfo.H" #include "labelList.H" -#include "regIOobject.H" +#include "IOobject.H" #include "dynamicCode.H" #include "simpleObjectRegistry.H" #include "sigFpe.H" @@ -1540,41 +1540,35 @@ void Foam::argList::parse { Info<< "fileModificationChecking : " << "Monitoring run-time modified files using " - << regIOobject::fileCheckTypesNames + << IOobject::fileCheckTypesNames [ - regIOobject::fileModificationChecking + IOobject::fileModificationChecking ]; if ( - ( - regIOobject::fileModificationChecking - == regIOobject::timeStamp - ) - || ( - regIOobject::fileModificationChecking - == regIOobject::timeStampMaster - ) + IOobject::fileModificationChecking == IOobject::timeStamp + || IOobject::fileModificationChecking == IOobject::timeStampMaster ) { - if (regIOobject::maxFileModificationPolls == 1) + if (IOobject::maxFileModificationPolls == 1) { Info<< " (fileModificationSkew " - << regIOobject::fileModificationSkew + << IOobject::fileModificationSkew << ")"; } - else if (regIOobject::maxFileModificationPolls > 1) + else if (IOobject::maxFileModificationPolls > 1) { Info<< " (fileModificationSkew " - << regIOobject::fileModificationSkew + << IOobject::fileModificationSkew << ", maxFileModificationPolls " - << regIOobject::maxFileModificationPolls + << IOobject::maxFileModificationPolls << ")"; } else { FatalErrorInFunction << "Invalid setting for maxFileModificationPolls " - << regIOobject::maxFileModificationPolls + << IOobject::maxFileModificationPolls << exit(FatalError); } } diff --git a/src/OpenFOAM/global/fileOperations/collatedFileOperation/collatedFileOperation.C b/src/OpenFOAM/global/fileOperations/collatedFileOperation/collatedFileOperation.C index 2176b033c93..267a350eb8f 100644 --- a/src/OpenFOAM/global/fileOperations/collatedFileOperation/collatedFileOperation.C +++ b/src/OpenFOAM/global/fileOperations/collatedFileOperation/collatedFileOperation.C @@ -165,25 +165,16 @@ void Foam::fileOperations::collatedFileOperation::printBanner } } - if - ( - regIOobject::fileModificationChecking - == regIOobject::inotifyMaster - ) - { - WarningInFunction - << "Resetting fileModificationChecking to inotify" << endl; - } - - if - ( - regIOobject::fileModificationChecking - == regIOobject::timeStampMaster - ) - { - WarningInFunction - << "Resetting fileModificationChecking to timeStamp" << endl; - } + // if (IOobject::fileModificationChecking == IOobject::timeStampMaster) + // { + // WarningInFunction + // << "Resetting fileModificationChecking to timeStamp" << endl; + // } + // else if (IOobject::fileModificationChecking == IOobject::inotifyMaster) + // { + // WarningInFunction + // << "Resetting fileModificationChecking to inotify" << endl; + // } } diff --git a/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C b/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C index bb35e2243a0..700f1e4b897 100644 --- a/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C +++ b/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C @@ -251,8 +251,8 @@ Foam::fileMonitor& Foam::fileOperation::monitor() const ( new fileMonitor ( - regIOobject::fileModificationChecking == IOobject::inotify - || regIOobject::fileModificationChecking == IOobject::inotifyMaster + IOobject::fileModificationChecking == IOobject::inotify + || IOobject::fileModificationChecking == IOobject::inotifyMaster ) ); } @@ -379,15 +379,18 @@ Foam::fileOperation::lookupAndCacheProcessorsPath const bool readDirMasterOnly ( - regIOobject::fileModificationChecking == IOobject::timeStampMaster - || regIOobject::fileModificationChecking == IOobject::inotifyMaster + Pstream::parRun() && !distributed() + && + ( + IOobject::fileModificationChecking == IOobject::timeStampMaster + || IOobject::fileModificationChecking == IOobject::inotifyMaster + ) ); - // As byproduct of the above selection, we exclude masterUncollated - // from using read/send, but that doesn't matter since that is what - // its own internals for readDir() do anyhow. + // The above selection excludes masterUncollated, which uses inotify or + // timeStamp but provides its own internals for readDir() anyhow. - if (readDirMasterOnly && Pstream::parRun() && !distributed()) + if (readDirMasterOnly) { // Non-distributed. // Read on master only and send to subProcs diff --git a/src/OpenFOAM/global/fileOperations/masterUncollatedFileOperation/masterUncollatedFileOperation.C b/src/OpenFOAM/global/fileOperations/masterUncollatedFileOperation/masterUncollatedFileOperation.C index a31190a22ac..269a43c6f64 100644 --- a/src/OpenFOAM/global/fileOperations/masterUncollatedFileOperation/masterUncollatedFileOperation.C +++ b/src/OpenFOAM/global/fileOperations/masterUncollatedFileOperation/masterUncollatedFileOperation.C @@ -746,20 +746,16 @@ masterUncollatedFileOperation << endl; } - if (regIOobject::fileModificationChecking == regIOobject::timeStampMaster) + if (IOobject::fileModificationChecking == IOobject::timeStampMaster) { if (verbose) { WarningInFunction << "Resetting fileModificationChecking to timeStamp" << endl; } - regIOobject::fileModificationChecking = regIOobject::timeStamp; + IOobject::fileModificationChecking = IOobject::timeStamp; } - else if - ( - regIOobject::fileModificationChecking - == regIOobject::inotifyMaster - ) + else if (IOobject::fileModificationChecking == IOobject::inotifyMaster) { if (verbose) { @@ -767,7 +763,7 @@ masterUncollatedFileOperation << "Resetting fileModificationChecking to inotify" << endl; } - regIOobject::fileModificationChecking = regIOobject::inotify; + IOobject::fileModificationChecking = IOobject::inotify; } } @@ -792,20 +788,16 @@ masterUncollatedFileOperation << endl; } - if (regIOobject::fileModificationChecking == regIOobject::timeStampMaster) + if (IOobject::fileModificationChecking == IOobject::timeStampMaster) { if (verbose) { WarningInFunction << "Resetting fileModificationChecking to timeStamp" << endl; } - regIOobject::fileModificationChecking = regIOobject::timeStamp; + IOobject::fileModificationChecking = IOobject::timeStamp; } - else if - ( - regIOobject::fileModificationChecking - == regIOobject::inotifyMaster - ) + else if (IOobject::fileModificationChecking == IOobject::inotifyMaster) { if (verbose) { @@ -813,7 +805,7 @@ masterUncollatedFileOperation << "Resetting fileModificationChecking to inotify" << endl; } - regIOobject::fileModificationChecking = regIOobject::inotify; + IOobject::fileModificationChecking = IOobject::inotify; } } diff --git a/src/OpenFOAM/global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C b/src/OpenFOAM/global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C index a62583aaa12..b1369111f61 100644 --- a/src/OpenFOAM/global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C +++ b/src/OpenFOAM/global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C @@ -624,11 +624,11 @@ bool Foam::fileOperations::uncollatedFileOperation::read } // Set flag for e.g. codeStream - const bool oldGlobal = io.globalObject(); - io.globalObject() = masterOnly; + const bool oldGlobal = io.globalObject(masterOnly); + // If codeStream originates from dictionary which is // not IOdictionary we have a problem so use global - const bool oldFlag = regIOobject::masterOnlyReading; + const bool oldMasterOnly = regIOobject::masterOnlyReading; regIOobject::masterOnlyReading = masterOnly; // Read file @@ -636,8 +636,8 @@ bool Foam::fileOperations::uncollatedFileOperation::read io.close(); // Restore flags - io.globalObject() = oldGlobal; - regIOobject::masterOnlyReading = oldFlag; + io.globalObject(oldGlobal); + regIOobject::masterOnlyReading = oldMasterOnly; if (debug) { diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index 4d8dd6260c8..a2e7974aa58 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017, 2020 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1020,7 +1020,7 @@ void Foam::polyMesh::addZones pointZones_.set(pI, pz[pI]); } - pointZones_.writeOpt() = IOobject::AUTO_WRITE; + pointZones_.writeOpt(IOobject::AUTO_WRITE); } // Face zones @@ -1034,7 +1034,7 @@ void Foam::polyMesh::addZones faceZones_.set(fI, fz[fI]); } - faceZones_.writeOpt() = IOobject::AUTO_WRITE; + faceZones_.writeOpt(IOobject::AUTO_WRITE); } // Cell zones @@ -1048,7 +1048,7 @@ void Foam::polyMesh::addZones cellZones_.set(cI, cz[cI]); } - cellZones_.writeOpt() = IOobject::AUTO_WRITE; + cellZones_.writeOpt(IOobject::AUTO_WRITE); } } @@ -1216,13 +1216,13 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints } } - points_.writeOpt() = IOobject::AUTO_WRITE; + points_.writeOpt(IOobject::AUTO_WRITE); points_.instance() = time().timeName(); points_.eventNo() = getEvent(); if (tetBasePtIsPtr_) { - tetBasePtIsPtr_->writeOpt() = IOobject::AUTO_WRITE; + tetBasePtIsPtr_->writeOpt(IOobject::AUTO_WRITE); tetBasePtIsPtr_->instance() = time().timeName(); tetBasePtIsPtr_->eventNo() = getEvent(); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C b/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C index daa2d2fd5e6..f3942ebc858 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C @@ -40,33 +40,33 @@ void Foam::polyMesh::setInstance { DebugInFunction << "Resetting file instance to " << inst << endl; - points_.writeOpt() = wOpt; + points_.writeOpt(wOpt); points_.instance() = inst; - faces_.writeOpt() = wOpt; + faces_.writeOpt(wOpt); faces_.instance() = inst; - owner_.writeOpt() = wOpt; + owner_.writeOpt(wOpt); owner_.instance() = inst; - neighbour_.writeOpt() = wOpt; + neighbour_.writeOpt(wOpt); neighbour_.instance() = inst; - boundary_.writeOpt() = wOpt; + boundary_.writeOpt(wOpt); boundary_.instance() = inst; - pointZones_.writeOpt() = wOpt; + pointZones_.writeOpt(wOpt); pointZones_.instance() = inst; - faceZones_.writeOpt() = wOpt; + faceZones_.writeOpt(wOpt); faceZones_.instance() = inst; - cellZones_.writeOpt() = wOpt; + cellZones_.writeOpt(wOpt); cellZones_.instance() = inst; if (tetBasePtIsPtr_) { - tetBasePtIsPtr_->writeOpt() = wOpt; + tetBasePtIsPtr_->writeOpt(wOpt); tetBasePtIsPtr_->instance() = inst; } } diff --git a/src/combustionModels/combustionModel/combustionModel.C b/src/combustionModels/combustionModel/combustionModel.C index a250b04076a..c8f7bbf0bd3 100644 --- a/src/combustionModels/combustionModel/combustionModel.C +++ b/src/combustionModels/combustionModel/combustionModel.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -60,14 +60,14 @@ Foam::IOobject Foam::combustionModel::createIOobject if (io.typeHeaderOk<IOdictionary>(true)) { - io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; - return io; + io.readOpt(IOobject::MUST_READ_IF_MODIFIED); } else { - io.readOpt() = IOobject::NO_READ; - return io; + io.readOpt(IOobject::NO_READ); } + + return io; } diff --git a/src/conversion/ccm/reader/ccmReaderMesh.C b/src/conversion/ccm/reader/ccmReaderMesh.C index 7b8279afedb..49be959f2be 100644 --- a/src/conversion/ccm/reader/ccmReaderMesh.C +++ b/src/conversion/ccm/reader/ccmReaderMesh.C @@ -2558,7 +2558,7 @@ void Foam::ccm::reader::addFaceZones ++nZone; } - mesh.faceZones().writeOpt() = IOobject::AUTO_WRITE; + mesh.faceZones().writeOpt(IOobject::AUTO_WRITE); warnDuplicates("faceZones", mesh.faceZones().names()); } diff --git a/src/conversion/common/reader/meshReader.C b/src/conversion/common/reader/meshReader.C index 0c8e96e71f2..c85759da136 100644 --- a/src/conversion/common/reader/meshReader.C +++ b/src/conversion/common/reader/meshReader.C @@ -73,7 +73,7 @@ void Foam::meshReader::addFaceZones(polyMesh& mesh) const nZone++; } - mesh.faceZones().writeOpt() = IOobject::AUTO_WRITE; + mesh.faceZones().writeOpt(IOobject::AUTO_WRITE); warnDuplicates("faceZones", mesh.faceZones().names()); } diff --git a/src/conversion/common/tables/cellTable.C b/src/conversion/common/tables/cellTable.C index 2e3597aa521..723d6743e3c 100644 --- a/src/conversion/common/tables/cellTable.C +++ b/src/conversion/common/tables/cellTable.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -499,7 +499,7 @@ void Foam::cellTable::addCellZones ) ); } - czMesh.writeOpt() = IOobject::AUTO_WRITE; + czMesh.writeOpt(IOobject::AUTO_WRITE); } diff --git a/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C index 725b90e8454..6072048d583 100644 --- a/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C +++ b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -101,8 +101,8 @@ bool Foam::dynamicMotionSolverListFvMesh::init(const bool doInit) if (dEntry.isDict()) { IOobject io(ioDict); - io.readOpt() = IOobject::NO_READ; - io.writeOpt() = IOobject::AUTO_WRITE; + io.readOpt(IOobject::NO_READ); + io.writeOpt(IOobject::AUTO_WRITE); io.rename(dEntry.dict().dictName()); IOdictionary IOsolverDict diff --git a/src/dynamicFvMesh/dynamicMultiMotionSolverFvMesh/dynamicMultiMotionSolverFvMesh.C b/src/dynamicFvMesh/dynamicMultiMotionSolverFvMesh/dynamicMultiMotionSolverFvMesh.C index ae1916ab204..8a49f23a855 100644 --- a/src/dynamicFvMesh/dynamicMultiMotionSolverFvMesh/dynamicMultiMotionSolverFvMesh.C +++ b/src/dynamicFvMesh/dynamicMultiMotionSolverFvMesh/dynamicMultiMotionSolverFvMesh.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -116,7 +116,7 @@ bool Foam::dynamicMultiMotionSolverFvMesh::init(const bool doInit) } IOobject io(dynDict); - io.readOpt() = IOobject::NO_READ; + io.readOpt(IOobject::NO_READ); motionPtr_.set ( diff --git a/src/dynamicFvMesh/simplifiedDynamicFvMesh/simplifiedDynamicFvMeshTemplates.C b/src/dynamicFvMesh/simplifiedDynamicFvMesh/simplifiedDynamicFvMeshTemplates.C index ddd59d59479..f11028d8229 100644 --- a/src/dynamicFvMesh/simplifiedDynamicFvMesh/simplifiedDynamicFvMeshTemplates.C +++ b/src/dynamicFvMesh/simplifiedDynamicFvMesh/simplifiedDynamicFvMeshTemplates.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -56,9 +56,9 @@ SimplifiedDynamicFvMesh // Workaround to read fvSchemes and fvSolution after setting NO_READ // when creating the mesh { - fvSchemes::readOpt() = IOobject::MUST_READ; + fvSchemes::readOpt(IOobject::MUST_READ); fvSchemes::read(); - fvSolution::readOpt() = IOobject::MUST_READ; + fvSolution::readOpt(IOobject::MUST_READ); fvSolution::read(); } diff --git a/src/dynamicMesh/fvMeshSubsetProxy/fvMeshSubsetProxyTemplates.C b/src/dynamicMesh/fvMeshSubsetProxy/fvMeshSubsetProxyTemplates.C index e51a0b18f4e..4d336786aa4 100644 --- a/src/dynamicMesh/fvMeshSubsetProxy/fvMeshSubsetProxyTemplates.C +++ b/src/dynamicMesh/fvMeshSubsetProxy/fvMeshSubsetProxyTemplates.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2018 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,9 +42,9 @@ Foam::fvMeshSubsetProxy::zeroGradientField ) { IOobject io(df); - io.readOpt() = IOobject::NO_READ; - io.writeOpt() = IOobject::NO_WRITE; - io.registerObject() = false; + io.readOpt(IOobject::NO_READ); + io.writeOpt(IOobject::NO_WRITE); + io.registerObject(false); auto tfield = tmp<GeometricField<Type, fvPatchField, volMesh>>::New ( diff --git a/src/dynamicMesh/fvMeshTools/fvMeshTools.C b/src/dynamicMesh/fvMeshTools/fvMeshTools.C index f79eb956930..4ca422e9df4 100644 --- a/src/dynamicMesh/fvMeshTools/fvMeshTools.C +++ b/src/dynamicMesh/fvMeshTools/fvMeshTools.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -519,11 +519,11 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshTools::newMesh meshIO.instance() = facesInstance; if (masterOnlyReading && !Pstream::master()) { - meshIO.readOpt() = IOobject::NO_READ; + meshIO.readOpt(IOobject::NO_READ); } else { - meshIO.readOpt() = IOobject::READ_IF_PRESENT; + meshIO.readOpt(IOobject::READ_IF_PRESENT); } @@ -537,9 +537,9 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshTools::newMesh // (correctly) does no longer so below code explicitly addFvPatches // using the separately read boundary file. - const regIOobject::fileCheckTypes oldCheckType = - regIOobject::fileModificationChecking; - regIOobject::fileModificationChecking = regIOobject::timeStamp; + const IOobject::fileCheckTypes oldCheckType = + IOobject::fileModificationChecking; + IOobject::fileModificationChecking = IOobject::timeStamp; //- Points @@ -612,7 +612,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshTools::newMesh ); fvMesh& mesh = *meshPtr; - regIOobject::fileModificationChecking = oldCheckType; + IOobject::fileModificationChecking = oldCheckType; diff --git a/src/dynamicMesh/motionSolvers/displacement/codedPoints0/codedPoints0MotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/codedPoints0/codedPoints0MotionSolver.C index 9f91588cde7..96dac89c189 100644 --- a/src/dynamicMesh/motionSolvers/displacement/codedPoints0/codedPoints0MotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/codedPoints0/codedPoints0MotionSolver.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -145,7 +145,7 @@ Foam::codedPoints0MotionSolver::redirectMotionSolver() const constructDict.set("motionSolver", name_); IOobject io(*this); - io.readOpt() = IOobject::NO_READ; + io.readOpt(IOobject::NO_READ); redirectMotionSolverPtr_ = motionSolver::New ( diff --git a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C index 6a598cfce1c..e95cceac335 100644 --- a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2017 OpenFOAM Foundation - Copyright (C) 2015-2019 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -217,7 +217,7 @@ void Foam::points0MotionSolver::updateMesh(const mapPolyMesh& mpm) // points0 changed - set to write and check-in to database points0_.rename("points0"); - points0_.writeOpt() = IOobject::AUTO_WRITE; + points0_.writeOpt(IOobject::AUTO_WRITE); points0_.instance() = time().timeName(); points0_.checkIn(); } diff --git a/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C b/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C index 097f766100f..d8952dd77ee 100644 --- a/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C +++ b/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,7 +54,7 @@ Foam::IOobject Foam::motionSolver::stealRegistration // De-register if necessary const_cast<IOdictionary&>(dict).checkOut(); } - io.registerObject() = true; + io.registerObject(true); return io; } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C index 4feaa1b1acf..8d2860adbe4 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1990,7 +1990,7 @@ Foam::hexRef8::hexRef8(const polyMesh& mesh, const bool readHistory) { if (readHistory) { - history_.readOpt() = IOobject::READ_IF_PRESENT; + history_.readOpt(IOobject::READ_IF_PRESENT); if (history_.typeHeaderOk<refinementHistory>(true)) { history_.read(); diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C index b16318dc6bd..32fea05e567 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015-2017 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -241,7 +241,7 @@ void Foam::hexRef8Data::sync(const IOobject& io) if (hasCellLevel && !cellLevelPtr_) { IOobject rio(io, "cellLevel"); - rio.readOpt() = IOobject::NO_READ; + rio.readOpt(IOobject::NO_READ); cellLevelPtr_.reset ( new labelIOList(rio, labelList(mesh.nCells(), Zero)) @@ -252,7 +252,7 @@ void Foam::hexRef8Data::sync(const IOobject& io) if (hasPointLevel && !pointLevelPtr_) { IOobject rio(io, "pointLevel"); - rio.readOpt() = IOobject::NO_READ; + rio.readOpt(IOobject::NO_READ); pointLevelPtr_.reset ( new labelIOList(rio, labelList(mesh.nPoints(), Zero)) @@ -268,7 +268,7 @@ void Foam::hexRef8Data::sync(const IOobject& io) if (!level0EdgePtr_) { IOobject rio(io, "level0Edge"); - rio.readOpt() = IOobject::NO_READ; + rio.readOpt(IOobject::NO_READ); level0EdgePtr_.reset ( new uniformDimensionedScalarField @@ -284,7 +284,7 @@ void Foam::hexRef8Data::sync(const IOobject& io) if (hasHistory && !refHistoryPtr_) { IOobject rio(io, "refinementHistory"); - rio.readOpt() = IOobject::NO_READ; + rio.readOpt(IOobject::NO_READ); refHistoryPtr_.reset(new refinementHistory(rio, mesh.nCells(), true)); } } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C b/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C index f34bd3f3f58..a7d7acce1cb 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C @@ -239,7 +239,7 @@ void Foam::polyTopoChanger::update(const mapPolyMesh& m) // Force the mesh modifiers to auto-write. This allows us to // preserve the current state of modifiers corresponding with // the mesh. - writeOpt() = IOobject::AUTO_WRITE; + writeOpt(IOobject::AUTO_WRITE); instance() = mesh_.time().timeName(); } @@ -294,7 +294,7 @@ void Foam::polyTopoChanger::addTopologyModifiers set(tmI, tm[tmI]); } - writeOpt() = IOobject::AUTO_WRITE; + writeOpt(IOobject::AUTO_WRITE); } diff --git a/src/faOptions/faOption/faOptions.C b/src/faOptions/faOption/faOptions.C index ef6e465813d..a97e1655974 100644 --- a/src/faOptions/faOption/faOptions.C +++ b/src/faOptions/faOption/faOptions.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------ License This file is part of OpenFOAM. @@ -62,8 +62,7 @@ Foam::IOobject Foam::fa::options::createIOobject << io.instance()/io.name() << nl << endl; - io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; - return io; + io.readOpt(IOobject::MUST_READ_IF_MODIFIED); } else { @@ -76,15 +75,15 @@ Foam::IOobject Foam::fa::options::createIOobject << io.instance()/io.name() << nl << endl; - io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; - return io; + io.readOpt(IOobject::MUST_READ_IF_MODIFIED); } else { - io.readOpt() = IOobject::NO_READ; - return io; + io.readOpt(IOobject::NO_READ); } } + + return io; } diff --git a/src/finiteArea/faMesh/faMesh.C b/src/finiteArea/faMesh/faMesh.C index 8c8c2961f6b..1e06c4cc03c 100644 --- a/src/finiteArea/faMesh/faMesh.C +++ b/src/finiteArea/faMesh/faMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1121,7 +1121,7 @@ Foam::faMesh::S00() const S0() ); - S0Ptr_->writeOpt() = IOobject::AUTO_WRITE; + S0Ptr_->writeOpt(IOobject::AUTO_WRITE); } return *S00Ptr_; diff --git a/src/finiteVolume/cfdTools/compressible/createDpdt.H b/src/finiteVolume/cfdTools/compressible/createDpdt.H index de366f28436..b706984137c 100644 --- a/src/finiteVolume/cfdTools/compressible/createDpdt.H +++ b/src/finiteVolume/cfdTools/compressible/createDpdt.H @@ -15,8 +15,8 @@ if (mesh.dynamic()) // - set to READ_IF_PRESENT and AUTO_WRITE to simplify dpdt correction // by meshPhi - dpdtHeader.readOpt() = IOobject::READ_IF_PRESENT; - dpdtHeader.writeOpt() = IOobject::AUTO_WRITE; + dpdtHeader.readOpt(IOobject::READ_IF_PRESENT); + dpdtHeader.writeOpt(IOobject::AUTO_WRITE); } else { @@ -28,5 +28,5 @@ volScalarField dpdt(dpdtHeader, fvc::ddt(p)); if (!thermo.dpdt()) { dpdt == dimensionedScalar(dpdt.dimensions(), Zero); - dpdt.writeOpt() = IOobject::NO_WRITE; + dpdt.writeOpt(IOobject::NO_WRITE); } diff --git a/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.C b/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.C index 8c651c6400a..3577318a6df 100644 --- a/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.C +++ b/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2020 PCOpt/NTUA Copyright (C) 2020 FOSS GP ------------------------------------------------------------------------------- @@ -53,16 +53,16 @@ Foam::IOobject Foam::IOMRFZoneList::createIOobject { Info<< "Creating MRF zone list from " << io.name() << endl; - io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; - return io; + io.readOpt(IOobject::MUST_READ_IF_MODIFIED); } else { Info<< "No MRF models present" << nl << endl; - io.readOpt() = IOobject::NO_READ; - return io; + io.readOpt(IOobject::NO_READ); } + + return io; } diff --git a/src/finiteVolume/cfdTools/general/fvOptions/fvOptions.C b/src/finiteVolume/cfdTools/general/fvOptions/fvOptions.C index 312fbbe9ca1..4361f20a47e 100644 --- a/src/finiteVolume/cfdTools/general/fvOptions/fvOptions.C +++ b/src/finiteVolume/cfdTools/general/fvOptions/fvOptions.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -63,8 +63,7 @@ Foam::IOobject Foam::fv::options::createIOobject << io.instance()/io.name() << nl << endl; - io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; - return io; + io.readOpt(IOobject::MUST_READ_IF_MODIFIED); } else { @@ -77,15 +76,15 @@ Foam::IOobject Foam::fv::options::createIOobject << io.instance()/io.name() << nl << endl; - io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; - return io; + io.readOpt(IOobject::MUST_READ_IF_MODIFIED); } else { - io.readOpt() = IOobject::NO_READ; - return io; + io.readOpt(IOobject::NO_READ); } } + + return io; } diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C index e0a962ac351..d66bbf42412 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2014 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -49,13 +50,13 @@ Foam::IOobject Foam::IOporosityModelList::createIOobject { Info<< "Creating porosity model list from " << io.name() << nl << endl; - io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; + io.readOpt(IOobject::MUST_READ_IF_MODIFIED); } else { Info<< "No porosity models present" << nl << endl; - io.readOpt() = IOobject::NO_READ; + io.readOpt(IOobject::NO_READ); } return io; diff --git a/src/finiteVolume/fvMesh/fvMeshGeometry.C b/src/finiteVolume/fvMesh/fvMeshGeometry.C index b850fdd8668..60cca8a48d2 100644 --- a/src/finiteVolume/fvMesh/fvMeshGeometry.C +++ b/src/finiteVolume/fvMesh/fvMeshGeometry.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -252,7 +252,7 @@ const Foam::volScalarField::Internal& Foam::fvMesh::V00() const // If V00 is used then V0 should be stored for restart - V0Ptr_->writeOpt() = IOobject::AUTO_WRITE; + V0Ptr_->writeOpt(IOobject::AUTO_WRITE); } return *V00Ptr_; diff --git a/src/finiteVolume/fvMesh/simplifiedFvMesh/columnFvMesh/columnFvMesh.C b/src/finiteVolume/fvMesh/simplifiedFvMesh/columnFvMesh/columnFvMesh.C index 01d471d2aee..39a0da94ed5 100644 --- a/src/finiteVolume/fvMesh/simplifiedFvMesh/columnFvMesh/columnFvMesh.C +++ b/src/finiteVolume/fvMesh/simplifiedFvMesh/columnFvMesh/columnFvMesh.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -467,9 +467,9 @@ Foam::simplifiedMeshes::columnFvMesh::columnFvMesh // Workaround to read fvSchemes and fvSolution after setting NO_READ // when creating the mesh { - fvSchemes::readOpt() = IOobject::MUST_READ; + fvSchemes::readOpt(IOobject::MUST_READ); fvSchemes::read(); - fvSolution::readOpt() = IOobject::MUST_READ; + fvSolution::readOpt(IOobject::MUST_READ); fvSolution::read(); } diff --git a/src/functionObjects/field/nearWallFields/nearWallFieldsTemplates.C b/src/functionObjects/field/nearWallFields/nearWallFieldsTemplates.C index bc5ae6a5236..209a76b23ac 100644 --- a/src/functionObjects/field/nearWallFields/nearWallFieldsTemplates.C +++ b/src/functionObjects/field/nearWallFields/nearWallFieldsTemplates.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -61,8 +61,8 @@ void Foam::functionObjects::nearWallFields::createFields sflds.setSize(sz+1); IOobject io(fld); - io.readOpt() = IOobject::NO_READ; - io.writeOpt() = IOobject::NO_WRITE; + io.readOpt(IOobject::NO_READ); + io.writeOpt(IOobject::NO_WRITE); io.rename(sampleFldName); diff --git a/src/functionObjects/field/stabilityBlendingFactor/stabilityBlendingFactor.C b/src/functionObjects/field/stabilityBlendingFactor/stabilityBlendingFactor.C index 67a49ebf570..93cc67fadcf 100644 --- a/src/functionObjects/field/stabilityBlendingFactor/stabilityBlendingFactor.C +++ b/src/functionObjects/field/stabilityBlendingFactor/stabilityBlendingFactor.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -614,7 +614,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor if (log) { - indicator_.writeOpt() = IOobject::AUTO_WRITE; + indicator_.writeOpt(IOobject::AUTO_WRITE); } diff --git a/src/lagrangian/intermediate/conversion/ensight/ensightOutputCloudTemplates.C b/src/lagrangian/intermediate/conversion/ensight/ensightOutputCloudTemplates.C index c07cb1667f5..26f3840b7e4 100644 --- a/src/lagrangian/intermediate/conversion/ensight/ensightOutputCloudTemplates.C +++ b/src/lagrangian/intermediate/conversion/ensight/ensightOutputCloudTemplates.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -130,7 +130,7 @@ bool Foam::ensightOutput::writeCloudField // Handle this by READ_IF_PRESENT instead. IOobject fieldObj(io); - fieldObj.readOpt() = IOobject::READ_IF_PRESENT; + fieldObj.readOpt(IOobject::READ_IF_PRESENT); IOField<Type> field(fieldObj); diff --git a/src/mesh/blockMesh/PDRblockMesh/PDRblockCreate.C b/src/mesh/blockMesh/PDRblockMesh/PDRblockCreate.C index df1e3c9b5ef..b55f5fdc039 100644 --- a/src/mesh/blockMesh/PDRblockMesh/PDRblockCreate.C +++ b/src/mesh/blockMesh/PDRblockMesh/PDRblockCreate.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -331,7 +331,7 @@ Foam::PDRblock::innerMesh(const IOobject& io) const IOobject iomesh(io); - iomesh.writeOpt() = IOobject::AUTO_WRITE; + iomesh.writeOpt(IOobject::AUTO_WRITE); auto meshPtr = autoPtr<polyMesh>::New ( diff --git a/src/meshTools/polyTopoChange/polyTopoChangeTemplates.C b/src/meshTools/polyTopoChange/polyTopoChangeTemplates.C index eea465b2761..0423b2e65bf 100644 --- a/src/meshTools/polyTopoChange/polyTopoChangeTemplates.C +++ b/src/meshTools/polyTopoChange/polyTopoChangeTemplates.C @@ -186,8 +186,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::makeMesh // ~~~~~~~~~~~~~~~ //IOobject noReadIO(io); - //noReadIO.readOpt() = IOobject::NO_READ; - //noReadIO.writeOpt() = IOobject::AUTO_WRITE; + //noReadIO.readOpt(IOobject::NO_READ); + //noReadIO.writeOpt(IOobject::AUTO_WRITE); newMeshPtr.reset ( new Type diff --git a/src/meshTools/sets/topoSets/topoSet.C b/src/meshTools/sets/topoSets/topoSet.C index 80e6415f927..9e0bcbb0754 100644 --- a/src/meshTools/sets/topoSets/topoSet.C +++ b/src/meshTools/sets/topoSets/topoSet.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -341,7 +341,7 @@ Foam::IOobject Foam::topoSet::findIOobject if (!io.typeHeaderOk<topoSet>(false) && disallowGenericSets != 0) { DebugInfo<< "Setting no read for set " << name << endl; - io.readOpt() = IOobject::NO_READ; + io.readOpt(IOobject::NO_READ); } return io; @@ -389,10 +389,7 @@ Foam::topoSet::topoSet(const IOobject& obj, const word& wantedType) ( readOpt() == IOobject::MUST_READ || readOpt() == IOobject::MUST_READ_IF_MODIFIED - || ( - readOpt() == IOobject::READ_IF_PRESENT - && headerOk() - ) + || (readOpt() == IOobject::READ_IF_PRESENT && headerOk()) ) { if (readStream(wantedType).good()) @@ -420,10 +417,7 @@ Foam::topoSet::topoSet ( readOpt() == IOobject::MUST_READ || readOpt() == IOobject::MUST_READ_IF_MODIFIED - || ( - readOpt() == IOobject::READ_IF_PRESENT - && headerOk() - ) + || (readOpt() == IOobject::READ_IF_PRESENT && headerOk()) ) { if (readStream(wantedType).good()) diff --git a/src/optimisation/adjointOptimisation/adjoint/solvers/variablesSet/variablesSet/variablesSetTemplates.C b/src/optimisation/adjointOptimisation/adjoint/solvers/variablesSet/variablesSet/variablesSetTemplates.C index 76f3cf78d83..1210020825e 100644 --- a/src/optimisation/adjointOptimisation/adjoint/solvers/variablesSet/variablesSet/variablesSetTemplates.C +++ b/src/optimisation/adjointOptimisation/adjoint/solvers/variablesSet/variablesSet/variablesSetTemplates.C @@ -298,7 +298,7 @@ void variablesSet::renameTurbulenceField if (!mesh.foundObject<VolFieldType>(baseName)) { autoPtr<VolFieldType> baseCopy(new VolFieldType(baseField)); - baseCopy().IOobject::writeOpt() = baseField.writeOpt(); + baseCopy().IOobject::writeOpt(baseField.writeOpt()); baseCopy().rename(baseName); regIOobject::store(baseCopy); } diff --git a/src/overset/cellCellStencil/trackingInverseDistance/voxelMeshSearch.C b/src/overset/cellCellStencil/trackingInverseDistance/voxelMeshSearch.C index 66bcce889bf..e717c80c58c 100644 --- a/src/overset/cellCellStencil/trackingInverseDistance/voxelMeshSearch.C +++ b/src/overset/cellCellStencil/trackingInverseDistance/voxelMeshSearch.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -555,7 +555,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::voxelMeshSearch::makeMesh //Info<< "Creating polyMesh" << endl; IOobject polyIO(io); - polyIO.readOpt() = IOobject::NO_READ; + polyIO.readOpt(IOobject::NO_READ); polyMesh mesh ( //IOobject @@ -587,7 +587,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::voxelMeshSearch::makeMesh io.name() ); IOobject fvIO(io); - fvIO.readOpt() = IOobject::MUST_READ; + fvIO.readOpt(IOobject::MUST_READ); return autoPtr<fvMesh>::New(fvIO); } diff --git a/src/phaseSystemModels/reactingEuler/multiphaseSystem/phaseModel/MovingPhaseModel/MovingPhaseModel.C b/src/phaseSystemModels/reactingEuler/multiphaseSystem/phaseModel/MovingPhaseModel/MovingPhaseModel.C index c8e4c347403..5f99649809a 100644 --- a/src/phaseSystemModels/reactingEuler/multiphaseSystem/phaseModel/MovingPhaseModel/MovingPhaseModel.C +++ b/src/phaseSystemModels/reactingEuler/multiphaseSystem/phaseModel/MovingPhaseModel/MovingPhaseModel.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015-2018 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -205,7 +206,7 @@ Foam::MovingPhaseModel<BasePhaseModel>::MovingPhaseModel ), K_(nullptr) { - phi_.writeOpt() = IOobject::AUTO_WRITE; + phi_.writeOpt(IOobject::AUTO_WRITE); correctKinematics(); } diff --git a/src/phaseSystemModels/reactingEuler/multiphaseSystem/phaseSystem/phaseSystem.C b/src/phaseSystemModels/reactingEuler/multiphaseSystem/phaseSystem/phaseSystem.C index 202ceeb230e..85beab63289 100644 --- a/src/phaseSystemModels/reactingEuler/multiphaseSystem/phaseSystem/phaseSystem.C +++ b/src/phaseSystemModels/reactingEuler/multiphaseSystem/phaseSystem/phaseSystem.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015-2018 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -205,7 +205,7 @@ Foam::phaseSystem::phaseSystem } // Write phi - phi_.writeOpt() = IOobject::AUTO_WRITE; + phi_.writeOpt(IOobject::AUTO_WRITE); // Blending methods forAllConstIter(dictionary, subDict("blending"), iter) diff --git a/src/surfMesh/MeshedSurfaceAllocator/MeshedSurfaceIOAllocator.C b/src/surfMesh/MeshedSurfaceAllocator/MeshedSurfaceIOAllocator.C index 11a25822c76..0882fdd9e58 100644 --- a/src/surfMesh/MeshedSurfaceAllocator/MeshedSurfaceIOAllocator.C +++ b/src/surfMesh/MeshedSurfaceAllocator/MeshedSurfaceIOAllocator.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -88,8 +88,8 @@ void Foam::Detail::MeshedSurfaceIOAllocator::setWriteOption IOobject::writeOption wOpt ) { - points_.writeOpt() = wOpt; - faces_.writeOpt() = wOpt; + points_.writeOpt(wOpt); + faces_.writeOpt(wOpt); } diff --git a/src/surfMesh/surfMesh/surfMeshIO.C b/src/surfMesh/surfMesh/surfMeshIO.C index f63cc5ef070..5905d559127 100644 --- a/src/surfMesh/surfMesh/surfMeshIO.C +++ b/src/surfMesh/surfMesh/surfMeshIO.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -49,9 +49,9 @@ void Foam::surfMesh::setInstance void Foam::surfMesh::setWriteOption(IOobject::writeOption wOpt) { - writeOpt() = wOpt; + writeOpt(wOpt); Allocator::setWriteOption(wOpt); - surfZones_.writeOpt() = wOpt; + surfZones_.writeOpt(wOpt); } diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/TDACChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/TDACChemistryModel.C index c4d502ebe07..5add9d0bb18 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/TDACChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/TDACChemistryModel.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -111,7 +111,7 @@ Foam::TDACChemistryModel<ReactionThermo, ThermoType>::TDACChemistryModel if (!header.typeHeaderOk<volScalarField>(true)) { composition.setInactive(i); - this->Y()[i].writeOpt() = IOobject::NO_WRITE; + this->Y()[i].writeOpt(IOobject::NO_WRITE); } } } @@ -883,7 +883,7 @@ Foam::scalar Foam::TDACChemistryModel<ReactionThermo, ThermoType>::solve { if (composition.active(i)) { - this->Y()[i].writeOpt() = IOobject::AUTO_WRITE; + this->Y()[i].writeOpt(IOobject::AUTO_WRITE); } } diff --git a/src/thermophysicalModels/radiation/radiationModels/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C b/src/thermophysicalModels/radiation/radiationModels/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C index 6d0d6677595..cc1a15a1e8e 100644 --- a/src/thermophysicalModels/radiation/radiationModels/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C +++ b/src/thermophysicalModels/radiation/radiationModels/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd + Copyright (C) 2018-2021 OpenCFD Ltd ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -246,7 +246,7 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay // Reset the MUST_READ flag IOobject noReadHeader(IHeader); - noReadHeader.readOpt() = IOobject::NO_READ; + noReadHeader.readOpt(IOobject::NO_READ); ILambda_.set ( diff --git a/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C b/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C index 1bd4f4a9954..b2496db224e 100644 --- a/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C +++ b/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -72,12 +72,12 @@ Foam::IOobject Foam::radiation::radiationModel::createIOobject if (io.typeHeaderOk<IOdictionary>(true)) { - io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; + io.readOpt(IOobject::MUST_READ_IF_MODIFIED); return io; } else { - io.readOpt() = IOobject::NO_READ; + io.readOpt(IOobject::NO_READ); return io; } } diff --git a/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C b/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C index e31f825dafb..0923015d838 100644 --- a/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C +++ b/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -139,7 +139,7 @@ void Foam::linearValveFvMesh::addZonesAndModifiers() true // Attach-detach action ) ); - topoChanger_.writeOpt() = IOobject::AUTO_WRITE; + topoChanger_.writeOpt(IOobject::AUTO_WRITE); // Write mesh write(); diff --git a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C b/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C index eba863b6e25..c6ab3937524 100644 --- a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C +++ b/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -168,7 +168,7 @@ void Foam::mixerFvMesh::addZonesAndModifiers() slidingInterface::INTEGRAL ) ); - topoChanger_.writeOpt() = IOobject::AUTO_WRITE; + topoChanger_.writeOpt(IOobject::AUTO_WRITE); write(); } diff --git a/src/waveModels/waveModel/waveModel.C b/src/waveModels/waveModel/waveModel.C index 7cdee935bf3..21c9cf35927 100644 --- a/src/waveModels/waveModel/waveModel.C +++ b/src/waveModels/waveModel/waveModel.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 IH-Cantabria - Copyright (C) 2016-2017 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -294,7 +294,7 @@ Foam::waveModel::waveModel bool Foam::waveModel::readDict(const dictionary& overrideDict) { - readOpt() = IOobject::READ_IF_PRESENT; + readOpt(IOobject::READ_IF_PRESENT); if (headerOk()) { IOdictionary::regIOobject::read(); -- GitLab