mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: simplify objectRegistry access names (issue #322)
New name: findObject(), cfindObject()
Old name: lookupObjectPtr()
Return a const pointer or nullptr on failure.
New name: findObject()
Old name: --
Return a non-const pointer or nullptr on failure.
New name: getObjectPtr()
Old name: lookupObjectRefPtr()
Return a non-const pointer or nullptr on failure.
Can be called on a const object and it will perform a
const_cast.
- use these updated names and functionality in more places
NB: The older methods names are deprecated, but continue to be defined.
This commit is contained in:
@ -415,7 +415,7 @@ void Foam::functionObjects::externalCoupled::initCoupling()
|
||||
UPtrList<const fvMesh> meshes(regionNames.size());
|
||||
forAll(regionNames, regi)
|
||||
{
|
||||
meshes.set(regi, time_.lookupObjectPtr<fvMesh>(regionNames[regi]));
|
||||
meshes.set(regi, time_.findObject<fvMesh>(regionNames[regi]));
|
||||
}
|
||||
|
||||
const labelList& groups = regionToGroups_[compName];
|
||||
@ -692,7 +692,7 @@ void Foam::functionObjects::externalCoupled::readDataMaster()
|
||||
UPtrList<const fvMesh> meshes(regionNames.size());
|
||||
forAll(regionNames, regi)
|
||||
{
|
||||
meshes.set(regi, time_.lookupObjectPtr<fvMesh>(regionNames[regi]));
|
||||
meshes.set(regi, time_.findObject<fvMesh>(regionNames[regi]));
|
||||
}
|
||||
|
||||
const labelList& groups = regionToGroups_[compName];
|
||||
@ -736,7 +736,7 @@ void Foam::functionObjects::externalCoupled::writeDataMaster() const
|
||||
UPtrList<const fvMesh> meshes(regionNames.size());
|
||||
forAll(regionNames, regi)
|
||||
{
|
||||
meshes.set(regi, time_.lookupObjectPtr<fvMesh>(regionNames[regi]));
|
||||
meshes.set(regi, time_.findObject<fvMesh>(regionNames[regi]));
|
||||
}
|
||||
|
||||
const labelList& groups = regionToGroups_[compName];
|
||||
|
||||
@ -82,8 +82,7 @@ bool Foam::functionObjects::externalCoupled::readData
|
||||
label nFound = 0;
|
||||
for (const fvMesh& mesh : meshes)
|
||||
{
|
||||
const volFieldType* vfptr =
|
||||
mesh.lookupObjectPtr<volFieldType>(fieldName);
|
||||
const volFieldType* vfptr = mesh.findObject<volFieldType>(fieldName);
|
||||
|
||||
if (!vfptr)
|
||||
{
|
||||
@ -358,8 +357,7 @@ bool Foam::functionObjects::externalCoupled::writeData
|
||||
|
||||
for (const fvMesh& mesh : meshes)
|
||||
{
|
||||
const volFieldType* vfptr =
|
||||
mesh.lookupObjectPtr<volFieldType>(fieldName);
|
||||
const volFieldType* vfptr = mesh.findObject<volFieldType>(fieldName);
|
||||
|
||||
if (!vfptr)
|
||||
{
|
||||
|
||||
@ -37,7 +37,7 @@ bool Foam::functionObjects::fieldAverageItem::calculateMeanField
|
||||
return false;
|
||||
}
|
||||
|
||||
const Type* baseFieldPtr = obr.lookupObjectPtr<Type>(fieldName_);
|
||||
const Type* baseFieldPtr = obr.findObject<Type>(fieldName_);
|
||||
|
||||
if (!baseFieldPtr)
|
||||
{
|
||||
@ -122,7 +122,7 @@ bool Foam::functionObjects::fieldAverageItem::calculateMeanField
|
||||
{
|
||||
const word& fieldName = nameIter();
|
||||
const scalar dt = timeIter();
|
||||
const Type* w = obr.lookupObjectPtr<Type>(fieldName);
|
||||
const Type* w = obr.findObject<Type>(fieldName);
|
||||
|
||||
meanField += dt*(*w);
|
||||
|
||||
@ -173,7 +173,7 @@ bool Foam::functionObjects::fieldAverageItem::calculatePrime2MeanField
|
||||
return false;
|
||||
}
|
||||
|
||||
const Type1* baseFieldPtr = obr.lookupObjectPtr<Type1>(fieldName_);
|
||||
const Type1* baseFieldPtr = obr.findObject<Type1>(fieldName_);
|
||||
|
||||
if (!baseFieldPtr)
|
||||
{
|
||||
@ -258,7 +258,7 @@ bool Foam::functionObjects::fieldAverageItem::calculatePrime2MeanField
|
||||
{
|
||||
const word& fieldName = nameIter();
|
||||
const scalar dt = timeIter();
|
||||
const Type1* w = obr.lookupObjectPtr<Type1>(fieldName);
|
||||
const Type1* w = obr.findObject<Type1>(fieldName);
|
||||
|
||||
prime2MeanField += dt*(sqr((*w) - meanField));
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ void Foam::functionObjects::fieldAverage::restoreWindowFieldsType
|
||||
|
||||
const word& fieldName = item.fieldName();
|
||||
|
||||
const Type* fieldPtr = lookupObjectPtr<Type>(fieldName);
|
||||
const Type* fieldPtr = findObject<Type>(fieldName);
|
||||
|
||||
if (!fieldPtr)
|
||||
{
|
||||
|
||||
@ -54,7 +54,7 @@ void Foam::functionObjects::fieldExtents::calcFieldExtents
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
|
||||
const VolFieldType* fieldPtr =
|
||||
obr_.lookupObjectPtr<VolFieldType>(fieldName);
|
||||
obr_.findObject<VolFieldType>(fieldName);
|
||||
|
||||
if (!fieldPtr)
|
||||
{
|
||||
|
||||
@ -129,7 +129,7 @@ void Foam::functionObjects::fluxSummary::initialiseSurface
|
||||
DynamicList<boolList>& faceFlip
|
||||
) const
|
||||
{
|
||||
const surfMesh* sPtr = mesh_.lookupObjectPtr<surfMesh>(surfName);
|
||||
const surfMesh* sPtr = mesh_.findObject<surfMesh>(surfName);
|
||||
if (!sPtr)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -154,7 +154,7 @@ void Foam::functionObjects::fluxSummary::initialiseSurfaceAndDirection
|
||||
DynamicList<boolList>& faceFlip
|
||||
) const
|
||||
{
|
||||
const surfMesh* sPtr = mesh_.lookupObjectPtr<surfMesh>(surfName);
|
||||
const surfMesh* sPtr = mesh_.findObject<surfMesh>(surfName);
|
||||
if (!sPtr)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
|
||||
@ -47,13 +47,15 @@ bool Foam::functionObjects::readFields::loadField(const word& fieldName)
|
||||
}
|
||||
else if (foundObject<SurfaceFieldType>(fieldName))
|
||||
{
|
||||
DebugInfo<< "readFields: " << SurfaceFieldType::typeName
|
||||
DebugInfo
|
||||
<< "readFields: " << SurfaceFieldType::typeName
|
||||
<< " " << fieldName << " already exists in database"
|
||||
<< " already in database" << endl;
|
||||
}
|
||||
else if (foundObject<SurfFieldType>(fieldName))
|
||||
{
|
||||
DebugInfo<< "readFields: " << SurfFieldType::typeName
|
||||
DebugInfo
|
||||
<< "readFields: " << SurfFieldType::typeName
|
||||
<< " " << fieldName << " already exists in database"
|
||||
<< " already in database" << endl;
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ bool Foam::functionObjects::reference::calcType()
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
|
||||
const VolFieldType* vfPtr = lookupObjectPtr<VolFieldType>(fieldName_);
|
||||
const VolFieldType* vfPtr = findObject<VolFieldType>(fieldName_);
|
||||
|
||||
if (vfPtr)
|
||||
{
|
||||
|
||||
@ -66,7 +66,7 @@ Foam::functionObjects::setFlow::modeTypeNames
|
||||
void Foam::functionObjects::setFlow::setPhi(const volVectorField& U)
|
||||
{
|
||||
surfaceScalarField* phiptr =
|
||||
mesh_.lookupObjectRefPtr<surfaceScalarField>(phiName_);
|
||||
mesh_.getObjectPtr<surfaceScalarField>(phiName_);
|
||||
|
||||
if (!phiptr)
|
||||
{
|
||||
@ -76,7 +76,7 @@ void Foam::functionObjects::setFlow::setPhi(const volVectorField& U)
|
||||
if (rhoName_ != "none")
|
||||
{
|
||||
const volScalarField* rhoptr =
|
||||
mesh_.lookupObjectPtr<volScalarField>(rhoName_);
|
||||
mesh_.findObject<volScalarField>(rhoName_);
|
||||
|
||||
if (rhoptr)
|
||||
{
|
||||
@ -207,10 +207,11 @@ bool Foam::functionObjects::setFlow::read(const dictionary& dict)
|
||||
|
||||
bool Foam::functionObjects::setFlow::execute()
|
||||
{
|
||||
volVectorField* Uptr = mesh_.lookupObjectRefPtr<volVectorField>(UName_);
|
||||
volVectorField* Uptr =
|
||||
mesh_.getObjectPtr<volVectorField>(UName_);
|
||||
|
||||
surfaceScalarField* phiptr =
|
||||
mesh_.lookupObjectRefPtr<surfaceScalarField>(phiName_);
|
||||
mesh_.getObjectPtr<surfaceScalarField>(phiName_);
|
||||
|
||||
Log << nl << name() << ":" << nl;
|
||||
|
||||
@ -431,13 +432,13 @@ bool Foam::functionObjects::setFlow::execute()
|
||||
|
||||
bool Foam::functionObjects::setFlow::write()
|
||||
{
|
||||
const auto& Uptr = mesh_.lookupObjectRefPtr<volVectorField>(UName_);
|
||||
const auto* Uptr = mesh_.findObject<volVectorField>(UName_);
|
||||
if (Uptr)
|
||||
{
|
||||
Uptr->write();
|
||||
}
|
||||
|
||||
const auto& phiptr = mesh_.lookupObjectRefPtr<surfaceScalarField>(phiName_);
|
||||
const auto* phiptr = mesh_.findObject<surfaceScalarField>(phiName_);
|
||||
if (phiptr)
|
||||
{
|
||||
phiptr->write();
|
||||
|
||||
@ -102,8 +102,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::calc()
|
||||
|
||||
bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
||||
{
|
||||
const IOField<scalar>* residualPtr =
|
||||
mesh_.lookupObjectPtr<IOField<scalar>>(residualName_);
|
||||
const auto* residualPtr = mesh_.findObject<IOField<scalar>>(residualName_);
|
||||
|
||||
if (residuals_)
|
||||
{
|
||||
@ -164,7 +163,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
||||
}
|
||||
|
||||
const volScalarField* nonOrthPtr =
|
||||
mesh_.lookupObjectPtr<volScalarField>(nonOrthogonalityName_);
|
||||
mesh_.findObject<volScalarField>(nonOrthogonalityName_);
|
||||
|
||||
if (nonOrthogonality_)
|
||||
{
|
||||
@ -200,7 +199,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
||||
}
|
||||
|
||||
const volScalarField* skewnessPtr =
|
||||
mesh_.lookupObjectPtr<volScalarField>(skewnessName_);
|
||||
mesh_.findObject<volScalarField>(skewnessName_);
|
||||
|
||||
if (skewness_)
|
||||
{
|
||||
@ -235,7 +234,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
||||
}
|
||||
|
||||
const volScalarField* faceWeightsPtr =
|
||||
mesh_.lookupObjectPtr<volScalarField>(faceWeightName_);
|
||||
mesh_.findObject<volScalarField>(faceWeightName_);
|
||||
|
||||
if (faceWeight_)
|
||||
{
|
||||
@ -342,7 +341,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
||||
|
||||
|
||||
const volVectorField* UNamePtr =
|
||||
mesh_.lookupObjectPtr<volVectorField>(UName_);
|
||||
mesh_.findObject<volVectorField>(UName_);
|
||||
|
||||
if (Co_)
|
||||
{
|
||||
@ -520,7 +519,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
|
||||
store(resultName_, faceBlendedPtr);
|
||||
|
||||
const volScalarField* nonOrthPtr =
|
||||
mesh_.lookupObjectPtr<volScalarField>(nonOrthogonalityName_);
|
||||
mesh_.findObject<volScalarField>(nonOrthogonalityName_);
|
||||
|
||||
if (nonOrthogonality_)
|
||||
{
|
||||
@ -552,7 +551,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
|
||||
|
||||
|
||||
const volScalarField* faceWeightsPtr =
|
||||
mesh_.lookupObjectPtr<volScalarField>(faceWeightName_);
|
||||
mesh_.findObject<volScalarField>(faceWeightName_);
|
||||
|
||||
if (faceWeight_)
|
||||
{
|
||||
@ -583,7 +582,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
|
||||
}
|
||||
|
||||
const volScalarField* skewnessPtr =
|
||||
mesh_.lookupObjectPtr<volScalarField>(skewnessName_);
|
||||
mesh_.findObject<volScalarField>(skewnessName_);
|
||||
|
||||
if (skewness_)
|
||||
{
|
||||
|
||||
@ -107,14 +107,12 @@ bool Foam::functionObjects::surfaceInterpolate::write()
|
||||
{
|
||||
const word& fieldName = fieldSet_[i].second();
|
||||
|
||||
if (mesh_.foundObject<regIOobject>(fieldName))
|
||||
const regIOobject* ioptr = obr_.findObject<regIOobject>(fieldName);
|
||||
|
||||
if (ioptr)
|
||||
{
|
||||
Log << " " << fieldName << nl;
|
||||
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(fieldName);
|
||||
|
||||
field.write();
|
||||
ioptr->write();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -103,12 +103,10 @@ bool Foam::functionObjects::turbulenceFields::compressible()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Turbulence model not found in database, deactivating"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Turbulence model not found in database, deactivating"
|
||||
<< exit(FatalError);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -38,10 +38,11 @@ void Foam::functionObjects::turbulenceFields::processField
|
||||
|
||||
const word scopedName = modelName + ':' + fieldName;
|
||||
|
||||
if (obr_.foundObject<FieldType>(scopedName))
|
||||
FieldType* fldPtr = obr_.getObjectPtr<FieldType>(scopedName);
|
||||
|
||||
if (fldPtr)
|
||||
{
|
||||
FieldType& fld = obr_.lookupObjectRef<FieldType>(scopedName);
|
||||
fld == tvalue();
|
||||
(*fldPtr) == tvalue();
|
||||
}
|
||||
else if (obr_.found(scopedName))
|
||||
{
|
||||
|
||||
@ -57,12 +57,8 @@ bool Foam::functionObjects::vorticity::calc()
|
||||
fvc::curl(lookupObject<volVectorField>(fieldName_))
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -183,28 +183,48 @@ bool Foam::functionObjects::wallShearStress::execute()
|
||||
volVectorField& wallShearStress =
|
||||
mesh_.lookupObjectRef<volVectorField>(type());
|
||||
|
||||
const word& turbModelName = turbulenceModel::propertiesName;
|
||||
auto cmpModelPtr =
|
||||
mesh_.lookupObjectPtr<compressible::turbulenceModel>(turbModelName);
|
||||
auto icoModelPtr =
|
||||
mesh_.lookupObjectPtr<incompressible::turbulenceModel>(turbModelName);
|
||||
bool ok = false;
|
||||
|
||||
if (cmpModelPtr)
|
||||
// compressible
|
||||
if (!ok)
|
||||
{
|
||||
calcShearStress(cmpModelPtr->devRhoReff(), wallShearStress);
|
||||
typedef compressible::turbulenceModel turbType;
|
||||
|
||||
const turbType* modelPtr =
|
||||
findObject<turbType>(turbulenceModel::propertiesName);
|
||||
|
||||
ok = modelPtr;
|
||||
|
||||
if (ok)
|
||||
{
|
||||
calcShearStress(modelPtr->devRhoReff(), wallShearStress);
|
||||
}
|
||||
}
|
||||
else if (icoModelPtr)
|
||||
|
||||
// incompressible
|
||||
if (!ok)
|
||||
{
|
||||
calcShearStress(icoModelPtr->devReff(), wallShearStress);
|
||||
typedef incompressible::turbulenceModel turbType;
|
||||
|
||||
const turbType* modelPtr =
|
||||
findObject<turbType>(turbulenceModel::propertiesName);
|
||||
|
||||
ok = modelPtr;
|
||||
|
||||
if (ok)
|
||||
{
|
||||
calcShearStress(modelPtr->devReff(), wallShearStress);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unable to find turbulence model in the "
|
||||
<< "database" << exit(FatalError);
|
||||
}
|
||||
|
||||
return true;
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -176,16 +176,15 @@ bool Foam::functionObjects::zeroGradient::write()
|
||||
}
|
||||
|
||||
// Consistent output order
|
||||
const wordList outputList = results_.sortedToc();
|
||||
for (const word& fieldName : outputList)
|
||||
for (const word& fieldName : results_.sortedToc())
|
||||
{
|
||||
if (foundObject<regIOobject>(fieldName))
|
||||
{
|
||||
const regIOobject& io = lookupObject<regIOobject>(fieldName);
|
||||
const regIOobject* ioptr = findObject<regIOobject>(fieldName);
|
||||
|
||||
if (ioptr)
|
||||
{
|
||||
Log << " " << fieldName << endl;
|
||||
|
||||
io.write();
|
||||
ioptr->write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ bool Foam::functionObjects::vtkCloud::writeCloud
|
||||
const word& cloudName
|
||||
)
|
||||
{
|
||||
const auto* objPtr = mesh_.lookupObjectPtr<cloud>(cloudName);
|
||||
const auto* objPtr = mesh_.findObject<cloud>(cloudName);
|
||||
if (!objPtr)
|
||||
{
|
||||
return false;
|
||||
@ -127,7 +127,7 @@ bool Foam::functionObjects::vtkCloud::writeCloud
|
||||
|
||||
objPtr->writeObjects(obrTmp);
|
||||
|
||||
const auto* pointsPtr = obrTmp.lookupObjectPtr<vectorField>("position");
|
||||
const auto* pointsPtr = obrTmp.findObject<vectorField>("position");
|
||||
|
||||
if (!pointsPtr)
|
||||
{
|
||||
|
||||
@ -52,7 +52,7 @@ Foam::wordList Foam::functionObjects::vtkCloud::writeFields
|
||||
|
||||
for (const word& fieldName : fieldNames)
|
||||
{
|
||||
const auto* fldPtr = obrTmp.lookupObjectPtr<IOField<Type>>(fieldName);
|
||||
const auto* fldPtr = obrTmp.findObject<IOField<Type>>(fieldName);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
|
||||
@ -83,7 +83,7 @@ Foam::functionObjects::energyTransport::kappaEff() const
|
||||
{
|
||||
typedef incompressible::turbulenceModel turbType;
|
||||
|
||||
const turbType* turbPtr = lookupObjectPtr<turbType>
|
||||
const turbType* turbPtr = findObject<turbType>
|
||||
(
|
||||
turbulenceModel::propertiesName
|
||||
);
|
||||
@ -305,7 +305,7 @@ Foam::functionObjects::energyTransport::energyTransport
|
||||
phases_.set
|
||||
(
|
||||
i,
|
||||
mesh_.lookupObjectRefPtr<volScalarField>(phaseNames_[i])
|
||||
mesh_.getObjectPtr<volScalarField>(phaseNames_[i])
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -88,10 +88,7 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
|
||||
const surfaceScalarField& phi
|
||||
) const
|
||||
{
|
||||
typedef incompressible::turbulenceModel icoModel;
|
||||
typedef compressible::turbulenceModel cmpModel;
|
||||
|
||||
word Dname("D" + s.name());
|
||||
const word Dname("D" + s.name());
|
||||
|
||||
if (constantD_)
|
||||
{
|
||||
@ -109,38 +106,49 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
|
||||
dimensionedScalar(Dname, phi.dimensions()/dimLength, D_)
|
||||
);
|
||||
}
|
||||
else if (nutName_ != "none")
|
||||
|
||||
if (nutName_ != "none")
|
||||
{
|
||||
const volScalarField& nutMean =
|
||||
mesh_.lookupObject<volScalarField>(nutName_);
|
||||
|
||||
return tmp<volScalarField>::New(Dname, nutMean);
|
||||
}
|
||||
else if (foundObject<icoModel>(turbulenceModel::propertiesName))
|
||||
{
|
||||
const icoModel& model = lookupObject<icoModel>
|
||||
(
|
||||
turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
return tmp<volScalarField>::New
|
||||
(
|
||||
Dname,
|
||||
alphaD_*model.nu() + alphaDt_*model.nut()
|
||||
);
|
||||
// Incompressible
|
||||
{
|
||||
const auto* turb =
|
||||
findObject<incompressible::turbulenceModel>
|
||||
(
|
||||
turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
if (turb)
|
||||
{
|
||||
return tmp<volScalarField>::New
|
||||
(
|
||||
Dname,
|
||||
alphaD_ * turb->nu() + alphaDt_ * turb->nut()
|
||||
);
|
||||
}
|
||||
}
|
||||
else if (foundObject<cmpModel>(turbulenceModel::propertiesName))
|
||||
{
|
||||
const cmpModel& model = lookupObject<cmpModel>
|
||||
(
|
||||
turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
return tmp<volScalarField>::New
|
||||
(
|
||||
Dname,
|
||||
alphaD_*model.mu() + alphaDt_*model.mut()
|
||||
);
|
||||
// Compressible
|
||||
{
|
||||
const auto* turb =
|
||||
findObject<compressible::turbulenceModel>
|
||||
(
|
||||
turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
if (turb)
|
||||
{
|
||||
return tmp<volScalarField>::New
|
||||
(
|
||||
Dname,
|
||||
alphaD_ * turb->mu() + alphaDt_ * turb->mut()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -38,10 +38,16 @@ int Foam::functionObjects::ensightWrite::writeVolField
|
||||
// State: return 0 (not-processed), -1 (skip), +1 ok
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
|
||||
const VolFieldType* fldPtr;
|
||||
// Already done
|
||||
if (state)
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
// Already done, or not available
|
||||
if (state || !(fldPtr = lookupObjectPtr<VolFieldType>(inputName)))
|
||||
const VolFieldType* fldPtr = findObject<VolFieldType>(inputName);
|
||||
|
||||
// Not available
|
||||
if (!fldPtr)
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -82,22 +82,18 @@ bool Foam::functionObjects::removeRegisteredObject::read(const dictionary& dict)
|
||||
|
||||
bool Foam::functionObjects::removeRegisteredObject::execute()
|
||||
{
|
||||
forAll(objectNames_, i)
|
||||
for (const word& objName : objectNames_)
|
||||
{
|
||||
if (foundObject<regIOobject>(objectNames_[i]))
|
||||
regIOobject* ptr = getObjectPtr<regIOobject>(objName);
|
||||
|
||||
if (ptr && ptr->ownedByRegistry())
|
||||
{
|
||||
const regIOobject& obj =
|
||||
lookupObject<regIOobject>(objectNames_[i]);
|
||||
Log << type() << " " << name() << " output:" << nl
|
||||
<< " removing object " << ptr->name() << nl
|
||||
<< endl;
|
||||
|
||||
if (obj.ownedByRegistry())
|
||||
{
|
||||
Log << type() << " " << name() << " output:" << nl
|
||||
<< " removing object " << obj.name() << nl
|
||||
<< endl;
|
||||
|
||||
const_cast<regIOobject&>(obj).release();
|
||||
delete &obj;
|
||||
}
|
||||
ptr->release();
|
||||
delete ptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -113,8 +113,7 @@ void Foam::functionObjects::residuals::writeField(const word& fieldName) const
|
||||
{
|
||||
const word residualName("initialResidual:" + fieldName);
|
||||
|
||||
const IOField<scalar>* residualPtr =
|
||||
mesh_.lookupObjectPtr<IOField<scalar>>(residualName);
|
||||
const auto* residualPtr = mesh_.findObject<IOField<scalar>>(residualName);
|
||||
|
||||
if (residualPtr)
|
||||
{
|
||||
|
||||
@ -160,10 +160,12 @@ bool Foam::functionObjects::writeDictionary::write()
|
||||
bool firstDict = true;
|
||||
forAll(dictNames_, i)
|
||||
{
|
||||
if (obr_.foundObject<dictionary>(dictNames_[i]))
|
||||
const dictionary* dictptr =
|
||||
obr_.findObject<dictionary>(dictNames_[i]);
|
||||
|
||||
if (dictptr)
|
||||
{
|
||||
const dictionary& dict =
|
||||
obr_.lookupObject<dictionary>(dictNames_[i]);
|
||||
const dictionary& dict = *dictptr;
|
||||
|
||||
if (dict.digest() != digests_[i])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user