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",
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
IOobject::NO_WRITE,
IOobject::REGISTER
),
mesh
)

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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<fvMesh&>(mesh).objectRegistry::store(factorPtr);
regIOobject::store(factorPtr);
}
auto& factor = *factorPtr;

View File

@ -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;

View File

@ -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;

View File

@ -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<AreaFieldType> tsigma;
if (dict.found("sigma"))
{
// Sigma to be defined using a Function1 type
sigmaVsTPtr = Function1<Type>::New("sigma", dict, &mesh_);
auto tsigma = tmp<AreaFieldType>::New
tsigma.reset
(
IOobject
new AreaFieldType
(
typeName + ":sigma_" + regionName_,
obr.time().timeName(),
obr,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
regionMesh(),
dimensioned<Type>(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<AreaFieldType>::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<Type>& pf = bf[patchi];
if (!isA<emptyFaPatch>(bf[patchi]))
if (!isA<emptyFaPatch>(pf))
{
const scalarField& Tbf = T.boundaryField()[patchi];
forAll(pf, facei)

View File

@ -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<options>(typeName);
auto* ptr = mesh.thisDb().getObjectPtr<options>(typeName);
if (!ptr)
{

View File

@ -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<Type, Limiter, LimitFunc>::limiter
(
limiterFieldName,
mesh.time().timeName(),
mesh,
mesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::REGISTER
@ -170,7 +170,7 @@ Foam::LimitedScheme<Type, Limiter, LimitFunc>::limiter
dimless
);
mesh.objectRegistry::store(fldptr);
regIOobject::store(fldptr);
}
auto& limiterField = *fldptr;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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<volVectorField>("momentum", dimVelocity*dimMass)
);
if (hasCsys_)
{
mesh_.objectRegistry::store
regIOobject::store
(
newField<volVectorField>("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<volVectorField>("angularVelocity", dimVelocity)
);

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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<volScalarField>(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<volScalarField>(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<volScalarField>(true, true, false))
{
auto* vfPtr = new volScalarField(fieldHeader, mesh_);
mesh_.objectRegistry::store(vfPtr);
regIOobject::store(vfPtr);
}
else
{

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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<volVectorField>(scopedName("forceCoeff"));
auto* ptr = mesh_.getObjectPtr<volVectorField>(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<volVectorField>(scopedName("momentCoeff"));
auto* ptr = mesh_.getObjectPtr<volVectorField>(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;
}

View File

@ -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<volVectorField>(scopedName("force"));
auto* ptr = mesh_.getObjectPtr<volVectorField>(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<volVectorField>(scopedName("moment"));
auto* ptr = mesh_.getObjectPtr<volVectorField>(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;
}

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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<Type>::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;

View File

@ -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

View File

@ -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<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"))
{
// Sigma to be defined using a Function1 type
sigmaVsTPtr = Function1<Type>::New("sigma", dict, &mesh_);
auto tsigma = tmp<VolFieldType>::New
tsigma.reset
(
IOobject
new VolFieldType
(
typeName + ":sigma",
mesh_.time().timeName(),
io,
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensioned<Type>(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<VolFieldType>::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<Type>& pf = bf[patchi];

View File

@ -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<CloudType>::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;

View File

@ -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;

View File

@ -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;

View File

@ -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<processorColour>
auto* ptr =
mesh.thisDb().objectRegistry::template getObjectPtr<processorColour>
(
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);
//regIOobject::store(static_cast<MoveableMeshObject<lduMesh>*>(objectPtr));
regIOobject::store(objectPtr);
return *objectPtr;
return *ptr;
}

View File

@ -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();

View File

@ -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;

View File

@ -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;