STYLE: remove erroneous reference in dynamicCast use

This commit is contained in:
Mark Olesen 2021-05-31 09:02:57 +02:00
parent 5d9e42cb70
commit 0ba43df9c5
7 changed files with 63 additions and 76 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd. Copyright (C) 2017-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -60,46 +60,45 @@ bool Foam::dictionaryTokens::setIterator() const
{ {
const entry& base = *entryIter_; const entry& base = *entryIter_;
if (isA<primitiveEntry>(base))
{ {
primIter_.reset const auto* eptr = isA<primitiveEntry>(base);
( if (eptr)
new dictionaryTokens::primitive_iterator {
primIter_.reset
( (
dynamicCast<const primitiveEntry&>(base) new dictionaryTokens::primitive_iterator(*eptr)
) );
); return true;
}
return true;
}
else if (isA<dictionaryListEntry>(base))
{
// Must check for isA<dictionaryListEntry> before checking
// for isA<dictionaryEntry> !
dictIter_.reset
(
new dictionaryTokens::dictionary_iterator
(
dynamicCast<const dictionaryListEntry&>(base)
)
);
return true;
}
else if (isA<dictionaryEntry>(base))
{
dictIter_.reset
(
new dictionaryTokens::dictionary_iterator
(
dynamicCast<const dictionaryEntry&>(base)
)
);
return true;
} }
// NB: Must check for isA<dictionaryListEntry> before checking
// for isA<dictionaryEntry> !
{
const auto* eptr = isA<dictionaryListEntry>(base);
if (eptr)
{
dictIter_.reset
(
new dictionaryTokens::dictionary_iterator(*eptr)
);
return true;
}
}
{
const auto* eptr = isA<dictionaryEntry>(base);
if (eptr)
{
dictIter_.reset
(
new dictionaryTokens::dictionary_iterator(*eptr)
);
return true;
}
}
} }
return false; return false;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Original code Copyright (C) 2014-2018 Bernhard Gschaider Original code Copyright (C) 2014-2018 Bernhard Gschaider
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -92,14 +92,14 @@ addNamedToRunTimeSelectionTable
#define defineExpressionEntryType(DimType) \ #define defineExpressionEntryType(DimType) \
Foam::string Foam::exprTools::DimType##Entry::evaluate(const entry& e) \ Foam::string Foam::exprTools::DimType##Entry::evaluate(const entry& e) \
{ \ { \
DimType dt(dynamicCast<const primitiveEntry&>(e)); \ DimType dt(dynamicCast<const primitiveEntry>(e)); \
return toExprStr<DimType::value_type>(dt.value()); \ return toExprStr<DimType::value_type>(dt.value()); \
} }
Foam::string Foam::exprTools::dimensionedScalarEntry::evaluate(const entry& e) Foam::string Foam::exprTools::dimensionedScalarEntry::evaluate(const entry& e)
{ {
dimensionedScalar dt(dynamicCast<const primitiveEntry&>(e)); dimensionedScalar dt(dynamicCast<const primitiveEntry>(e));
return std::to_string(dt.value()); return std::to_string(dt.value());
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -43,38 +43,26 @@ bool Foam::vtk::writeTopoSet
bool parallel bool parallel
) )
{ {
if (isA<pointSet>(set))
{ {
return vtk::writePointSet const auto* ptr = isA<pointSet>(set);
( if (ptr)
mesh, {
dynamicCast<const pointSet&>(set), return vtk::writePointSet(mesh, *ptr, opts, file, parallel);
opts, }
file,
parallel
);
} }
else if (isA<faceSet>(set))
{ {
return vtk::writeFaceSet const auto* ptr = isA<faceSet>(set);
( if (ptr)
mesh, {
dynamicCast<const faceSet&>(set), return vtk::writeFaceSet(mesh, *ptr, opts, file, parallel);
opts, }
file,
parallel
);
} }
else if (isA<cellSet>(set))
{ {
return vtk::writeCellSetFaces const auto* ptr = isA<cellSet>(set);
( if (ptr)
mesh, {
dynamicCast<const cellSet&>(set), return vtk::writeCellSetFaces(mesh, *ptr, opts, file, parallel);
opts, }
file,
parallel
);
} }
WarningInFunction WarningInFunction

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -162,20 +162,20 @@ Foam::label Foam::cuttingPlane::calcCellCuts
if (debug && isA<fvMesh>(mesh)) if (debug && isA<fvMesh>(mesh))
{ {
const fvMesh& fvm = dynamicCast<const fvMesh&>(mesh); const auto& fvmesh = dynamicCast<const fvMesh>(mesh);
volScalarField cCuts volScalarField cCuts
( (
IOobject IOobject
( (
"cuttingPlane.cellCuts", "cuttingPlane.cellCuts",
fvm.time().timeName(), fvmesh.time().timeName(),
fvm.time(), fvmesh.time(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
fvm, fvmesh,
dimensionedScalar(dimless, Zero) dimensionedScalar(dimless, Zero)
); );

View File

@ -1196,7 +1196,7 @@ Foam::isoSurfaceCell::isoSurfaceCell
if (debug && isA<fvMesh>(mesh)) if (debug && isA<fvMesh>(mesh))
{ {
const fvMesh& fvmesh = dynamicCast<const fvMesh&>(mesh); const auto& fvmesh = dynamicCast<const fvMesh>(mesh);
volScalarField debugField volScalarField debugField
( (

View File

@ -1021,7 +1021,7 @@ Foam::isoSurfaceTopo::isoSurfaceTopo
if (debug && isA<fvMesh>(mesh)) if (debug && isA<fvMesh>(mesh))
{ {
const fvMesh& fvmesh = dynamicCast<const fvMesh&>(mesh); const auto& fvmesh = dynamicCast<const fvMesh>(mesh);
volScalarField debugField volScalarField debugField
( (

View File

@ -77,7 +77,7 @@ Foam::TDACChemistryModel<ReactionThermo, ThermoType>::TDACChemistryModel
autoPtr<HashTable<List<specieElement>>> specCompPtr autoPtr<HashTable<List<specieElement>>> specCompPtr
( (
dynamicCast<const reactingMixture<ThermoType>&>(this->thermo()) dynamicCast<const reactingMixture<ThermoType>>(this->thermo())
.specieComposition() .specieComposition()
); );