mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: use typed lookup versions instead of xyz::typeName literals
This commit is contained in:
@ -33,7 +33,7 @@ License
|
||||
template<class Type>
|
||||
void Foam::vtkUnstructuredReader::printFieldStats(const objectRegistry& obj)
|
||||
{
|
||||
const wordList fieldNames(obj.names(Type::typeName));
|
||||
const wordList fieldNames(obj.sortedNames<Type>());
|
||||
|
||||
if (fieldNames.size())
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2010-2018 Bernhard Gschaider
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -593,15 +593,15 @@ Foam::expressions::fvExprDriver::topoSetType(const word& setName) const
|
||||
{
|
||||
IOobject io(topoSet::findIOobject(mesh(), setName));
|
||||
|
||||
if (cellSet::typeName == io.headerClassName())
|
||||
if (io.isHeaderClass<cellSet>())
|
||||
{
|
||||
return topoSetSource::sourceType::CELLSET_SOURCE;
|
||||
}
|
||||
if (faceSet::typeName == io.headerClassName())
|
||||
if (io.isHeaderClass<faceSet>())
|
||||
{
|
||||
return topoSetSource::sourceType::FACESET_SOURCE;
|
||||
}
|
||||
if (pointSet::typeName == io.headerClassName())
|
||||
if (io.isHeaderClass<pointSet>())
|
||||
{
|
||||
return topoSetSource::sourceType::POINTSET_SOURCE;
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ Foam::expressions::fvExprDriver::getTopoSetLabels
|
||||
{
|
||||
typedef cellSet classType;
|
||||
|
||||
if (classType::typeName != io.headerClassName())
|
||||
if (!io.isHeaderClass<classType>())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Error reading " << classType::typeName
|
||||
@ -139,7 +139,7 @@ Foam::expressions::fvExprDriver::getTopoSetLabels
|
||||
{
|
||||
typedef faceSet classType;
|
||||
|
||||
if (classType::typeName != io.headerClassName())
|
||||
if (!io.isHeaderClass<classType>())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Error reading " << classType::typeName
|
||||
@ -157,7 +157,7 @@ Foam::expressions::fvExprDriver::getTopoSetLabels
|
||||
{
|
||||
typedef pointSet classType;
|
||||
|
||||
if (classType::typeName != io.headerClassName())
|
||||
if (!io.isHeaderClass<classType>())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Error reading " << classType::typeName
|
||||
|
||||
@ -131,7 +131,7 @@ void doCorrectBoundaryConditions
|
||||
template<class FieldType>
|
||||
bool Foam::functionObjects::fvExpressionField::loadAndStore(const IOobject& io)
|
||||
{
|
||||
if (FieldType::typeName == io.headerClassName())
|
||||
if (io.isHeaderClass<FieldType>())
|
||||
{
|
||||
// Store field on mesh database
|
||||
Log << " Reading " << io.name()
|
||||
|
||||
@ -167,10 +167,10 @@ void Foam::functionObjects::streamLineBase::initInterpolations
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find field " << fieldName << nl
|
||||
<< "Valid scalar fields are:"
|
||||
<< flatOutput(mesh_.names(volScalarField::typeName)) << nl
|
||||
<< "Valid vector fields are:"
|
||||
<< flatOutput(mesh_.names(volVectorField::typeName))
|
||||
<< "Valid scalar fields: "
|
||||
<< flatOutput(mesh_.sortedNames<volScalarField>()) << nl
|
||||
<< "Valid vector fields: "
|
||||
<< flatOutput(mesh_.sortedNames<volVectorField>()) << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,11 +198,11 @@ void Foam::fieldToCell::applyToSet
|
||||
<< "Cannot read field " << fieldName_
|
||||
<< " from time " << mesh().time().timeName() << endl;
|
||||
}
|
||||
// Note: should use volScalarField::typeName instead below
|
||||
// but that would introduce linkage problems (finiteVolume needs
|
||||
// meshTools)
|
||||
else if ("volScalarField" == fieldObject.headerClassName())
|
||||
{
|
||||
// Note: cannot use volScalarField::typeName since that would
|
||||
// introduce linkage problems (finiteVolume needs meshTools)
|
||||
|
||||
IFstream str(typeFilePath<labelIOList>(fieldObject));
|
||||
|
||||
// Read as dictionary
|
||||
@ -214,6 +214,9 @@ void Foam::fieldToCell::applyToSet
|
||||
}
|
||||
else if ("volVectorField" == fieldObject.headerClassName())
|
||||
{
|
||||
// Note: cannot use volVectorField::typeName since that would
|
||||
// introduce linkage problems (finiteVolume needs meshTools)
|
||||
|
||||
IFstream str(typeFilePath<labelIOList>(fieldObject));
|
||||
|
||||
// Read as dictionary
|
||||
|
||||
Reference in New Issue
Block a user