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", "procAddressing",
instance, instance,
fvMesh::meshSubDir, polyMesh::meshSubDir,
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -141,14 +141,6 @@ class age
//- Return true if convergence is reached //- Return true if convergence is reached
bool converged(const int nCorr, const scalar initialResidual) const; 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: public:

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021-2022 OpenCFD Ltd. Copyright (C) 2021-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -37,11 +37,11 @@ Foam::autoPtr<Foam::binModel> Foam::binModel::New
const word& outputPrefix 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 FatalIOErrorInLookup
( (
@ -52,7 +52,7 @@ Foam::autoPtr<Foam::binModel> Foam::binModel::New
) << exit(FatalIOError); ) << 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 \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd. Copyright (C) 2018-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -71,13 +71,14 @@ Foam::functionObjects::momentum::newField
( (
scopedName(baseName), scopedName(baseName),
time_.timeName(), time_.timeName(),
mesh_, mesh_.thisDb(),
IOobject::NO_READ, IOobjectOption::NO_READ,
IOobject::NO_WRITE, IOobjectOption::NO_WRITE,
registerObject registerObject
), ),
mesh_, mesh_,
dimensioned<typename GeoField::value_type>(dims, Zero) Foam::zero{}, // value
dims
); );
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -254,19 +254,21 @@ bool objectiveManager::writeObjectives
const bool valid const bool valid
) )
{ {
if (weightedObjectiveFile_.valid()) if (weightedObjectiveFile_)
{ {
auto& os = weightedObjectiveFile_();
unsigned int width = IOstream::defaultPrecision() + 5; unsigned int width = IOstream::defaultPrecision() + 5;
weightedObjectiveFile_()
os
<< setw(4) << mesh_.time().timeName() << " " << setw(4) << mesh_.time().timeName() << " "
<< setw(width) << weightedObjective << " "; << setw(width) << weightedObjective << " ";
for (objective& objI : objectives_) for (objective& objI : objectives_)
{ {
weightedObjectiveFile_() os << setw(width) << objI.JCycle() << " ";
<< setw(width) << objI.JCycle() << " ";
} }
weightedObjectiveFile_() << endl; os << endl;
} }
return writeObjectives(); 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 // Subtract target, in case the objective is used as a constraint
if (target_.valid()) if (target_)
{ {
if (negate) if (negate)
{ {
@ -541,12 +541,12 @@ bool objective::write(const bool valid) const
ios_base::fmtflags flags = file.flags(); ios_base::fmtflags flags = file.flags();
flags |= std::cout.left; flags |= std::cout.left;
file.flags(flags); file.flags(flags);
if (target_.valid()) if (target_)
{ {
file<< setw(width_) << "#target" << " " file<< setw(width_) << "#target" << " "
<< setw(width_) << target_() << endl; << setw(width_) << target_() << endl;
} }
if (targetLeft_.valid()) if (targetLeft_)
{ {
file<< setw(width_) << "#targetLeft" << " " file<< setw(width_) << "#targetLeft" << " "
<< setw(width_) << targetLeft_() << endl; << setw(width_) << targetLeft_() << endl;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -58,12 +58,12 @@ Foam::betaMaxDarcy::betaMaxDarcy
( (
IOobject IOobject
( (
"transportProperties", "transportProperties",
mesh.time().constant(), mesh.time().constant(),
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false IOobject::NO_REGISTER
) )
).get<dimensionedScalar>("nu").value(); ).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]]); const edge meshE = edge(mp[e[0]], mp[e[1]]);
auto iter = isInletEdge.find(meshE); auto iter = isInletEdge.find(meshE);
if (iter.found()) if (iter.good())
{ {
iter.val() = true; iter.val() = true;
} }
@ -196,9 +196,8 @@ Foam::boolList Foam::betaMax::markProcessorEdges
{ {
const edge& e = edges[edgeI]; const edge& e = edges[edgeI];
const edge meshE = edge(mp[e[0]], mp[e[1]]); 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; isProcessorEdge[edgeI - nInternalEdges] = true;
} }
@ -208,7 +207,6 @@ Foam::boolList Foam::betaMax::markProcessorEdges
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::betaMax::betaMax Foam::betaMax::betaMax
@ -232,11 +230,11 @@ Foam::autoPtr<Foam::betaMax> Foam::betaMax::New
{ {
const word modelType(dict.getOrDefault<word>("betaMaxType", "value")); const word modelType(dict.getOrDefault<word>("betaMaxType", "value"));
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType); auto* ctorPtr = dictionaryConstructorTable(modelType);
Info<< "betaMax type " << modelType << endl; Info<< "betaMax type " << modelType << endl;
if (!cstrIter.found()) if (!ctorPtr)
{ {
FatalIOErrorInLookup FatalIOErrorInLookup
( (
@ -247,7 +245,7 @@ Foam::autoPtr<Foam::betaMax> Foam::betaMax::New
) << exit(FatalIOError); ) << 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; Info<< "topOInterpolationFunction type : " << type << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(type); auto* ctorPtr = dictionaryConstructorTable(type);
if (!cstrIter.found()) if (!ctorPtr)
{ {
FatalIOErrorInLookup FatalIOErrorInLookup
( (
@ -77,7 +77,7 @@ Foam::topOInterpolationFunction::New
) << exit(FatalIOError); ) << 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 "fieldRegularisation.H"
#include "fixedValueFvPatchFields.H" #include "fixedValueFvPatchFields.H"
#include "zeroGradientFvPatchFields.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "fvm.H" #include "fvm.H"
@ -96,7 +95,7 @@ Foam::fieldRegularisation::fieldRegularisation
), ),
mesh_, mesh_,
dimensionedScalar(dimless, Zero), dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName fvPatchFieldBase::zeroGradientType()
) )
{ {
DebugInfo DebugInfo

View File

@ -138,11 +138,11 @@ Foam::autoPtr<Foam::regularisationPDE> Foam::regularisationPDE::New
const word modelType = const word modelType =
dict.getOrDefault<word>("regularisationPDE", "Helmholtz"); dict.getOrDefault<word>("regularisationPDE", "Helmholtz");
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType); auto* ctorPtr = dictionaryConstructorTable(modelType);
Info<< "regularisationPDE type " << modelType << endl; Info<< "regularisationPDE type " << modelType << endl;
if (!cstrIter.found()) if (!ctorPtr)
{ {
FatalIOErrorInLookup FatalIOErrorInLookup
( (
@ -155,7 +155,7 @@ Foam::autoPtr<Foam::regularisationPDE> Foam::regularisationPDE::New
return autoPtr<regularisationPDE> 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"); const word modelType = dict.getOrDefault<word>("type", "isotropic");
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType); auto* ctorPtr = dictionaryConstructorTable(modelType);
Info<< "regularisationRadius type " << modelType << endl; Info<< "regularisationRadius type " << modelType << endl;
if (!cstrIter.found()) if (!ctorPtr)
{ {
FatalIOErrorInLookup FatalIOErrorInLookup
( (
@ -79,7 +79,7 @@ Foam::autoPtr<Foam::regularisationRadius> Foam::regularisationRadius::New
return autoPtr<regularisationRadius> 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 // Multiply with line search step, if necessary
scalarField correction(direction); scalarField correction(direction);
if (lineSearch_.valid()) if (lineSearch_)
{ {
lineSearch_->updateCorrection(correction); lineSearch_->updateCorrection(correction);
} }
@ -551,9 +551,10 @@ void Foam::designVariablesUpdate::postUpdate(const scalarField& oldCorrection)
updateOldCorrection(oldCorrection); updateOldCorrection(oldCorrection);
write(); write();
designVars_->evolveNumber(); designVars_->evolveNumber();
if (lineSearch_.valid()) if (lineSearch_)
{ {
lineSearch_().postUpdate(); lineSearch_->postUpdate();
// Append additional empty line at the end of the instantaneous // Append additional empty line at the end of the instantaneous
// objective file to indicate the end of the block corresponding to // objective file to indicate the end of the block corresponding to
// this optimisation cycle // this optimisation cycle

View File

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

View File

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

View File

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

View File

@ -50,9 +50,9 @@ Foam::wallBoilingModels::nucleateFluxModel::New
Info<< "Selecting nucleateFluxModel: " << modelType << endl; Info<< "Selecting nucleateFluxModel: " << modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType); auto* ctorPtr = dictionaryConstructorTable(modelType);
if (!cstrIter.good()) if (!ctorPtr)
{ {
FatalIOErrorInLookup FatalIOErrorInLookup
( (
@ -63,7 +63,7 @@ Foam::wallBoilingModels::nucleateFluxModel::New
) << abort(FatalIOError); ) << 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) // Rotate fields (vector and non-spherical tensors)
if if
( (
(pTraits<Type>::rank != 0 && pTraits<Type>::nComponents > 1) (is_vectorspace<Type>::value && pTraits<Type>::nComponents > 1)
&& geometryTransform_.good() && geometryTransform_.good()
&& !geometryTransform_.R().is_identity() && !geometryTransform_.R().is_identity()
) )

View File

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