STYLE: use static call for regIOobject::store (#1507)

This commit is contained in:
Mark Olesen
2024-01-04 12:03:21 +01:00
parent 87eed74e42
commit ac574a6ccb
44 changed files with 227 additions and 225 deletions

View File

@ -10,7 +10,8 @@ if (pimple.dict().getOrDefault("hydrostaticInitialization", false))
"0", "0",
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE,
IOobject::REGISTER
), ),
mesh mesh
) )

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021-2022 OpenCFD Ltd. Copyright (C) 2021-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -71,7 +71,7 @@ class readFieldsHandler
Log << " Reading " << io.name() Log << " Reading " << io.name()
<< " (" << FieldType::typeName << ')' << endl; << " (" << FieldType::typeName << ')' << endl;
mesh_.objectRegistry::store(new FieldType(io, mesh_)); regIOobject::store(new FieldType(io, mesh_));
return true; return true;
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd. Copyright (C) 2022-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -71,7 +71,7 @@ class readFieldsHandler
Log << " Reading " << io.name() Log << " Reading " << io.name()
<< " (" << FieldType::typeName << ')' << endl; << " (" << FieldType::typeName << ')' << endl;
mesh_.objectRegistry::store(new FieldType(io, mesh_)); regIOobject::store(new FieldType(io, mesh_));
return true; return true;
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021-2022 OpenCFD Ltd. Copyright (C) 2021-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -71,7 +71,7 @@ class readFieldsHandler
Log << " Reading " << io.name() Log << " Reading " << io.name()
<< " (" << FieldType::typeName << ')' << endl; << " (" << FieldType::typeName << ')' << endl;
mesh_.objectRegistry::store(new FieldType(io, mesh_)); regIOobject::store(new FieldType(io, mesh_));
return true; return true;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd. Copyright (C) 2016-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -139,7 +139,7 @@ bool Foam::functionObjects::regionFunctionObject::store
} }
else else
{ {
obr().objectRegistry::store(tfield.ptr()); regIOobject::store(tfield.ptr());
} }
} }
else else
@ -153,7 +153,7 @@ bool Foam::functionObjects::regionFunctionObject::store
fieldName = tfield().name(); fieldName = tfield().name();
} }
obr().objectRegistry::store(tfield.ptr()); regIOobject::store(tfield.ptr());
} }
return true; return true;
@ -179,8 +179,11 @@ bool Foam::functionObjects::regionFunctionObject::storeInDb
} }
else else
{ {
tfield.ref().rename(fieldName); if (fieldName.size() && fieldName != tfield().name())
obr.objectRegistry::store(tfield.ptr()); {
tfield.ref().rename(fieldName);
}
regIOobject::store(tfield.ptr());
} }
return true; return true;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2023 OpenCFD Ltd. Copyright (C) 2019-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -348,7 +348,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
{ {
agglomPtr().printLevels(); agglomPtr().printLevels();
} }
return store(agglomPtr.ptr()); return regIOobject::store(agglomPtr);
} }
} }
@ -398,7 +398,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
{ {
agglomPtr().printLevels(); agglomPtr().printLevels();
} }
return store(agglomPtr.ptr()); return regIOobject::store(agglomPtr);
} }
} }
} }
@ -463,7 +463,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
{ {
agglomPtr().printLevels(); agglomPtr().printLevels();
} }
return store(agglomPtr.ptr()); return regIOobject::store(agglomPtr);
} }
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd. Copyright (C) 2015-2024 OpenCFD Ltd.
Copyright (C) 2022 Upstream CFD GmbH Copyright (C) 2022 Upstream CFD GmbH
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -301,7 +301,7 @@ class DEShybrid
( (
factorName, factorName,
mesh.time().timeName(), mesh.time().timeName(),
mesh, mesh.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -321,7 +321,7 @@ class DEShybrid
dimensionedScalar(dimless, Zero) dimensionedScalar(dimless, Zero)
); );
const_cast<fvMesh&>(mesh).objectRegistry::store(factorPtr); regIOobject::store(factorPtr);
} }
auto& factor = *factorPtr; auto& factor = *factorPtr;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 ENERCON GmbH Copyright (C) 2020 ENERCON GmbH
Copyright (C) 2020-2021 OpenCFD Ltd. Copyright (C) 2020-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -58,14 +58,14 @@ Foam::volScalarField& Foam::fv::atmPlantCanopyTurbSource::getOrReadField
( (
fieldName, fieldName,
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE, IOobject::AUTO_WRITE,
IOobject::REGISTER IOobject::REGISTER
), ),
mesh_ mesh_
); );
mesh_.objectRegistry::store(ptr); regIOobject::store(ptr);
} }
return *ptr; return *ptr;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 ENERCON GmbH Copyright (C) 2020 ENERCON GmbH
Copyright (C) 2020-2022 OpenCFD Ltd. Copyright (C) 2020-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -59,14 +59,14 @@ Foam::volScalarField& Foam::fv::atmPlantCanopyUSource::getOrReadField
( (
fieldName, fieldName,
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE, IOobject::AUTO_WRITE,
IOobject::REGISTER IOobject::REGISTER
), ),
mesh_ mesh_
); );
mesh_.objectRegistry::store(ptr); regIOobject::store(ptr);
} }
return *ptr; return *ptr;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2023 OpenCFD Ltd. Copyright (C) 2019-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -40,50 +40,48 @@ void Foam::fa::jouleHeatingSource::initialiseSigma
auto& obr = regionMesh().thisDb(); auto& obr = regionMesh().thisDb();
IOobject io
(
typeName + ":sigma_" + regionName_,
obr.time().timeName(),
obr,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
IOobject::REGISTER
);
tmp<AreaFieldType> tsigma;
if (dict.found("sigma")) if (dict.found("sigma"))
{ {
// Sigma to be defined using a Function1 type // Sigma to be defined using a Function1 type
sigmaVsTPtr = Function1<Type>::New("sigma", dict, &mesh_); sigmaVsTPtr = Function1<Type>::New("sigma", dict, &mesh_);
auto tsigma = tmp<AreaFieldType>::New tsigma.reset
( (
IOobject new AreaFieldType
( (
typeName + ":sigma_" + regionName_, io,
obr.time().timeName(), regionMesh(),
obr, Foam::zero{}, // value
IOobject::NO_READ, sqr(dimCurrent)/dimPower/dimLength
IOobject::AUTO_WRITE )
),
regionMesh(),
dimensioned<Type>(sqr(dimCurrent)/dimPower/dimLength, Zero)
); );
regIOobject::store(tsigma.ptr());
Info<< " Conductivity 'sigma' read from dictionary as f(T)" Info<< " Conductivity 'sigma' read from dictionary as f(T)"
<< nl << endl; << nl << endl;
} }
else else
{ {
// Sigma to be defined by user input // Sigma to be defined by user input
auto tsigma = tmp<AreaFieldType>::New io.readOpt(IOobject::MUST_READ);
(
IOobject
(
typeName + ":sigma_" + regionName_,
obr.time().timeName(),
obr,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
regionMesh()
);
regIOobject::store(tsigma.ptr()); tsigma.reset(new AreaFieldType(io, regionMesh()));
Info<< " Conductivity 'sigma' read from file" << nl << endl; Info<< " Conductivity 'sigma' read from file" << nl << endl;
} }
regIOobject::store(tsigma);
} }
@ -117,11 +115,11 @@ Foam::fa::jouleHeatingSource::updateSigma
// Boundary field // Boundary field
typename AreaFieldType::Boundary& bf = sigma.boundaryFieldRef(); auto& bf = sigma.boundaryFieldRef();
forAll(bf, patchi) forAll(bf, patchi)
{ {
faPatchField<Type>& pf = bf[patchi]; faPatchField<Type>& pf = bf[patchi];
if (!isA<emptyFaPatch>(bf[patchi])) if (!isA<emptyFaPatch>(pf))
{ {
const scalarField& Tbf = T.boundaryField()[patchi]; const scalarField& Tbf = T.boundaryField()[patchi];
forAll(pf, facei) forAll(pf, facei)

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -102,7 +102,7 @@ Foam::fv::options::options
Foam::fv::options& Foam::fv::options::New(const fvMesh& mesh) Foam::fv::options& Foam::fv::options::New(const fvMesh& mesh)
{ {
options* ptr = mesh.thisDb().getObjectPtr<options>(typeName); auto* ptr = mesh.thisDb().getObjectPtr<options>(typeName);
if (!ptr) if (!ptr)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -161,7 +161,7 @@ Foam::LimitedScheme<Type, Limiter, LimitFunc>::limiter
( (
limiterFieldName, limiterFieldName,
mesh.time().timeName(), mesh.time().timeName(),
mesh, mesh.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -170,7 +170,7 @@ Foam::LimitedScheme<Type, Limiter, LimitFunc>::limiter
dimless dimless
); );
mesh.objectRegistry::store(fldptr); regIOobject::store(fldptr);
} }
auto& limiterField = *fldptr; auto& limiterField = *fldptr;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd. Copyright (C) 2016-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -570,8 +570,8 @@ Foam::volPointInterpolation::interpolate
if (!pfPtr) if (!pfPtr)
{ {
solution::cachePrintMessage("Calculating and caching", name, vf); solution::cachePrintMessage("Calculating and caching", name, vf);
pfPtr = interpolate(vf, name, false).ptr();
pfPtr = interpolate(vf, name, false).ptr();
regIOobject::store(pfPtr); regIOobject::store(pfPtr);
} }
else else

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -88,7 +88,7 @@ bool Foam::functionObjects::CourantNo::calc()
( (
resultName_, resultName_,
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -97,7 +97,7 @@ bool Foam::functionObjects::CourantNo::calc()
dimensionedScalar(dimless, Zero), dimensionedScalar(dimless, Zero),
fvPatchFieldBase::zeroGradientType() fvPatchFieldBase::zeroGradientType()
); );
mesh_.objectRegistry::store(resultPtr); regIOobject::store(resultPtr);
} }
auto& Co = *resultPtr; auto& Co = *resultPtr;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -57,14 +57,14 @@ bool Foam::functionObjects::columnAverage::columnAverageField
( (
resultName, resultName,
fld.mesh().time().timeName(), fld.mesh().time().timeName(),
fld.mesh(), fld.db(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
), ),
fld fld
); );
obr_.objectRegistry::store(resPtr); regIOobject::store(resPtr);
} }
fieldType& res = *resPtr; fieldType& res = *resPtr;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021-2022 OpenCFD Ltd. Copyright (C) 2021-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -137,7 +137,7 @@ bool Foam::functionObjects::fvExpressionField::loadAndStore(const IOobject& io)
Log << " Reading " << io.name() Log << " Reading " << io.name()
<< " (" << FieldType::typeName << ')' << endl; << " (" << FieldType::typeName << ')' << endl;
mesh_.objectRegistry::store(new FieldType(io, mesh_)); regIOobject::store(new FieldType(io, mesh_));
return true; return true;
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2022 OpenCFD Ltd. Copyright (C) 2017-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -71,6 +71,7 @@ Foam::functionObjects::heatTransferCoeff::heatTransferCoeff
{ {
read(dict); read(dict);
// scopedName?
setResultName(typeName, "htc:" + htcModelPtr_->type()); setResultName(typeName, "htc:" + htcModelPtr_->type());
auto* heatTransferCoeffPtr = auto* heatTransferCoeffPtr =
@ -80,7 +81,7 @@ Foam::functionObjects::heatTransferCoeff::heatTransferCoeff
( (
resultName_, resultName_,
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -89,7 +90,7 @@ Foam::functionObjects::heatTransferCoeff::heatTransferCoeff
dimensionedScalar(dimPower/dimArea/dimTemperature, Zero) dimensionedScalar(dimPower/dimArea/dimTemperature, Zero)
); );
mesh_.objectRegistry::store(heatTransferCoeffPtr); regIOobject::store(heatTransferCoeffPtr);
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2022-2023 OpenCFD Ltd. Copyright (C) 2022-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -127,6 +127,7 @@ Foam::functionObjects::multiphaseInterHtcModel::multiphaseInterHtcModel
{ {
read(dict); read(dict);
// scopedName?
setResultName(typeName, "htc:" + htcModelPtr_->type()); setResultName(typeName, "htc:" + htcModelPtr_->type());
auto* htcPtr = auto* htcPtr =
@ -136,7 +137,7 @@ Foam::functionObjects::multiphaseInterHtcModel::multiphaseInterHtcModel
( (
resultName_, resultName_,
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -145,7 +146,7 @@ Foam::functionObjects::multiphaseInterHtcModel::multiphaseInterHtcModel
dimensionedScalar(dimPower/dimArea/dimTemperature, Zero) dimensionedScalar(dimPower/dimArea/dimTemperature, Zero)
); );
mesh_.objectRegistry::store(htcPtr); regIOobject::store(htcPtr);
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020-2022 OpenCFD Ltd. Copyright (C) 2020-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -145,7 +145,7 @@ Foam::functionObjects::reactingEulerHtcModel::reactingEulerHtcModel
( (
resultName_, resultName_,
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -154,7 +154,7 @@ Foam::functionObjects::reactingEulerHtcModel::reactingEulerHtcModel
dimensionedScalar(dimPower/dimArea/dimTemperature, Zero) dimensionedScalar(dimPower/dimArea/dimTemperature, Zero)
); );
mesh_.objectRegistry::store(htcPtr); regIOobject::store(htcPtr);
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd. Copyright (C) 2022-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -66,14 +66,14 @@ Foam::volScalarField& Foam::histogramModel::getOrReadField
( (
fieldName, fieldName,
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE, IOobject::AUTO_WRITE,
IOobject::REGISTER IOobject::REGISTER
), ),
mesh_ mesh_
); );
mesh_.objectRegistry::store(ptr); regIOobject::store(ptr);
} }
return *ptr; return *ptr;

View File

@ -446,14 +446,14 @@ bool Foam::functionObjects::momentum::read(const dictionary& dict)
{ {
Info<< " Momentum fields will be written" << endl; Info<< " Momentum fields will be written" << endl;
mesh_.objectRegistry::store regIOobject::store
( (
newField<volVectorField>("momentum", dimVelocity*dimMass) newField<volVectorField>("momentum", dimVelocity*dimMass)
); );
if (hasCsys_) if (hasCsys_)
{ {
mesh_.objectRegistry::store regIOobject::store
( (
newField<volVectorField>("angularMomentum", dimVelocity*dimMass) newField<volVectorField>("angularMomentum", dimVelocity*dimMass)
); );
@ -466,7 +466,7 @@ bool Foam::functionObjects::momentum::read(const dictionary& dict)
{ {
Info<< " Angular velocity will be written" << endl; Info<< " Angular velocity will be written" << endl;
mesh_.objectRegistry::store regIOobject::store
( (
newField<volVectorField>("angularVelocity", dimVelocity) newField<volVectorField>("angularVelocity", dimVelocity)
); );

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020-2021 OpenCFD Ltd. Copyright (C) 2020-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -154,53 +154,54 @@ Foam::functionObjects::momentumError::momentumError
phi.dimensions()*dimVelocity/dimVolume phi.dimensions()*dimVelocity/dimVolume
); );
volVectorField* momentPtr = nullptr;
word momName(scopedName("momentError"));
if (zoneSubSetPtr_) if (zoneSubSetPtr_)
{ {
const fvMesh& subMesh = zoneSubSetPtr_->subsetter().subMesh(); const fvMesh& subMesh = zoneSubSetPtr_->subsetter().subMesh();
// momentErrorMap // momentErrorMap
momentPtr = new volVectorField volVectorField* fldPtr = new volVectorField
( (
IOobject IOobject
( (
scopedName("momentErrorMap"), scopedName("momentErrorMap"),
subMesh.time().timeName(), subMesh.time().timeName(),
subMesh, subMesh.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
), ),
subMesh, 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 IOobject
( (
momName, momName,
time_.timeName(), time_.timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
), ),
mesh_, mesh_,
dimensionedVector(momDims) dimensionedVector(momDims, Zero)
); );
mesh_.objectRegistry::store(momentPtr); regIOobject::store(fldPtr);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015-2020 OpenCFD Ltd. Copyright (C) 2015-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -42,7 +42,7 @@ bool Foam::functionObjects::readFields::loadAndStore(const IOobject& io)
Log << " Reading " << io.name() Log << " Reading " << io.name()
<< " (" << io.headerClassName() << ')' << endl; << " (" << io.headerClassName() << ')' << endl;
mesh_.objectRegistry::store(new FieldType(io, mesh_)); regIOobject::store(new FieldType(io, mesh_));
return true; return true;
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd. Copyright (C) 2022-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -98,7 +98,7 @@ bool Foam::resolutionIndexModel::read(const dictionary& dict)
( (
resultName_, resultName_,
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobject::LAZY_READ, IOobject::LAZY_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -108,7 +108,7 @@ bool Foam::resolutionIndexModel::read(const dictionary& dict)
fvPatchFieldBase::zeroGradientType() fvPatchFieldBase::zeroGradientType()
); );
mesh_.objectRegistry::store(indexPtr); regIOobject::store(indexPtr);
} }
return true; return true;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd. Copyright (C) 2022-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -46,14 +46,14 @@ GeoFieldType& Foam::resolutionIndexModel::getOrReadField
( (
fieldName, fieldName,
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE, IOobject::AUTO_WRITE,
IOobject::REGISTER IOobject::REGISTER
), ),
mesh_ mesh_
); );
mesh_.objectRegistry::store(ptr); regIOobject::store(ptr);
} }
return *ptr; return *ptr;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2023 OpenCFD Ltd. Copyright (C) 2018-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -65,7 +65,7 @@ Foam::functionObjects::stabilityBlendingFactor::indicator()
( (
"blendedIndicator" + fieldName_, "blendedIndicator" + fieldName_,
time_.timeName(), time_.timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -75,7 +75,7 @@ Foam::functionObjects::stabilityBlendingFactor::indicator()
fvPatchFieldBase::zeroGradientType() fvPatchFieldBase::zeroGradientType()
); );
mesh_.objectRegistry::store(fldPtr); regIOobject::store(fldPtr);
} }
return *fldPtr; return *fldPtr;
@ -558,7 +558,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
( (
nonOrthogonalityName_, nonOrthogonalityName_,
mesh_.time().constant(), mesh_.time().constant(),
mesh_, mesh_.thisDb(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -567,7 +567,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
if (fieldHeader.typeHeaderOk<volScalarField>(true, true, false)) if (fieldHeader.typeHeaderOk<volScalarField>(true, true, false))
{ {
auto* vfPtr = new volScalarField(fieldHeader, mesh_); auto* vfPtr = new volScalarField(fieldHeader, mesh_);
mesh_.objectRegistry::store(vfPtr); regIOobject::store(vfPtr);
} }
else else
{ {
@ -588,7 +588,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
( (
faceWeightName_, faceWeightName_,
mesh_.time().constant(), mesh_.time().constant(),
mesh_, mesh_.thisDb(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -597,7 +597,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
if (fieldHeader.typeHeaderOk<volScalarField>(true, true, false)) if (fieldHeader.typeHeaderOk<volScalarField>(true, true, false))
{ {
auto* vfPtr = new volScalarField(fieldHeader, mesh_); auto* vfPtr = new volScalarField(fieldHeader, mesh_);
mesh_.objectRegistry::store(vfPtr); regIOobject::store(vfPtr);
} }
else else
{ {
@ -616,7 +616,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
( (
skewnessName_, skewnessName_,
mesh_.time().constant(), mesh_.time().constant(),
mesh_, mesh_.thisDb(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -625,7 +625,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
if (fieldHeader.typeHeaderOk<volScalarField>(true, true, false)) if (fieldHeader.typeHeaderOk<volScalarField>(true, true, false))
{ {
auto* vfPtr = new volScalarField(fieldHeader, mesh_); auto* vfPtr = new volScalarField(fieldHeader, mesh_);
mesh_.objectRegistry::store(vfPtr); regIOobject::store(vfPtr);
} }
else else
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2022 OpenCFD Ltd. Copyright (C) 2019-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -61,7 +61,7 @@ Foam::functionObjects::surfaceDistance::surfaceDistance
( (
"surfaceDistance", "surfaceDistance",
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -71,7 +71,7 @@ Foam::functionObjects::surfaceDistance::surfaceDistance
) )
); );
mesh_.objectRegistry::store(distPtr); regIOobject::store(distPtr);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 OpenFOAM Foundation Copyright (C) 2016-2017 OpenFOAM Foundation
Copyright (C) 2016-2023 OpenCFD Ltd. Copyright (C) 2016-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -120,7 +120,7 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
( (
scopedName(typeName), scopedName(typeName),
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobjectOption::NO_READ, IOobjectOption::NO_READ,
IOobjectOption::NO_WRITE, IOobjectOption::NO_WRITE,
IOobjectOption::REGISTER IOobjectOption::REGISTER
@ -130,7 +130,7 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
) )
); );
mesh_.objectRegistry::store(wallHeatFluxPtr); regIOobject::store(wallHeatFluxPtr);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2017-2023 OpenCFD Ltd. Copyright (C) 2017-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -104,7 +104,7 @@ Foam::functionObjects::wallShearStress::wallShearStress
( (
scopedName(typeName), scopedName(typeName),
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobjectOption::NO_READ, IOobjectOption::NO_READ,
IOobjectOption::NO_WRITE, IOobjectOption::NO_WRITE,
IOobjectOption::REGISTER IOobjectOption::REGISTER
@ -114,7 +114,7 @@ Foam::functionObjects::wallShearStress::wallShearStress
) )
); );
mesh_.objectRegistry::store(wallShearStressPtr); regIOobject::store(wallShearStressPtr);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2016-2023 OpenCFD Ltd. Copyright (C) 2016-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -86,7 +86,7 @@ Foam::functionObjects::yPlus::yPlus
( (
scopedName(typeName), scopedName(typeName),
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -96,7 +96,7 @@ Foam::functionObjects::yPlus::yPlus
) )
); );
mesh_.objectRegistry::store(yPlusPtr); regIOobject::store(yPlusPtr);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015-2023 OpenCFD Ltd. Copyright (C) 2015-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -63,18 +63,17 @@ void Foam::functionObjects::forceCoeffs::initialise()
Foam::volVectorField& Foam::functionObjects::forceCoeffs::forceCoeff() Foam::volVectorField& Foam::functionObjects::forceCoeffs::forceCoeff()
{ {
auto* coeffPtr = auto* ptr = mesh_.getObjectPtr<volVectorField>(scopedName("forceCoeff"));
mesh_.getObjectPtr<volVectorField>(scopedName("forceCoeff"));
if (!coeffPtr) if (!ptr)
{ {
coeffPtr = new volVectorField ptr = new volVectorField
( (
IOobject IOobject
( (
scopedName("forceCoeff"), scopedName("forceCoeff"),
time_.timeName(), time_.timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -83,27 +82,26 @@ Foam::volVectorField& Foam::functionObjects::forceCoeffs::forceCoeff()
dimensionedVector(dimless, Zero) dimensionedVector(dimless, Zero)
); );
mesh_.objectRegistry::store(coeffPtr); regIOobject::store(ptr);
} }
return *coeffPtr; return *ptr;
} }
Foam::volVectorField& Foam::functionObjects::forceCoeffs::momentCoeff() Foam::volVectorField& Foam::functionObjects::forceCoeffs::momentCoeff()
{ {
auto* coeffPtr = auto* ptr = mesh_.getObjectPtr<volVectorField>(scopedName("momentCoeff"));
mesh_.getObjectPtr<volVectorField>(scopedName("momentCoeff"));
if (!coeffPtr) if (!ptr)
{ {
coeffPtr = new volVectorField ptr = new volVectorField
( (
IOobject IOobject
( (
scopedName("momentCoeff"), scopedName("momentCoeff"),
time_.timeName(), time_.timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -112,10 +110,10 @@ Foam::volVectorField& Foam::functionObjects::forceCoeffs::momentCoeff()
dimensionedVector(dimless, Zero) dimensionedVector(dimless, Zero)
); );
mesh_.objectRegistry::store(coeffPtr); regIOobject::store(ptr);
} }
return *coeffPtr; return *ptr;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015-2023 OpenCFD Ltd. Copyright (C) 2015-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -89,17 +89,17 @@ void Foam::functionObjects::forces::setCoordinateSystem
Foam::volVectorField& Foam::functionObjects::forces::force() Foam::volVectorField& Foam::functionObjects::forces::force()
{ {
auto* forcePtr = mesh_.getObjectPtr<volVectorField>(scopedName("force")); auto* ptr = mesh_.getObjectPtr<volVectorField>(scopedName("force"));
if (!forcePtr) if (!ptr)
{ {
forcePtr = new volVectorField ptr = new volVectorField
( (
IOobject IOobject
( (
scopedName("force"), scopedName("force"),
time_.timeName(), time_.timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -108,26 +108,26 @@ Foam::volVectorField& Foam::functionObjects::forces::force()
dimensionedVector(dimForce, Zero) dimensionedVector(dimForce, Zero)
); );
mesh_.objectRegistry::store(forcePtr); regIOobject::store(ptr);
} }
return *forcePtr; return *ptr;
} }
Foam::volVectorField& Foam::functionObjects::forces::moment() Foam::volVectorField& Foam::functionObjects::forces::moment()
{ {
auto* momentPtr = mesh_.getObjectPtr<volVectorField>(scopedName("moment")); auto* ptr = mesh_.getObjectPtr<volVectorField>(scopedName("moment"));
if (!momentPtr) if (!ptr)
{ {
momentPtr = new volVectorField ptr = new volVectorField
( (
IOobject IOobject
( (
scopedName("moment"), scopedName("moment"),
time_.timeName(), time_.timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -136,10 +136,10 @@ Foam::volVectorField& Foam::functionObjects::forces::moment()
dimensionedVector(dimForce*dimLength, Zero) dimensionedVector(dimForce*dimLength, Zero)
); );
mesh_.objectRegistry::store(momentPtr); regIOobject::store(ptr);
} }
return *momentPtr; return *ptr;
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -197,7 +197,7 @@ Foam::functionObjects::hydrostaticPressure::hydrostaticPressure
mesh_ mesh_
); );
mesh_.objectRegistry::store(ph_rghPtr); regIOobject::store(ph_rghPtr);
bool reInitialise = dict.getOrDefault("reInitialise", false); bool reInitialise = dict.getOrDefault("reInitialise", false);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021-2023 OpenCFD Ltd. Copyright (C) 2021-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -59,14 +59,14 @@ Foam::volScalarField& Foam::functionObjects::electricPotential::getOrReadField
( (
fieldName, fieldName,
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
), ),
mesh_ mesh_
); );
mesh_.objectRegistry::store(ptr); regIOobject::store(ptr);
} }
return *ptr; return *ptr;
@ -241,13 +241,14 @@ Foam::functionObjects::electricPotential::electricPotential
( (
Ename_, Ename_,
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE,
IOobject::REGISTER
), ),
-fvc::grad(eV) -fvc::grad(eV)
); );
mesh_.objectRegistry::store(ptr); regIOobject::store(ptr);
} }
} }
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd. Copyright (C) 2023-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -157,14 +157,14 @@ VolFieldType& Foam::fv::MapFieldConstraint<Type>::getOrReadField
( (
fieldName, fieldName,
thisMesh.time().timeName(), thisMesh.time().timeName(),
thisMesh, thisMesh.thisDb(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
), ),
thisMesh thisMesh
); );
thisMesh.objectRegistry::store(ptr); regIOobject::store(ptr);
} }
return *ptr; return *ptr;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2021 OpenCFD Ltd. Copyright (C) 2016-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -61,7 +61,7 @@ Foam::fv::jouleHeatingSource::transformSigma
( (
sigmaName, sigmaName,
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER IOobject::NO_REGISTER

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2020 OpenCFD Ltd. Copyright (C) 2016-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -36,50 +36,48 @@ void Foam::fv::jouleHeatingSource::initialiseSigma
{ {
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType; typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
IOobject io
(
typeName + ":sigma",
mesh_.time().timeName(),
mesh_.thisDb(),
IOobject::NO_READ,
IOobject::AUTO_WRITE,
IOobject::REGISTER
);
tmp<VolFieldType> tsigma;
if (dict.found("sigma")) if (dict.found("sigma"))
{ {
// Sigma to be defined using a Function1 type // Sigma to be defined using a Function1 type
sigmaVsTPtr = Function1<Type>::New("sigma", dict, &mesh_); sigmaVsTPtr = Function1<Type>::New("sigma", dict, &mesh_);
auto tsigma = tmp<VolFieldType>::New tsigma.reset
( (
IOobject new VolFieldType
( (
typeName + ":sigma", io,
mesh_.time().timeName(),
mesh_, mesh_,
IOobject::NO_READ, Foam::zero{}, // value
IOobject::AUTO_WRITE sqr(dimCurrent)/dimPower/dimLength
), )
mesh_,
dimensioned<Type>(sqr(dimCurrent)/dimPower/dimLength, Zero)
); );
mesh_.objectRegistry::store(tsigma.ptr());
Info<< " Conductivity 'sigma' read from dictionary as f(T)" Info<< " Conductivity 'sigma' read from dictionary as f(T)"
<< nl << endl; << nl << endl;
} }
else else
{ {
// Sigma to be defined by user input // Sigma to be defined by user input
auto tsigma = tmp<VolFieldType>::New io.readOpt(IOobject::MUST_READ);
(
IOobject
(
typeName + ":sigma",
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
);
mesh_.objectRegistry::store(tsigma.ptr()); tsigma.reset(new VolFieldType(io, mesh_));
Info<< " Conductivity 'sigma' read from file" << nl << endl; Info<< " Conductivity 'sigma' read from file" << nl << endl;
} }
regIOobject::store(tsigma);
} }
@ -110,7 +108,7 @@ Foam::fv::jouleHeatingSource::updateSigma
// Boundary field // Boundary field
typename VolFieldType::Boundary& bf = sigma.boundaryFieldRef(); auto& bf = sigma.boundaryFieldRef();
forAll(bf, patchi) forAll(bf, patchi)
{ {
fvPatchField<Type>& pf = bf[patchi]; fvPatchField<Type>& pf = bf[patchi];

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd. Copyright (C) 2023-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -46,13 +46,14 @@ Foam::volVectorField& Foam::CoulombForce<CloudType>::getOrReadField
( (
fieldName, fieldName,
this->mesh().time().timeName(), this->mesh().time().timeName(),
this->mesh(), this->mesh().thisDb(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
this->mesh() this->mesh()
); );
this->mesh().objectRegistry::store(ptr); regIOobject::store(ptr);
} }
return *ptr; return *ptr;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2020 OpenCFD Ltd. Copyright (C) 2016-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -191,7 +191,7 @@ Foam::lumpedPointDisplacementPointPatchVectorField::movement() const
// Create and register with this patch as the owner // Create and register with this patch as the owner
ptr = lumpedPointIOMovement::New(obr, this->patch().index()).ptr(); ptr = lumpedPointIOMovement::New(obr, this->patch().index()).ptr();
objectRegistry::store(ptr); regIOobject::store(ptr);
} }
return *ptr; return *ptr;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2023 OpenCFD Ltd. Copyright (C) 2018-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -300,7 +300,7 @@ bool Foam::mappedPatchBase::constructIOField
), ),
Foam::zero{} Foam::zero{}
); );
objectRegistry::store(fldPtr); regIOobject::store(fldPtr);
} }
fldPtr->transfer fldPtr->transfer
@ -340,7 +340,7 @@ void Foam::mappedPatchBase::storeField
), ),
Foam::zero{} Foam::zero{}
); );
objectRegistry::store(fldPtr); regIOobject::store(fldPtr);
} }
*fldPtr = values; *fldPtr = values;

View File

@ -340,23 +340,21 @@ Foam::processorColour::processorColour(const lduMesh& mesh)
const Foam::processorColour& Foam::processorColour::New(const lduMesh& mesh) const Foam::processorColour& Foam::processorColour::New(const lduMesh& mesh)
{ {
const processorColour* ptr = auto* ptr =
mesh.thisDb().objectRegistry::template cfindObject<processorColour> mesh.thisDb().objectRegistry::template getObjectPtr<processorColour>
( (
processorColour::typeName processorColour::typeName
); );
if (ptr) if (!ptr)
{ {
return *ptr; ptr = new processorColour(mesh);
//regIOobject::store(static_cast<MoveableMeshObject<lduMesh>*>(ptr));
regIOobject::store(ptr);
} }
processorColour* objectPtr = new processorColour(mesh); return *ptr;
//regIOobject::store(static_cast<MoveableMeshObject<lduMesh>*>(objectPtr));
regIOobject::store(objectPtr);
return *objectPtr;
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -99,7 +99,7 @@ bool Foam::functionObjects::filmFlux::execute()
( (
resultName_, resultName_,
time_.timeName(), time_.timeName(),
filmMesh, filmMesh.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -108,7 +108,7 @@ bool Foam::functionObjects::filmFlux::execute()
dimensionedScalar(dimMass/dimTime, Zero) dimensionedScalar(dimMass/dimTime, Zero)
); );
filmMesh.objectRegistry::store(resultPtr); regIOobject::store(resultPtr);
} }
auto& result = *resultPtr; auto& result = *resultPtr;
@ -123,7 +123,7 @@ bool Foam::functionObjects::filmFlux::execute()
( (
"height", "height",
time_.timeName(), time_.timeName(),
filmMesh, filmMesh.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER IOobject::NO_REGISTER
@ -133,7 +133,7 @@ bool Foam::functionObjects::filmFlux::execute()
fvPatchFieldBase::zeroGradientType() fvPatchFieldBase::zeroGradientType()
); );
auto& heightc = height.ref(); auto& heightc = height.internalFieldRef();
heightc = max(dimensionedScalar("eps", dimLength, ROOTVSMALL), vol/magSf()); heightc = max(dimensionedScalar("eps", dimLength, ROOTVSMALL), vol/magSf());
height.correctBoundaryConditions(); height.correctBoundaryConditions();

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2017-2023 OpenCFD Ltd. Copyright (C) 2017-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -62,14 +62,15 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField::getOrCreateField
( (
fieldName, fieldName,
mesh.time().timeName(), mesh.time().timeName(),
mesh, mesh.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh, mesh,
dimensionedScalar(dimless, Zero) dimensionedScalar(dimless, Zero)
); );
mesh.objectRegistry::store(ptr); regIOobject::store(ptr);
} }
return *ptr; return *ptr;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 Thorsten Zirwes Copyright (C) 2020 Thorsten Zirwes
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -68,7 +68,7 @@ void Foam::functionObjects::BilgerMixtureFraction::calcBilgerMixtureFraction()
( (
resultName_, resultName_,
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::REGISTER IOobject::REGISTER
@ -76,7 +76,7 @@ void Foam::functionObjects::BilgerMixtureFraction::calcBilgerMixtureFraction()
mesh_, mesh_,
dimensionedScalar(dimless, Zero) dimensionedScalar(dimless, Zero)
); );
mesh_.objectRegistry::store(resultPtr); regIOobject::store(resultPtr);
} }
auto& f_Bilger = *resultPtr; auto& f_Bilger = *resultPtr;