From ac574a6ccb46bf9a0bfdc77c58e0fb670d793b6b Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 4 Jan 2024 12:03:21 +0100 Subject: [PATCH] STYLE: use static call for regIOobject::store (#1507) --- .../solvers/combustion/fireFoam/phrghEqn.H | 3 +- .../createROMfields/readFields.H | 4 +- .../setExprBoundaryFields/readFields.H | 4 +- .../preProcessing/setExprFields/readFields.H | 4 +- .../regionFunctionObjectTemplates.C | 13 +++-- .../GAMGAgglomeration/GAMGAgglomeration.C | 8 +-- .../schemes/DEShybrid/DEShybrid.H | 6 +-- .../atmPlantCanopyTurbSource.C | 6 +-- .../atmPlantCanopyUSource.C | 6 +-- .../jouleHeatingSourceTemplates.C | 54 +++++++++---------- .../cfdTools/general/fvOptions/fvOptions.C | 4 +- .../LimitedScheme/LimitedScheme.C | 6 +-- .../volPointInterpolate.C | 4 +- .../field/CourantNo/CourantNo.C | 6 +-- .../columnAverage/columnAverageTemplates.C | 6 +-- .../field/expressions/fvExpressionField.C | 4 +- .../heatTransferCoeff/heatTransferCoeff.C | 7 +-- .../multiphaseInterHtcModel.C | 7 +-- .../reactingEulerHtcModel.C | 6 +-- .../histogramModel/histogramModel.C | 6 +-- src/functionObjects/field/momentum/momentum.C | 6 +-- .../field/momentumError/momentumError.C | 31 +++++------ .../field/readFields/readFieldsTemplates.C | 4 +- .../resolutionIndexModel.C | 6 +-- .../resolutionIndexModelTemplates.C | 6 +-- .../stabilityBlendingFactor.C | 18 +++---- .../field/surfaceDistance/surfaceDistance.C | 6 +-- .../field/wallHeatFlux/wallHeatFlux.C | 6 +-- .../field/wallShearStress/wallShearStress.C | 6 +-- src/functionObjects/field/yPlus/yPlus.C | 6 +-- .../forces/forceCoeffs/forceCoeffs.C | 28 +++++----- src/functionObjects/forces/forces/forces.C | 26 ++++----- .../hydrostaticPressure/hydrostaticPressure.C | 4 +- .../electricPotential/electricPotential.C | 13 ++--- .../mapFieldConstraint/MapFieldConstraint.C | 6 +-- .../jouleHeatingSource/jouleHeatingSource.C | 4 +- .../jouleHeatingSourceTemplates.C | 50 +++++++++-------- .../ParticleForces/Coulomb/CoulombForce.C | 9 ++-- ...edPointDisplacementPointPatchVectorField.C | 4 +- .../mappedPatchBaseTemplates.C | 6 +-- .../processorColour.C | 18 +++---- .../functionObjects/filmFlux/filmFlux.C | 10 ++-- ...eratureRadCoupledMixedFvPatchScalarField.C | 9 ++-- .../BilgerMixtureFraction.C | 6 +-- 44 files changed, 227 insertions(+), 225 deletions(-) diff --git a/applications/solvers/combustion/fireFoam/phrghEqn.H b/applications/solvers/combustion/fireFoam/phrghEqn.H index 482355f12a..022006494f 100644 --- a/applications/solvers/combustion/fireFoam/phrghEqn.H +++ b/applications/solvers/combustion/fireFoam/phrghEqn.H @@ -10,7 +10,8 @@ if (pimple.dict().getOrDefault("hydrostaticInitialization", false)) "0", mesh, IOobject::MUST_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh ) diff --git a/applications/utilities/postProcessing/miscellaneous/createROMfields/readFields.H b/applications/utilities/postProcessing/miscellaneous/createROMfields/readFields.H index a1d345d1c8..084d0c16bd 100644 --- a/applications/utilities/postProcessing/miscellaneous/createROMfields/readFields.H +++ b/applications/utilities/postProcessing/miscellaneous/createROMfields/readFields.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021-2022 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -71,7 +71,7 @@ class readFieldsHandler Log << " Reading " << io.name() << " (" << FieldType::typeName << ')' << endl; - mesh_.objectRegistry::store(new FieldType(io, mesh_)); + regIOobject::store(new FieldType(io, mesh_)); return true; } diff --git a/applications/utilities/preProcessing/setExprBoundaryFields/readFields.H b/applications/utilities/preProcessing/setExprBoundaryFields/readFields.H index 07e0bb443e..e72ac18820 100644 --- a/applications/utilities/preProcessing/setExprBoundaryFields/readFields.H +++ b/applications/utilities/preProcessing/setExprBoundaryFields/readFields.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2022 OpenCFD Ltd. + Copyright (C) 2022-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -71,7 +71,7 @@ class readFieldsHandler Log << " Reading " << io.name() << " (" << FieldType::typeName << ')' << endl; - mesh_.objectRegistry::store(new FieldType(io, mesh_)); + regIOobject::store(new FieldType(io, mesh_)); return true; } diff --git a/applications/utilities/preProcessing/setExprFields/readFields.H b/applications/utilities/preProcessing/setExprFields/readFields.H index 8ab2063ed9..b150c97d97 100644 --- a/applications/utilities/preProcessing/setExprFields/readFields.H +++ b/applications/utilities/preProcessing/setExprFields/readFields.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021-2022 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -71,7 +71,7 @@ class readFieldsHandler Log << " Reading " << io.name() << " (" << FieldType::typeName << ')' << endl; - mesh_.objectRegistry::store(new FieldType(io, mesh_)); + regIOobject::store(new FieldType(io, mesh_)); return true; } diff --git a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C index c1c0f740b6..0c295eca2b 100644 --- a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C +++ b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016 OpenFOAM Foundation - Copyright (C) 2016-2021 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -139,7 +139,7 @@ bool Foam::functionObjects::regionFunctionObject::store } else { - obr().objectRegistry::store(tfield.ptr()); + regIOobject::store(tfield.ptr()); } } else @@ -153,7 +153,7 @@ bool Foam::functionObjects::regionFunctionObject::store fieldName = tfield().name(); } - obr().objectRegistry::store(tfield.ptr()); + regIOobject::store(tfield.ptr()); } return true; @@ -179,8 +179,11 @@ bool Foam::functionObjects::regionFunctionObject::storeInDb } else { - tfield.ref().rename(fieldName); - obr.objectRegistry::store(tfield.ptr()); + if (fieldName.size() && fieldName != tfield().name()) + { + tfield.ref().rename(fieldName); + } + regIOobject::store(tfield.ptr()); } return true; diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C index b6b6291552..1ced04106f 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2023 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -348,7 +348,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New { agglomPtr().printLevels(); } - return store(agglomPtr.ptr()); + return regIOobject::store(agglomPtr); } } @@ -398,7 +398,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New { agglomPtr().printLevels(); } - return store(agglomPtr.ptr()); + return regIOobject::store(agglomPtr); } } } @@ -463,7 +463,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New { agglomPtr().printLevels(); } - return store(agglomPtr.ptr()); + return regIOobject::store(agglomPtr); } } diff --git a/src/TurbulenceModels/schemes/DEShybrid/DEShybrid.H b/src/TurbulenceModels/schemes/DEShybrid/DEShybrid.H index 62618f3260..7d9720679c 100644 --- a/src/TurbulenceModels/schemes/DEShybrid/DEShybrid.H +++ b/src/TurbulenceModels/schemes/DEShybrid/DEShybrid.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 OpenFOAM Foundation - Copyright (C) 2015-2022 OpenCFD Ltd. + Copyright (C) 2015-2024 OpenCFD Ltd. Copyright (C) 2022 Upstream CFD GmbH ------------------------------------------------------------------------------- License @@ -301,7 +301,7 @@ class DEShybrid ( factorName, mesh.time().timeName(), - mesh, + mesh.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -321,7 +321,7 @@ class DEShybrid dimensionedScalar(dimless, Zero) ); - const_cast(mesh).objectRegistry::store(factorPtr); + regIOobject::store(factorPtr); } auto& factor = *factorPtr; diff --git a/src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSource.C b/src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSource.C index ed01512dbd..b5b72cc4f3 100644 --- a/src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSource.C +++ b/src/atmosphericModels/fvOptions/atmPlantCanopyTurbSource/atmPlantCanopyTurbSource.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2020 ENERCON GmbH - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -58,14 +58,14 @@ Foam::volScalarField& Foam::fv::atmPlantCanopyTurbSource::getOrReadField ( fieldName, mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobject::MUST_READ, IOobject::AUTO_WRITE, IOobject::REGISTER ), mesh_ ); - mesh_.objectRegistry::store(ptr); + regIOobject::store(ptr); } return *ptr; diff --git a/src/atmosphericModels/fvOptions/atmPlantCanopyUSource/atmPlantCanopyUSource.C b/src/atmosphericModels/fvOptions/atmPlantCanopyUSource/atmPlantCanopyUSource.C index 89beb35193..683d112c95 100644 --- a/src/atmosphericModels/fvOptions/atmPlantCanopyUSource/atmPlantCanopyUSource.C +++ b/src/atmosphericModels/fvOptions/atmPlantCanopyUSource/atmPlantCanopyUSource.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2020 ENERCON GmbH - Copyright (C) 2020-2022 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,14 +59,14 @@ Foam::volScalarField& Foam::fv::atmPlantCanopyUSource::getOrReadField ( fieldName, mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobject::MUST_READ, IOobject::AUTO_WRITE, IOobject::REGISTER ), mesh_ ); - mesh_.objectRegistry::store(ptr); + regIOobject::store(ptr); } return *ptr; diff --git a/src/faOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C b/src/faOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C index a59bdc65ac..43763b7238 100644 --- a/src/faOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C +++ b/src/faOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2023 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,50 +40,48 @@ void Foam::fa::jouleHeatingSource::initialiseSigma auto& obr = regionMesh().thisDb(); + IOobject io + ( + typeName + ":sigma_" + regionName_, + obr.time().timeName(), + obr, + IOobject::NO_READ, + IOobject::AUTO_WRITE, + IOobject::REGISTER + ); + + tmp tsigma; + if (dict.found("sigma")) { // Sigma to be defined using a Function1 type sigmaVsTPtr = Function1::New("sigma", dict, &mesh_); - auto tsigma = tmp::New + tsigma.reset ( - IOobject + new AreaFieldType ( - typeName + ":sigma_" + regionName_, - obr.time().timeName(), - obr, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - regionMesh(), - dimensioned(sqr(dimCurrent)/dimPower/dimLength, Zero) + io, + regionMesh(), + Foam::zero{}, // value + sqr(dimCurrent)/dimPower/dimLength + ) ); - regIOobject::store(tsigma.ptr()); - Info<< " Conductivity 'sigma' read from dictionary as f(T)" << nl << endl; } else { // Sigma to be defined by user input - auto tsigma = tmp::New - ( - IOobject - ( - typeName + ":sigma_" + regionName_, - obr.time().timeName(), - obr, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - regionMesh() - ); + io.readOpt(IOobject::MUST_READ); - regIOobject::store(tsigma.ptr()); + tsigma.reset(new AreaFieldType(io, regionMesh())); Info<< " Conductivity 'sigma' read from file" << nl << endl; } + + regIOobject::store(tsigma); } @@ -117,11 +115,11 @@ Foam::fa::jouleHeatingSource::updateSigma // Boundary field - typename AreaFieldType::Boundary& bf = sigma.boundaryFieldRef(); + auto& bf = sigma.boundaryFieldRef(); forAll(bf, patchi) { faPatchField& pf = bf[patchi]; - if (!isA(bf[patchi])) + if (!isA(pf)) { const scalarField& Tbf = T.boundaryField()[patchi]; forAll(pf, facei) diff --git a/src/finiteVolume/cfdTools/general/fvOptions/fvOptions.C b/src/finiteVolume/cfdTools/general/fvOptions/fvOptions.C index a341b20543..7b37201c35 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-2021 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -102,7 +102,7 @@ Foam::fv::options::options Foam::fv::options& Foam::fv::options::New(const fvMesh& mesh) { - options* ptr = mesh.thisDb().getObjectPtr(typeName); + auto* ptr = mesh.thisDb().getObjectPtr(typeName); if (!ptr) { diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C index aed48475eb..e72725405b 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -161,7 +161,7 @@ Foam::LimitedScheme::limiter ( limiterFieldName, mesh.time().timeName(), - mesh, + mesh.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -170,7 +170,7 @@ Foam::LimitedScheme::limiter dimless ); - mesh.objectRegistry::store(fldptr); + regIOobject::store(fldptr); } auto& limiterField = *fldptr; diff --git a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C index ed1476717c..798c3bf152 100644 --- a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C +++ b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -570,8 +570,8 @@ Foam::volPointInterpolation::interpolate if (!pfPtr) { solution::cachePrintMessage("Calculating and caching", name, vf); - pfPtr = interpolate(vf, name, false).ptr(); + pfPtr = interpolate(vf, name, false).ptr(); regIOobject::store(pfPtr); } else diff --git a/src/functionObjects/field/CourantNo/CourantNo.C b/src/functionObjects/field/CourantNo/CourantNo.C index 98aeb51a9c..198fbfaa24 100644 --- a/src/functionObjects/field/CourantNo/CourantNo.C +++ b/src/functionObjects/field/CourantNo/CourantNo.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -88,7 +88,7 @@ bool Foam::functionObjects::CourantNo::calc() ( resultName_, mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -97,7 +97,7 @@ bool Foam::functionObjects::CourantNo::calc() dimensionedScalar(dimless, Zero), fvPatchFieldBase::zeroGradientType() ); - mesh_.objectRegistry::store(resultPtr); + regIOobject::store(resultPtr); } auto& Co = *resultPtr; diff --git a/src/functionObjects/field/columnAverage/columnAverageTemplates.C b/src/functionObjects/field/columnAverage/columnAverageTemplates.C index 6a6b537500..2bba02a3dc 100644 --- a/src/functionObjects/field/columnAverage/columnAverageTemplates.C +++ b/src/functionObjects/field/columnAverage/columnAverageTemplates.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -57,14 +57,14 @@ bool Foam::functionObjects::columnAverage::columnAverageField ( resultName, fld.mesh().time().timeName(), - fld.mesh(), + fld.db(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER ), fld ); - obr_.objectRegistry::store(resPtr); + regIOobject::store(resPtr); } fieldType& res = *resPtr; diff --git a/src/functionObjects/field/expressions/fvExpressionField.C b/src/functionObjects/field/expressions/fvExpressionField.C index 7b3444f6f8..3ab2ae93d4 100644 --- a/src/functionObjects/field/expressions/fvExpressionField.C +++ b/src/functionObjects/field/expressions/fvExpressionField.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021-2022 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -137,7 +137,7 @@ bool Foam::functionObjects::fvExpressionField::loadAndStore(const IOobject& io) Log << " Reading " << io.name() << " (" << FieldType::typeName << ')' << endl; - mesh_.objectRegistry::store(new FieldType(io, mesh_)); + regIOobject::store(new FieldType(io, mesh_)); return true; } diff --git a/src/functionObjects/field/heatTransferCoeff/heatTransferCoeff.C b/src/functionObjects/field/heatTransferCoeff/heatTransferCoeff.C index 5c33fcdc62..9c0925c306 100644 --- a/src/functionObjects/field/heatTransferCoeff/heatTransferCoeff.C +++ b/src/functionObjects/field/heatTransferCoeff/heatTransferCoeff.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2022 OpenCFD Ltd. + Copyright (C) 2017-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -71,6 +71,7 @@ Foam::functionObjects::heatTransferCoeff::heatTransferCoeff { read(dict); + // scopedName? setResultName(typeName, "htc:" + htcModelPtr_->type()); auto* heatTransferCoeffPtr = @@ -80,7 +81,7 @@ Foam::functionObjects::heatTransferCoeff::heatTransferCoeff ( resultName_, mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -89,7 +90,7 @@ Foam::functionObjects::heatTransferCoeff::heatTransferCoeff dimensionedScalar(dimPower/dimArea/dimTemperature, Zero) ); - mesh_.objectRegistry::store(heatTransferCoeffPtr); + regIOobject::store(heatTransferCoeffPtr); } diff --git a/src/functionObjects/field/heatTransferCoeff/multiphaseInterHtcModel/multiphaseInterHtcModel.C b/src/functionObjects/field/heatTransferCoeff/multiphaseInterHtcModel/multiphaseInterHtcModel.C index 206827e72a..c1b17947c3 100644 --- a/src/functionObjects/field/heatTransferCoeff/multiphaseInterHtcModel/multiphaseInterHtcModel.C +++ b/src/functionObjects/field/heatTransferCoeff/multiphaseInterHtcModel/multiphaseInterHtcModel.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2022-2023 OpenCFD Ltd. + Copyright (C) 2022-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -127,6 +127,7 @@ Foam::functionObjects::multiphaseInterHtcModel::multiphaseInterHtcModel { read(dict); + // scopedName? setResultName(typeName, "htc:" + htcModelPtr_->type()); auto* htcPtr = @@ -136,7 +137,7 @@ Foam::functionObjects::multiphaseInterHtcModel::multiphaseInterHtcModel ( resultName_, mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -145,7 +146,7 @@ Foam::functionObjects::multiphaseInterHtcModel::multiphaseInterHtcModel dimensionedScalar(dimPower/dimArea/dimTemperature, Zero) ); - mesh_.objectRegistry::store(htcPtr); + regIOobject::store(htcPtr); } diff --git a/src/functionObjects/field/heatTransferCoeff/reactingEulerHtcModel/reactingEulerHtcModel.C b/src/functionObjects/field/heatTransferCoeff/reactingEulerHtcModel/reactingEulerHtcModel.C index fa8108e9b3..f9d403f776 100644 --- a/src/functionObjects/field/heatTransferCoeff/reactingEulerHtcModel/reactingEulerHtcModel.C +++ b/src/functionObjects/field/heatTransferCoeff/reactingEulerHtcModel/reactingEulerHtcModel.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020-2022 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -145,7 +145,7 @@ Foam::functionObjects::reactingEulerHtcModel::reactingEulerHtcModel ( resultName_, mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -154,7 +154,7 @@ Foam::functionObjects::reactingEulerHtcModel::reactingEulerHtcModel dimensionedScalar(dimPower/dimArea/dimTemperature, Zero) ); - mesh_.objectRegistry::store(htcPtr); + regIOobject::store(htcPtr); } diff --git a/src/functionObjects/field/histogram/histogramModels/histogramModel/histogramModel.C b/src/functionObjects/field/histogram/histogramModels/histogramModel/histogramModel.C index 790f5c2348..95feae0b32 100644 --- a/src/functionObjects/field/histogram/histogramModels/histogramModel/histogramModel.C +++ b/src/functionObjects/field/histogram/histogramModels/histogramModel/histogramModel.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2022 OpenCFD Ltd. + Copyright (C) 2022-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -66,14 +66,14 @@ Foam::volScalarField& Foam::histogramModel::getOrReadField ( fieldName, mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobject::MUST_READ, IOobject::AUTO_WRITE, IOobject::REGISTER ), mesh_ ); - mesh_.objectRegistry::store(ptr); + regIOobject::store(ptr); } return *ptr; diff --git a/src/functionObjects/field/momentum/momentum.C b/src/functionObjects/field/momentum/momentum.C index 04a3f131ae..ed24a5837b 100644 --- a/src/functionObjects/field/momentum/momentum.C +++ b/src/functionObjects/field/momentum/momentum.C @@ -446,14 +446,14 @@ bool Foam::functionObjects::momentum::read(const dictionary& dict) { Info<< " Momentum fields will be written" << endl; - mesh_.objectRegistry::store + regIOobject::store ( newField("momentum", dimVelocity*dimMass) ); if (hasCsys_) { - mesh_.objectRegistry::store + regIOobject::store ( newField("angularMomentum", dimVelocity*dimMass) ); @@ -466,7 +466,7 @@ bool Foam::functionObjects::momentum::read(const dictionary& dict) { Info<< " Angular velocity will be written" << endl; - mesh_.objectRegistry::store + regIOobject::store ( newField("angularVelocity", dimVelocity) ); diff --git a/src/functionObjects/field/momentumError/momentumError.C b/src/functionObjects/field/momentumError/momentumError.C index 6bbc1068fc..fa467510e3 100644 --- a/src/functionObjects/field/momentumError/momentumError.C +++ b/src/functionObjects/field/momentumError/momentumError.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -154,53 +154,54 @@ Foam::functionObjects::momentumError::momentumError phi.dimensions()*dimVelocity/dimVolume ); - - volVectorField* momentPtr = nullptr; - - word momName(scopedName("momentError")); - if (zoneSubSetPtr_) { const fvMesh& subMesh = zoneSubSetPtr_->subsetter().subMesh(); // momentErrorMap - momentPtr = new volVectorField + volVectorField* fldPtr = new volVectorField ( IOobject ( scopedName("momentErrorMap"), subMesh.time().timeName(), - subMesh, + subMesh.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER ), subMesh, - dimensionedVector(momDims) + dimensionedVector(momDims, Zero) ); - subMesh.objectRegistry::store(momentPtr); + regIOobject::store(fldPtr); - momName = scopedName("momentErrorZone"); } - momentPtr = new volVectorField + const word momName = + ( + zoneSubSetPtr_ + ? scopedName("momentErrorZone") + : scopedName("momentError") + ); + + volVectorField* fldPtr = new volVectorField ( IOobject ( momName, time_.timeName(), - mesh_, + mesh_.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER ), mesh_, - dimensionedVector(momDims) + dimensionedVector(momDims, Zero) ); - mesh_.objectRegistry::store(momentPtr); + regIOobject::store(fldPtr); } diff --git a/src/functionObjects/field/readFields/readFieldsTemplates.C b/src/functionObjects/field/readFields/readFieldsTemplates.C index 2ce668755f..5cf6018bdd 100644 --- a/src/functionObjects/field/readFields/readFieldsTemplates.C +++ b/src/functionObjects/field/readFields/readFieldsTemplates.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,7 +42,7 @@ bool Foam::functionObjects::readFields::loadAndStore(const IOobject& io) Log << " Reading " << io.name() << " (" << io.headerClassName() << ')' << endl; - mesh_.objectRegistry::store(new FieldType(io, mesh_)); + regIOobject::store(new FieldType(io, mesh_)); return true; } diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C index fb86bca1ef..ca01a013fa 100644 --- a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C +++ b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2022 OpenCFD Ltd. + Copyright (C) 2022-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -98,7 +98,7 @@ bool Foam::resolutionIndexModel::read(const dictionary& dict) ( resultName_, mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobject::LAZY_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -108,7 +108,7 @@ bool Foam::resolutionIndexModel::read(const dictionary& dict) fvPatchFieldBase::zeroGradientType() ); - mesh_.objectRegistry::store(indexPtr); + regIOobject::store(indexPtr); } return true; diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModelTemplates.C b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModelTemplates.C index cdbe29b3d6..641e9ce1ef 100644 --- a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModelTemplates.C +++ b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModelTemplates.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2022 OpenCFD Ltd. + Copyright (C) 2022-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -46,14 +46,14 @@ GeoFieldType& Foam::resolutionIndexModel::getOrReadField ( fieldName, mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobject::MUST_READ, IOobject::AUTO_WRITE, IOobject::REGISTER ), mesh_ ); - mesh_.objectRegistry::store(ptr); + regIOobject::store(ptr); } return *ptr; diff --git a/src/functionObjects/field/stabilityBlendingFactor/stabilityBlendingFactor.C b/src/functionObjects/field/stabilityBlendingFactor/stabilityBlendingFactor.C index ef07ad51de..134427f7ba 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-2023 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -65,7 +65,7 @@ Foam::functionObjects::stabilityBlendingFactor::indicator() ( "blendedIndicator" + fieldName_, time_.timeName(), - mesh_, + mesh_.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -75,7 +75,7 @@ Foam::functionObjects::stabilityBlendingFactor::indicator() fvPatchFieldBase::zeroGradientType() ); - mesh_.objectRegistry::store(fldPtr); + regIOobject::store(fldPtr); } return *fldPtr; @@ -558,7 +558,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor ( nonOrthogonalityName_, mesh_.time().constant(), - mesh_, + mesh_.thisDb(), IOobject::MUST_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -567,7 +567,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor if (fieldHeader.typeHeaderOk(true, true, false)) { auto* vfPtr = new volScalarField(fieldHeader, mesh_); - mesh_.objectRegistry::store(vfPtr); + regIOobject::store(vfPtr); } else { @@ -588,7 +588,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor ( faceWeightName_, mesh_.time().constant(), - mesh_, + mesh_.thisDb(), IOobject::MUST_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -597,7 +597,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor if (fieldHeader.typeHeaderOk(true, true, false)) { auto* vfPtr = new volScalarField(fieldHeader, mesh_); - mesh_.objectRegistry::store(vfPtr); + regIOobject::store(vfPtr); } else { @@ -616,7 +616,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor ( skewnessName_, mesh_.time().constant(), - mesh_, + mesh_.thisDb(), IOobject::MUST_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -625,7 +625,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor if (fieldHeader.typeHeaderOk(true, true, false)) { auto* vfPtr = new volScalarField(fieldHeader, mesh_); - mesh_.objectRegistry::store(vfPtr); + regIOobject::store(vfPtr); } else { diff --git a/src/functionObjects/field/surfaceDistance/surfaceDistance.C b/src/functionObjects/field/surfaceDistance/surfaceDistance.C index f7ad43ebc2..d3362a971d 100644 --- a/src/functionObjects/field/surfaceDistance/surfaceDistance.C +++ b/src/functionObjects/field/surfaceDistance/surfaceDistance.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2022 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -61,7 +61,7 @@ Foam::functionObjects::surfaceDistance::surfaceDistance ( "surfaceDistance", mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -71,7 +71,7 @@ Foam::functionObjects::surfaceDistance::surfaceDistance ) ); - mesh_.objectRegistry::store(distPtr); + regIOobject::store(distPtr); } diff --git a/src/functionObjects/field/wallHeatFlux/wallHeatFlux.C b/src/functionObjects/field/wallHeatFlux/wallHeatFlux.C index a97ed64ed0..3235b4cbc5 100644 --- a/src/functionObjects/field/wallHeatFlux/wallHeatFlux.C +++ b/src/functionObjects/field/wallHeatFlux/wallHeatFlux.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 OpenFOAM Foundation - Copyright (C) 2016-2023 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -120,7 +120,7 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux ( scopedName(typeName), mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobjectOption::NO_READ, IOobjectOption::NO_WRITE, IOobjectOption::REGISTER @@ -130,7 +130,7 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux ) ); - mesh_.objectRegistry::store(wallHeatFluxPtr); + regIOobject::store(wallHeatFluxPtr); } diff --git a/src/functionObjects/field/wallShearStress/wallShearStress.C b/src/functionObjects/field/wallShearStress/wallShearStress.C index 83ce52c202..6fd8853dcc 100644 --- a/src/functionObjects/field/wallShearStress/wallShearStress.C +++ b/src/functionObjects/field/wallShearStress/wallShearStress.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2017-2023 OpenCFD Ltd. + Copyright (C) 2017-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -104,7 +104,7 @@ Foam::functionObjects::wallShearStress::wallShearStress ( scopedName(typeName), mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobjectOption::NO_READ, IOobjectOption::NO_WRITE, IOobjectOption::REGISTER @@ -114,7 +114,7 @@ Foam::functionObjects::wallShearStress::wallShearStress ) ); - mesh_.objectRegistry::store(wallShearStressPtr); + regIOobject::store(wallShearStressPtr); } diff --git a/src/functionObjects/field/yPlus/yPlus.C b/src/functionObjects/field/yPlus/yPlus.C index b175a154bf..f9b5f3a3b5 100644 --- a/src/functionObjects/field/yPlus/yPlus.C +++ b/src/functionObjects/field/yPlus/yPlus.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2016-2023 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -86,7 +86,7 @@ Foam::functionObjects::yPlus::yPlus ( scopedName(typeName), mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -96,7 +96,7 @@ Foam::functionObjects::yPlus::yPlus ) ); - mesh_.objectRegistry::store(yPlusPtr); + regIOobject::store(yPlusPtr); } diff --git a/src/functionObjects/forces/forceCoeffs/forceCoeffs.C b/src/functionObjects/forces/forceCoeffs/forceCoeffs.C index b749dcf81b..bbad31544f 100644 --- a/src/functionObjects/forces/forceCoeffs/forceCoeffs.C +++ b/src/functionObjects/forces/forceCoeffs/forceCoeffs.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2023 OpenCFD Ltd. + Copyright (C) 2015-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -63,18 +63,17 @@ void Foam::functionObjects::forceCoeffs::initialise() Foam::volVectorField& Foam::functionObjects::forceCoeffs::forceCoeff() { - auto* coeffPtr = - mesh_.getObjectPtr(scopedName("forceCoeff")); + auto* ptr = mesh_.getObjectPtr(scopedName("forceCoeff")); - if (!coeffPtr) + if (!ptr) { - coeffPtr = new volVectorField + ptr = new volVectorField ( IOobject ( scopedName("forceCoeff"), time_.timeName(), - mesh_, + mesh_.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -83,27 +82,26 @@ Foam::volVectorField& Foam::functionObjects::forceCoeffs::forceCoeff() dimensionedVector(dimless, Zero) ); - mesh_.objectRegistry::store(coeffPtr); + regIOobject::store(ptr); } - return *coeffPtr; + return *ptr; } Foam::volVectorField& Foam::functionObjects::forceCoeffs::momentCoeff() { - auto* coeffPtr = - mesh_.getObjectPtr(scopedName("momentCoeff")); + auto* ptr = mesh_.getObjectPtr(scopedName("momentCoeff")); - if (!coeffPtr) + if (!ptr) { - coeffPtr = new volVectorField + ptr = new volVectorField ( IOobject ( scopedName("momentCoeff"), time_.timeName(), - mesh_, + mesh_.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -112,10 +110,10 @@ Foam::volVectorField& Foam::functionObjects::forceCoeffs::momentCoeff() dimensionedVector(dimless, Zero) ); - mesh_.objectRegistry::store(coeffPtr); + regIOobject::store(ptr); } - return *coeffPtr; + return *ptr; } diff --git a/src/functionObjects/forces/forces/forces.C b/src/functionObjects/forces/forces/forces.C index b5caaf7b3c..ac66678394 100644 --- a/src/functionObjects/forces/forces/forces.C +++ b/src/functionObjects/forces/forces/forces.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2023 OpenCFD Ltd. + Copyright (C) 2015-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -89,17 +89,17 @@ void Foam::functionObjects::forces::setCoordinateSystem Foam::volVectorField& Foam::functionObjects::forces::force() { - auto* forcePtr = mesh_.getObjectPtr(scopedName("force")); + auto* ptr = mesh_.getObjectPtr(scopedName("force")); - if (!forcePtr) + if (!ptr) { - forcePtr = new volVectorField + ptr = new volVectorField ( IOobject ( scopedName("force"), time_.timeName(), - mesh_, + mesh_.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -108,26 +108,26 @@ Foam::volVectorField& Foam::functionObjects::forces::force() dimensionedVector(dimForce, Zero) ); - mesh_.objectRegistry::store(forcePtr); + regIOobject::store(ptr); } - return *forcePtr; + return *ptr; } Foam::volVectorField& Foam::functionObjects::forces::moment() { - auto* momentPtr = mesh_.getObjectPtr(scopedName("moment")); + auto* ptr = mesh_.getObjectPtr(scopedName("moment")); - if (!momentPtr) + if (!ptr) { - momentPtr = new volVectorField + ptr = new volVectorField ( IOobject ( scopedName("moment"), time_.timeName(), - mesh_, + mesh_.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -136,10 +136,10 @@ Foam::volVectorField& Foam::functionObjects::forces::moment() dimensionedVector(dimForce*dimLength, Zero) ); - mesh_.objectRegistry::store(momentPtr); + regIOobject::store(ptr); } - return *momentPtr; + return *ptr; } diff --git a/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.C b/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.C index 9bc7e256f0..75c6f8509f 100644 --- a/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.C +++ b/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -197,7 +197,7 @@ Foam::functionObjects::hydrostaticPressure::hydrostaticPressure mesh_ ); - mesh_.objectRegistry::store(ph_rghPtr); + regIOobject::store(ph_rghPtr); bool reInitialise = dict.getOrDefault("reInitialise", false); diff --git a/src/functionObjects/solvers/electricPotential/electricPotential.C b/src/functionObjects/solvers/electricPotential/electricPotential.C index 6a83baee67..4b5dd5d855 100644 --- a/src/functionObjects/solvers/electricPotential/electricPotential.C +++ b/src/functionObjects/solvers/electricPotential/electricPotential.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021-2023 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,14 +59,14 @@ Foam::volScalarField& Foam::functionObjects::electricPotential::getOrReadField ( fieldName, mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobject::MUST_READ, IOobject::NO_WRITE, IOobject::REGISTER ), mesh_ ); - mesh_.objectRegistry::store(ptr); + regIOobject::store(ptr); } return *ptr; @@ -241,13 +241,14 @@ Foam::functionObjects::electricPotential::electricPotential ( Ename_, mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), -fvc::grad(eV) ); - mesh_.objectRegistry::store(ptr); + regIOobject::store(ptr); } } } diff --git a/src/fvOptions/constraints/general/mapFieldConstraint/MapFieldConstraint.C b/src/fvOptions/constraints/general/mapFieldConstraint/MapFieldConstraint.C index 1d18b8960b..5425dadb0a 100644 --- a/src/fvOptions/constraints/general/mapFieldConstraint/MapFieldConstraint.C +++ b/src/fvOptions/constraints/general/mapFieldConstraint/MapFieldConstraint.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2023 OpenCFD Ltd. + Copyright (C) 2023-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -157,14 +157,14 @@ VolFieldType& Foam::fv::MapFieldConstraint::getOrReadField ( fieldName, thisMesh.time().timeName(), - thisMesh, + thisMesh.thisDb(), IOobject::MUST_READ, IOobject::NO_WRITE, IOobject::REGISTER ), thisMesh ); - thisMesh.objectRegistry::store(ptr); + regIOobject::store(ptr); } return *ptr; diff --git a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C b/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C index f6f41c11a0..0fc3317c27 100644 --- a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C +++ b/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2021 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -61,7 +61,7 @@ Foam::fv::jouleHeatingSource::transformSigma ( sigmaName, mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::NO_REGISTER diff --git a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C b/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C index 95cb6a05b9..4eb7391caf 100644 --- a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C +++ b/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSourceTemplates.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -36,50 +36,48 @@ void Foam::fv::jouleHeatingSource::initialiseSigma { typedef GeometricField VolFieldType; + IOobject io + ( + typeName + ":sigma", + mesh_.time().timeName(), + mesh_.thisDb(), + IOobject::NO_READ, + IOobject::AUTO_WRITE, + IOobject::REGISTER + ); + + tmp tsigma; + if (dict.found("sigma")) { // Sigma to be defined using a Function1 type sigmaVsTPtr = Function1::New("sigma", dict, &mesh_); - auto tsigma = tmp::New + tsigma.reset ( - IOobject + new VolFieldType ( - typeName + ":sigma", - mesh_.time().timeName(), + io, mesh_, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh_, - dimensioned(sqr(dimCurrent)/dimPower/dimLength, Zero) + Foam::zero{}, // value + sqr(dimCurrent)/dimPower/dimLength + ) ); - mesh_.objectRegistry::store(tsigma.ptr()); - Info<< " Conductivity 'sigma' read from dictionary as f(T)" << nl << endl; } else { // Sigma to be defined by user input - auto tsigma = tmp::New - ( - IOobject - ( - typeName + ":sigma", - mesh_.time().timeName(), - mesh_, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh_ - ); + io.readOpt(IOobject::MUST_READ); - mesh_.objectRegistry::store(tsigma.ptr()); + tsigma.reset(new VolFieldType(io, mesh_)); Info<< " Conductivity 'sigma' read from file" << nl << endl; } + + regIOobject::store(tsigma); } @@ -110,7 +108,7 @@ Foam::fv::jouleHeatingSource::updateSigma // Boundary field - typename VolFieldType::Boundary& bf = sigma.boundaryFieldRef(); + auto& bf = sigma.boundaryFieldRef(); forAll(bf, patchi) { fvPatchField& pf = bf[patchi]; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Coulomb/CoulombForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Coulomb/CoulombForce.C index 36e4b0da60..97a9c55fc6 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Coulomb/CoulombForce.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Coulomb/CoulombForce.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2023 OpenCFD Ltd. + Copyright (C) 2023-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -46,13 +46,14 @@ Foam::volVectorField& Foam::CoulombForce::getOrReadField ( fieldName, this->mesh().time().timeName(), - this->mesh(), + this->mesh().thisDb(), IOobject::MUST_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), this->mesh() ); - this->mesh().objectRegistry::store(ptr); + regIOobject::store(ptr); } return *ptr; diff --git a/src/lumpedPointMotion/pointPatchFields/lumpedPointDisplacementPointPatchVectorField.C b/src/lumpedPointMotion/pointPatchFields/lumpedPointDisplacementPointPatchVectorField.C index 6a6814fc6f..b10fe98d72 100644 --- a/src/lumpedPointMotion/pointPatchFields/lumpedPointDisplacementPointPatchVectorField.C +++ b/src/lumpedPointMotion/pointPatchFields/lumpedPointDisplacementPointPatchVectorField.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -191,7 +191,7 @@ Foam::lumpedPointDisplacementPointPatchVectorField::movement() const // Create and register with this patch as the owner ptr = lumpedPointIOMovement::New(obr, this->patch().index()).ptr(); - objectRegistry::store(ptr); + regIOobject::store(ptr); } return *ptr; diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseTemplates.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseTemplates.C index 924afa2b5a..7b6ce7e3ca 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseTemplates.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseTemplates.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2023 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -300,7 +300,7 @@ bool Foam::mappedPatchBase::constructIOField ), Foam::zero{} ); - objectRegistry::store(fldPtr); + regIOobject::store(fldPtr); } fldPtr->transfer @@ -340,7 +340,7 @@ void Foam::mappedPatchBase::storeField ), Foam::zero{} ); - objectRegistry::store(fldPtr); + regIOobject::store(fldPtr); } *fldPtr = values; diff --git a/src/meshTools/matrices/lduMatrix/preconditioners/distributedDILUPreconditioner/processorColour.C b/src/meshTools/matrices/lduMatrix/preconditioners/distributedDILUPreconditioner/processorColour.C index 92298e2091..b655785b1d 100644 --- a/src/meshTools/matrices/lduMatrix/preconditioners/distributedDILUPreconditioner/processorColour.C +++ b/src/meshTools/matrices/lduMatrix/preconditioners/distributedDILUPreconditioner/processorColour.C @@ -340,23 +340,21 @@ Foam::processorColour::processorColour(const lduMesh& mesh) const Foam::processorColour& Foam::processorColour::New(const lduMesh& mesh) { - const processorColour* ptr = - mesh.thisDb().objectRegistry::template cfindObject + auto* ptr = + mesh.thisDb().objectRegistry::template getObjectPtr ( processorColour::typeName ); - if (ptr) + if (!ptr) { - return *ptr; + ptr = new processorColour(mesh); + + //regIOobject::store(static_cast*>(ptr)); + regIOobject::store(ptr); } - processorColour* objectPtr = new processorColour(mesh); - - //regIOobject::store(static_cast*>(objectPtr)); - regIOobject::store(objectPtr); - - return *objectPtr; + return *ptr; } diff --git a/src/regionModels/surfaceFilmModels/functionObjects/filmFlux/filmFlux.C b/src/regionModels/surfaceFilmModels/functionObjects/filmFlux/filmFlux.C index 305c579bf8..a69a586167 100644 --- a/src/regionModels/surfaceFilmModels/functionObjects/filmFlux/filmFlux.C +++ b/src/regionModels/surfaceFilmModels/functionObjects/filmFlux/filmFlux.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -99,7 +99,7 @@ bool Foam::functionObjects::filmFlux::execute() ( resultName_, time_.timeName(), - filmMesh, + filmMesh.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -108,7 +108,7 @@ bool Foam::functionObjects::filmFlux::execute() dimensionedScalar(dimMass/dimTime, Zero) ); - filmMesh.objectRegistry::store(resultPtr); + regIOobject::store(resultPtr); } auto& result = *resultPtr; @@ -123,7 +123,7 @@ bool Foam::functionObjects::filmFlux::execute() ( "height", time_.timeName(), - filmMesh, + filmMesh.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::NO_REGISTER @@ -133,7 +133,7 @@ bool Foam::functionObjects::filmFlux::execute() fvPatchFieldBase::zeroGradientType() ); - auto& heightc = height.ref(); + auto& heightc = height.internalFieldRef(); heightc = max(dimensionedScalar("eps", dimLength, ROOTVSMALL), vol/magSf()); height.correctBoundaryConditions(); diff --git a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C index 2c10c551c8..0471bdd398 100644 --- a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2017-2023 OpenCFD Ltd. + Copyright (C) 2017-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -62,14 +62,15 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField::getOrCreateField ( fieldName, mesh.time().timeName(), - mesh, + mesh.thisDb(), IOobject::NO_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh, dimensionedScalar(dimless, Zero) ); - mesh.objectRegistry::store(ptr); + regIOobject::store(ptr); } return *ptr; diff --git a/src/thermophysicalModels/chemistryModel/functionObjects/BilgerMixtureFraction/BilgerMixtureFraction.C b/src/thermophysicalModels/chemistryModel/functionObjects/BilgerMixtureFraction/BilgerMixtureFraction.C index 3deae52445..038a33451f 100644 --- a/src/thermophysicalModels/chemistryModel/functionObjects/BilgerMixtureFraction/BilgerMixtureFraction.C +++ b/src/thermophysicalModels/chemistryModel/functionObjects/BilgerMixtureFraction/BilgerMixtureFraction.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2020 Thorsten Zirwes - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -68,7 +68,7 @@ void Foam::functionObjects::BilgerMixtureFraction::calcBilgerMixtureFraction() ( resultName_, mesh_.time().timeName(), - mesh_, + mesh_.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE, IOobject::REGISTER @@ -76,7 +76,7 @@ void Foam::functionObjects::BilgerMixtureFraction::calcBilgerMixtureFraction() mesh_, dimensionedScalar(dimless, Zero) ); - mesh_.objectRegistry::store(resultPtr); + regIOobject::store(resultPtr); } auto& f_Bilger = *resultPtr;