STYLE: remove unused/stray methods, fix stray deprecated usages

STYLE: use separate value/dimensions for GeometricField

- simplifies calling parameters

COMP: limit enumeration range when reporting chemkin error
This commit is contained in:
Mark Olesen 2024-01-02 18:20:33 +01:00
parent dde4b12687
commit ad85b684bb
41 changed files with 148 additions and 201 deletions

View File

@ -59,7 +59,7 @@ int main(int argc, char *argv[])
(
"procAddressing",
instance,
fvMesh::meshSubDir,
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,

View File

@ -118,7 +118,8 @@ PtrList<GeoField> create
(
word("cmpt." + name(i)),
mesh,
dimensioned<typename GeoField::value_type>(Zero)
Foam::zero{}, // value
dimless
).ptr()
);
}

View File

@ -148,7 +148,8 @@ bool setField
(
fieldName,
mesh,
dimensioned<typename GeoField::value_type>(dims)
Foam::zero{}, // value
dims
);
}
else

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2018 OpenFOAM Foundation
Copyright (C) 2020-2021,2023 OpenCFD Ltd.
Copyright (C) 2020-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -68,22 +68,15 @@ CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field
(
const IOobject& io,
const fvMesh& mesh,
const dimensioned<typename GeoField::value_type>& dimType
const typename GeoField::value_type& value,
const dimensionSet& dims
)
:
GeoField(io, mesh, dimType),
GeoField(io, mesh, value, dims),
startTimeIndex_(mesh.time().timeIndex())
{}
template<class Type>
template<class GeoField>
label CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>::startTimeIndex() const
{
return startTimeIndex_;
}
template<class Type>
template<class GeoField>
GeoField& CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>::operator()()
@ -127,7 +120,7 @@ CrankNicolsonDdtScheme<Type>::ddt0_
(
name,
startTimeName,
mesh()
mesh().thisDb()
).template typeHeaderOk<DDt0Field<GeoField>>(true)
)
{
@ -139,9 +132,10 @@ CrankNicolsonDdtScheme<Type>::ddt0_
(
name,
startTimeName,
mesh(),
mesh().thisDb(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
IOobject::AUTO_WRITE,
IOobject::REGISTER
),
mesh()
)
@ -159,25 +153,21 @@ CrankNicolsonDdtScheme<Type>::ddt0_
mesh().time().timeName(),
mesh().thisDb(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
IOobject::AUTO_WRITE,
IOobject::REGISTER
),
mesh(),
dimensioned<typename GeoField::value_type>
(
dims/dimTime,
Zero
)
Foam::zero{}, // value
dims/dimTime
)
);
}
}
DDt0Field<GeoField>& ddt0 = static_cast<DDt0Field<GeoField>&>
return static_cast<DDt0Field<GeoField>&>
(
mesh().objectRegistry::template lookupObjectRef<GeoField>(name)
);
return ddt0;
}
@ -369,7 +359,8 @@ CrankNicolsonDdtScheme<Type>::fvcDdt
(
ddtIOobject,
mesh(),
dimensioned<Type>(dt.dimensions()/dimTime, Zero)
Foam::zero{}, // value
(dt.dimensions()/dimTime)
)
);

View File

@ -53,10 +53,10 @@ Description
default CrankNicolson
ocCoeff
{
type scale;
scale linearRamp;
duration 0.01;
value 0.9;
type scale;
scale linearRamp;
duration 0.01;
value 0.9;
};
}
\endverbatim
@ -93,8 +93,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef CrankNicolsonDdtScheme_H
#define CrankNicolsonDdtScheme_H
#ifndef Foam_CrankNicolsonDdtScheme_H
#define Foam_CrankNicolsonDdtScheme_H
#include "ddtScheme.H"
#include "Function1.H"
@ -120,9 +120,9 @@ class CrankNicolsonDdtScheme
{
// Private Data
//- Class to store the ddt0 fields on the objectRegistry for use in the
// next time-step. The start-time index of the CN scheme is also
// stored to help handle the transition from Euler to CN
//- Store ddt0 fields on the registry for use in the next time-step.
// The start-time index of the CN scheme is also stored
// to help handle the transition from Euler to CrankNicolson
template<class GeoField>
class DDt0Field
:
@ -132,24 +132,24 @@ class CrankNicolsonDdtScheme
public:
//- Constructor from file for restart.
//- Read construct from file (for restart)
DDt0Field
(
const IOobject& io,
const fvMesh& mesh
);
//- Constructor from components, initisalised to zero with given
// dimensions.
//- Construct value-initialised with given dimensions
DDt0Field
(
const IOobject& io,
const fvMesh& mesh,
const dimensioned<typename GeoField::value_type>& dimType
const typename GeoField::value_type& value,
const dimensionSet& dims
);
//- Return the start-time index
label startTimeIndex() const;
label startTimeIndex() const noexcept { return startTimeIndex_; }
//- Cast to the underlying GeoField
GeoField& operator()();

View File

@ -254,10 +254,8 @@ steadyStateDdtScheme<Type>::fvcDdtUfCorr
mesh().thisDb()
),
mesh(),
dimensioned<typename flux<Type>::type>
(
Uf.dimensions()*dimArea/dimTime, Zero
)
Foam::zero{}, // value
Uf.dimensions()*dimArea/dimTime
)
);
@ -286,10 +284,8 @@ steadyStateDdtScheme<Type>::fvcDdtPhiCorr
mesh().thisDb()
),
mesh(),
dimensioned<typename flux<Type>::type>
(
phi.dimensions()/dimTime, Zero
)
Foam::zero{}, // value
phi.dimensions()/dimTime
)
);
@ -321,10 +317,8 @@ steadyStateDdtScheme<Type>::fvcDdtUfCorr
mesh().thisDb()
),
mesh(),
dimensioned<typename flux<Type>::type>
(
Uf.dimensions()*dimArea/dimTime, Zero
)
Foam::zero{}, // value
Uf.dimensions()*dimArea/dimTime
)
);
@ -356,10 +350,8 @@ steadyStateDdtScheme<Type>::fvcDdtPhiCorr
mesh().thisDb()
),
mesh(),
dimensioned<typename flux<Type>::type>
(
phi.dimensions()/dimTime, Zero
)
Foam::zero{}, // value
phi.dimensions()/dimTime
)
);

View File

@ -79,8 +79,7 @@ Foam::patchDistMethods::advectionDiffusion::advectionDiffusion
tolerance_(coeffs_.getOrDefault<scalar>("tolerance", 1e-3)),
maxIter_(coeffs_.getOrDefault<int>("maxIter", 10)),
predicted_(false),
checkAndWriteMesh_
(coeffs_.lookupOrDefault<bool>("checkAndWriteMesh", true))
checkAndWriteMesh_(coeffs_.getOrDefault("checkAndWriteMesh", true))
{}
@ -119,11 +118,11 @@ bool Foam::patchDistMethods::advectionDiffusion::correct
(
"points",
mesh_.pointsInstance(),
mesh_.meshSubDir,
polyMesh::meshSubDir,
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
IOobject::NO_REGISTER
),
mesh_.points()
);

View File

@ -90,31 +90,6 @@ bool Foam::functionObjects::age::converged
}
template<class GeoField>
Foam::autoPtr<GeoField>
Foam::functionObjects::age::newField
(
const word& baseName,
const wordList patches
) const
{
return autoPtr<GeoField>::New
(
IOobject
(
scopedName(baseName),
time_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensioned<typename GeoField::value_type>(dimTime, Zero),
patches
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::age::age

View File

@ -141,14 +141,6 @@ class age
//- Return true if convergence is reached
bool converged(const int nCorr, const scalar initialResidual) const;
//- Create and allocate a new zero geometric field
template<class GeoField>
autoPtr<GeoField> newField
(
const word& baseName,
const wordList
) const;
public:

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.
@ -37,11 +37,11 @@ Foam::autoPtr<Foam::binModel> Foam::binModel::New
const word& outputPrefix
)
{
word modelType(dict.get<word>("binModel"));
const word modelType(dict.get<word>("binModel"));
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
if (!cstrIter.good())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -52,7 +52,7 @@ Foam::autoPtr<Foam::binModel> Foam::binModel::New
) << exit(FatalIOError);
}
return autoPtr<binModel>(cstrIter()(dict, mesh, outputPrefix));
return autoPtr<binModel>(ctorPtr(dict, mesh, outputPrefix));
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -71,13 +71,14 @@ Foam::functionObjects::momentum::newField
(
scopedName(baseName),
time_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
mesh_.thisDb(),
IOobjectOption::NO_READ,
IOobjectOption::NO_WRITE,
registerObject
),
mesh_,
dimensioned<typename GeoField::value_type>(dims, Zero)
Foam::zero{}, // value
dims
);
}

View File

@ -1714,7 +1714,7 @@ Foam::meshRefinement::meshRefinement
(
"surfaceIndex",
mesh_.facesInstance(),
fvMesh::meshSubDir,
polyMesh::meshSubDir,
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,

View File

@ -724,7 +724,7 @@ void Foam::cyclicACMIGAMGInterface::write(Ostream& os) const
{
GAMGInterface::write(os);
const bool hasAMI = amiPtr_.valid();
const bool hasAMI = bool(amiPtr_);
os << token::SPACE << neighbPatchID_
<< token::SPACE << owner_

View File

@ -964,7 +964,7 @@ void Foam::cyclicAMIGAMGInterface::write(Ostream& os) const
{
GAMGInterface::write(os);
const bool hasAMI = amiPtr_.valid();
const bool hasAMI = bool(amiPtr_);
os << token::SPACE << neighbPatchID_
<< token::SPACE << owner_

View File

@ -105,8 +105,8 @@ Foam::tmp<Foam::Field<Type>> Foam::coordSetWriter::adjustFieldTemplate
// Rotate fields (vector and non-spherical tensors)
if
(
(pTraits<Type>::rank != 0 && pTraits<Type>::nComponents > 1)
&& geometryTransform_.valid()
(is_vectorspace<Type>::value && pTraits<Type>::nComponents > 1)
&& geometryTransform_.good()
&& !geometryTransform_.R().is_identity()
)
{

View File

@ -149,12 +149,12 @@ Foam::label Foam::processorColour::colour
// mesh.time().timeName(),
// mesh,
// IOobject::NO_READ,
// IOobject::AUTO_WRITE,
// false
// IOobject::NO_WRITE,
// IOobject::NO_REGISTER
// ),
// mesh,
// dimensionedScalar(dimless, procColour[Pstream::myProcNo()]),
// zeroGradientFvPatchScalarField::typeName
// fvPatchFieldBase::zeroGradientType()
// );
// volColour.write();
//}

View File

@ -65,9 +65,9 @@ displacementMethodpLaplacianMotionSolver
"dynamicMeshDict",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::AUTO_WRITE,
false
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
)
).subDict("pLaplacianMotionSolverCoeffs").getOrDefault<bool>
(

View File

@ -264,10 +264,11 @@ void Foam::elasticityMotionSolver::solve()
(
"points",
mesh().pointsInstance(),
mesh().meshSubDir,
polyMesh::meshSubDir,
mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh().points()
);

View File

@ -254,19 +254,21 @@ bool objectiveManager::writeObjectives
const bool valid
)
{
if (weightedObjectiveFile_.valid())
if (weightedObjectiveFile_)
{
auto& os = weightedObjectiveFile_();
unsigned int width = IOstream::defaultPrecision() + 5;
weightedObjectiveFile_()
os
<< setw(4) << mesh_.time().timeName() << " "
<< setw(width) << weightedObjective << " ";
for (objective& objI : objectives_)
{
weightedObjectiveFile_()
<< setw(width) << objI.JCycle() << " ";
os << setw(width) << objI.JCycle() << " ";
}
weightedObjectiveFile_() << endl;
os << endl;
}
return writeObjectives();

View File

@ -275,7 +275,7 @@ scalar objective::JCycle(bool negate) const
}
// Subtract target, in case the objective is used as a constraint
if (target_.valid())
if (target_)
{
if (negate)
{
@ -541,12 +541,12 @@ bool objective::write(const bool valid) const
ios_base::fmtflags flags = file.flags();
flags |= std::cout.left;
file.flags(flags);
if (target_.valid())
if (target_)
{
file<< setw(width_) << "#target" << " "
<< setw(width_) << target_() << endl;
}
if (targetLeft_.valid())
if (targetLeft_)
{
file<< setw(width_) << "#targetLeft" << " "
<< setw(width_) << targetLeft_() << endl;

View File

@ -48,6 +48,7 @@ namespace Foam
defineTypeNameAndDebug(adjointEikonalSolver, 0);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
wordList adjointEikonalSolver::patchTypes() const
@ -60,7 +61,7 @@ wordList adjointEikonalSolver::patchTypes() const
for (const label patchi : wallPatchIDs_)
{
daTypes[patchi] = zeroGradientFvPatchScalarField::typeName;
daTypes[patchi] = fvPatchFieldBase::zeroGradientType();
}
return daTypes;
@ -212,7 +213,7 @@ void adjointEikonalSolver::solve()
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
IOobject::NO_REGISTER
),
mesh_,
dimensionedScalar("scaleDims", dimTime/dimLength, scalar(1))
@ -329,7 +330,7 @@ tmp<volTensorField> adjointEikonalSolver::getFISensitivityTerm() const
),
mesh_,
dimensionedTensor(da_.dimensions(), Zero),
zeroGradientFvPatchField<tensor>::typeName
fvPatchFieldBase::zeroGradientType()
)
);
volTensorField& distanceSens = tdistanceSens.ref();

View File

@ -66,9 +66,9 @@ void Foam::designVariables::readBounds
scalar lowerBound(dict_.get<scalar>("lowerBound"));
lowerBounds_.reset(new scalarField(getVars().size(), lowerBound));
}
else if (lowerBoundPtr.valid())
else if (lowerBoundPtr)
{
lowerBounds_.reset(new scalarField(getVars().size(), lowerBoundPtr()));
lowerBounds_.reset(new scalarField(getVars().size(), *lowerBoundPtr));
}
// Read upper bounds for the design variables, if present
@ -91,9 +91,9 @@ void Foam::designVariables::readBounds
scalar upperBound(dict_.get<scalar>("upperBound"));
upperBounds_.reset(new scalarField(getVars().size(), upperBound));
}
else if (upperBoundPtr.valid())
else if (upperBoundPtr)
{
upperBounds_.reset(new scalarField(getVars().size(), upperBoundPtr()));
upperBounds_.reset(new scalarField(getVars().size(), *upperBoundPtr));
}
}
@ -164,9 +164,9 @@ Foam::autoPtr<Foam::designVariables> Foam::designVariables::New
Info<< "designVariables type : " << modelType << endl;
auto cstrIter = designVariablesConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = designVariablesConstructorTable(modelType);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalErrorInLookup
(
@ -176,7 +176,7 @@ Foam::autoPtr<Foam::designVariables> Foam::designVariables::New
) << exit(FatalError);
}
return autoPtr<designVariables>(cstrIter()(mesh, dict));
return autoPtr<designVariables>(ctorPtr(mesh, dict));
}

View File

@ -37,7 +37,7 @@ Foam::designVariables::activeDesignVariables() const
bool Foam::designVariables::isMaxInitChangeSet() const
{
return maxInitChange_.valid();
return bool(maxInitChange_);
}

View File

@ -227,11 +227,7 @@ void Foam::levelSetDesignVariables::updateSignedDistances()
),
mesh_,
dimensionedScalar(dimLength, Zero),
wordList
(
mesh_.boundary().size(),
zeroGradientFvPatchField<scalar>::typeName
)
fvPatchFieldBase::zeroGradientType()
);
y.primitiveFieldRef() = aTilda_.primitiveFieldRef();
y.correctBoundaryConditions();
@ -297,7 +293,7 @@ levelSetDesignVariables::levelSetDesignVariables
),
mesh_,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchField<scalar>::typeName
fvPatchFieldBase::zeroGradientType()
),
signedDistances_
(
@ -311,7 +307,7 @@ levelSetDesignVariables::levelSetDesignVariables
),
mesh_,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchField<scalar>::typeName
fvPatchFieldBase::zeroGradientType()
),
interpolation_
(

View File

@ -159,7 +159,7 @@ Foam::BezierDesignVariables::BezierDesignVariables
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
IOobject::NO_REGISTER
)
)
),

View File

@ -211,9 +211,9 @@ Foam::autoPtr<Foam::shapeDesignVariables> Foam::shapeDesignVariables::New
Info<< "shapeDesignVariables type : " << modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalErrorInLookup
(
@ -223,7 +223,7 @@ Foam::autoPtr<Foam::shapeDesignVariables> Foam::shapeDesignVariables::New
) << exit(FatalError);
}
return autoPtr<shapeDesignVariables>(cstrIter()(mesh, dict));
return autoPtr<shapeDesignVariables>(ctorPtr(mesh, dict));
}
@ -281,11 +281,11 @@ void Foam::shapeDesignVariables::moveMesh()
(
"points",
mesh_.pointsInstance(),
mesh_.meshSubDir,
polyMesh::meshSubDir,
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
IOobject::NO_REGISTER
),
mesh_.points()
);

View File

@ -121,9 +121,9 @@ Foam::autoPtr<Foam::morphingBoxConstraint> Foam::morphingBoxConstraint::New
Info<< "morphingBoxConstraint type : " << modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalErrorInLookup
(
@ -135,10 +135,11 @@ Foam::autoPtr<Foam::morphingBoxConstraint> Foam::morphingBoxConstraint::New
return autoPtr<morphingBoxConstraint>
(
cstrIter()(mesh, dict, designVariables)
ctorPtr(mesh, dict, designVariables)
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * //
void Foam::morphingBoxConstraint::computeBounds

View File

@ -307,7 +307,7 @@ void Foam::volumetricBSplinesDesignVariables::setDisplacement
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
IOobject::NO_REGISTER
),
pointMesh::New(mesh_),
dimensionedVector(dimless, Zero)

View File

@ -58,12 +58,12 @@ Foam::betaMaxDarcy::betaMaxDarcy
(
IOobject
(
"transportProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
"transportProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
)
).get<dimensionedScalar>("nu").value();

View File

@ -173,7 +173,7 @@ Foam::boolList Foam::betaMax::markProcessorEdges
const edge meshE = edge(mp[e[0]], mp[e[1]]);
auto iter = isInletEdge.find(meshE);
if (iter.found())
if (iter.good())
{
iter.val() = true;
}
@ -196,9 +196,8 @@ Foam::boolList Foam::betaMax::markProcessorEdges
{
const edge& e = edges[edgeI];
const edge meshE = edge(mp[e[0]], mp[e[1]]);
const auto iter = isInletEdge.cfind(meshE);
if (iter.found() && iter.val())
if (isInletEdge.lookup(meshE, false))
{
isProcessorEdge[edgeI - nInternalEdges] = true;
}
@ -208,7 +207,6 @@ Foam::boolList Foam::betaMax::markProcessorEdges
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::betaMax::betaMax
@ -232,11 +230,11 @@ Foam::autoPtr<Foam::betaMax> Foam::betaMax::New
{
const word modelType(dict.getOrDefault<word>("betaMaxType", "value"));
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
Info<< "betaMax type " << modelType << endl;
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -247,7 +245,7 @@ Foam::autoPtr<Foam::betaMax> Foam::betaMax::New
) << exit(FatalIOError);
}
return autoPtr<betaMax>(cstrIter()(mesh, dict));
return autoPtr<betaMax>(ctorPtr(mesh, dict));
}

View File

@ -64,9 +64,9 @@ Foam::topOInterpolationFunction::New
Info<< "topOInterpolationFunction type : " << type << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(type);
auto* ctorPtr = dictionaryConstructorTable(type);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -77,7 +77,7 @@ Foam::topOInterpolationFunction::New
) << exit(FatalIOError);
}
return autoPtr<topOInterpolationFunction>(cstrIter()(mesh, dict));
return autoPtr<topOInterpolationFunction>(ctorPtr(mesh, dict));
}

View File

@ -28,7 +28,6 @@ License
#include "fieldRegularisation.H"
#include "fixedValueFvPatchFields.H"
#include "zeroGradientFvPatchFields.H"
#include "wallFvPatch.H"
#include "fvm.H"
@ -96,7 +95,7 @@ Foam::fieldRegularisation::fieldRegularisation
),
mesh_,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
)
{
DebugInfo

View File

@ -138,11 +138,11 @@ Foam::autoPtr<Foam::regularisationPDE> Foam::regularisationPDE::New
const word modelType =
dict.getOrDefault<word>("regularisationPDE", "Helmholtz");
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
Info<< "regularisationPDE type " << modelType << endl;
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -155,7 +155,7 @@ Foam::autoPtr<Foam::regularisationPDE> Foam::regularisationPDE::New
return autoPtr<regularisationPDE>
(
cstrIter()(mesh, dict, zones)
ctorPtr(mesh, dict, zones)
);
}

View File

@ -62,11 +62,11 @@ Foam::autoPtr<Foam::regularisationRadius> Foam::regularisationRadius::New
{
const word modelType = dict.getOrDefault<word>("type", "isotropic");
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
Info<< "regularisationRadius type " << modelType << endl;
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -79,7 +79,7 @@ Foam::autoPtr<Foam::regularisationRadius> Foam::regularisationRadius::New
return autoPtr<regularisationRadius>
(
cstrIter()(mesh, dict, adjustWallThickness)
ctorPtr(mesh, dict, adjustWallThickness)
);
}

View File

@ -372,7 +372,7 @@ void Foam::designVariablesUpdate::update(const scalarField& direction)
{
// Multiply with line search step, if necessary
scalarField correction(direction);
if (lineSearch_.valid())
if (lineSearch_)
{
lineSearch_->updateCorrection(correction);
}
@ -551,9 +551,10 @@ void Foam::designVariablesUpdate::postUpdate(const scalarField& oldCorrection)
updateOldCorrection(oldCorrection);
write();
designVars_->evolveNumber();
if (lineSearch_.valid())
if (lineSearch_)
{
lineSearch_().postUpdate();
lineSearch_->postUpdate();
// Append additional empty line at the end of the instantaneous
// objective file to indicate the end of the block corresponding to
// this optimisation cycle

View File

@ -67,7 +67,7 @@ Foam::dictionary Foam::adjointSolver::designVarsDict() const
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
IOobject::NO_REGISTER
)
).subDict("optimisation").subDict("designVariables");
}
@ -270,7 +270,7 @@ void Foam::adjointSolver::updatePrimalBasedQuantities()
bool Foam::adjointSolver::writeData(Ostream& os) const
{
if (sensitivities_.valid())
if (sensitivities_.good())
{
sensitivities_().writeEntry("sensitivities", os);
}

View File

@ -170,7 +170,7 @@ variablesSet::allocateRenamedField
{
typedef GeometricField<Type, PatchField, GeoMesh> fieldType;
autoPtr<fieldType> returnField(nullptr);
if (bf.valid())
if (bf)
{
const word timeName = bf().mesh().time().timeName();
returnField.reset

View File

@ -114,7 +114,6 @@ public:
const DimensionedField<scalar, volMesh>& iF
) const
{
Info<< "manager name " << managerName_ << endl;
return tmp<fvPatchScalarField>
(
new adjointInletNuaTildaFvPatchScalarField(*this, iF)

View File

@ -50,9 +50,9 @@ Foam::wallBoilingModels::nucleateFluxModel::New
Info<< "Selecting nucleateFluxModel: " << modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
if (!cstrIter.good())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -63,7 +63,7 @@ Foam::wallBoilingModels::nucleateFluxModel::New
) << abort(FatalIOError);
}
return cstrIter()(dict);
return ctorPtr(dict);
}

View File

@ -687,7 +687,7 @@ Foam::tmp<Foam::Field<Type>> Foam::surfaceWriter::adjustFieldTemplate
// Rotate fields (vector and non-spherical tensors)
if
(
(pTraits<Type>::rank != 0 && pTraits<Type>::nComponents > 1)
(is_vectorspace<Type>::value && pTraits<Type>::nComponents > 1)
&& geometryTransform_.good()
&& !geometryTransform_.R().is_identity()
)

View File

@ -219,22 +219,22 @@ void Foam::chemkinReader::addReactionType
break;
default:
{
if (rType < 3)
{
FatalErrorInFunction
<< "Reaction type " << reactionTypeNames[rType]
<< " on line " << lineNo_-1
<< " not handled by this function"
<< "Unhandled reaction type " << reactionTypeNames[rType]
<< " on line " << lineNo_-1 << nl
<< exit(FatalError);
}
else
{
FatalErrorInFunction
<< "Unknown reaction type " << rType
<< " on line " << lineNo_-1
<< "Unknown reaction type (" << int(rType)
<< "), on line " << lineNo_-1 << nl
<< exit(FatalError);
}
}
}
}
@ -401,10 +401,8 @@ void Foam::chemkinReader::addPressureDependentReaction
default:
{
FatalErrorInFunction
<< "Fall-off function type "
<< fallOffFunctionNames[fofType]
<< " on line " << lineNo_-1
<< " not implemented"
<< "Fall-off function type (" << int(fofType)
<< ") not implemented, line " << lineNo_-1
<< exit(FatalError);
}
}
@ -748,9 +746,8 @@ void Foam::chemkinReader::addReaction
default:
{
FatalErrorInFunction
<< "Reaction rate type " << reactionRateTypeNames[rrType]
<< " on line " << lineNo_-1
<< " not implemented"
<< "Reaction rate type (" << int(rrType)
<< ") not implemented, on line " << lineNo_-1
<< exit(FatalError);
}
}