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

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