From 73c5624acf3b235ad8a6a58b0b8ec56ee3597913 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 1 Dec 2022 22:01:54 +0000 Subject: [PATCH] functionObjects/field: Simplified code using the VolField and SurfaceField partial specialisations replacing the inconsistently named local typedefs and direct use of the more complex GeometricField template types. --- .../blendingFactor/blendingFactorTemplates.C | 6 ++-- .../field/components/componentsTemplates.C | 13 +++----- src/functionObjects/field/ddt/ddtTemplates.C | 8 ++--- .../fieldCoordinateSystemTransformTemplates.C | 19 +++++------ .../fieldValueDeltaTemplates.C | 10 +++--- .../surfaceFieldValue/surfaceFieldValue.H | 4 +-- .../surfaceFieldValueTemplates.C | 33 +++++++++---------- .../volFieldValue/volFieldValueTemplates.C | 10 ++---- .../field/grad/gradTemplates.C | 11 +++---- src/functionObjects/field/mag/magTemplates.C | 13 +++----- .../field/magSqr/magSqrTemplates.C | 13 +++----- .../field/nearWallFields/nearWallFields.H | 6 ++-- .../nearWallFields/nearWallFieldsTemplates.C | 22 +++++-------- .../field/randomise/randomiseTemplates.C | 12 +++---- .../field/readFields/readFields.H | 6 ++-- .../field/readFields/readFieldsTemplates.C | 19 +++++------ .../field/reconstruct/reconstruct.C | 6 ++-- .../field/scale/scaleTemplates.C | 13 +++----- .../field/turbulenceFields/turbulenceFields.H | 2 +- .../turbulenceFieldsTemplates.C | 10 +++--- .../utilities/residuals/residualsTemplates.C | 10 ++---- 21 files changed, 100 insertions(+), 146 deletions(-) diff --git a/src/functionObjects/field/blendingFactor/blendingFactorTemplates.C b/src/functionObjects/field/blendingFactor/blendingFactorTemplates.C index aad44c0474..64b338e26e 100644 --- a/src/functionObjects/field/blendingFactor/blendingFactorTemplates.C +++ b/src/functionObjects/field/blendingFactor/blendingFactorTemplates.C @@ -32,14 +32,12 @@ License template bool Foam::functionObjects::blendingFactor::calcBF() { - typedef GeometricField FieldType; - - if (!foundObject(fieldName_)) + if (!foundObject>(fieldName_)) { return false; } - const FieldType& field = lookupObject(fieldName_); + const VolField& field = lookupObject>(fieldName_); const word divScheme("div(" + phiName_ + ',' + fieldName_ + ')'); ITstream& its = mesh_.schemes().div(divScheme); diff --git a/src/functionObjects/field/components/componentsTemplates.C b/src/functionObjects/field/components/componentsTemplates.C index 7b2c17f4fd..34aa1b0cd4 100644 --- a/src/functionObjects/field/components/componentsTemplates.C +++ b/src/functionObjects/field/components/componentsTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,16 +52,13 @@ bool Foam::functionObjects::components::calcFieldComponents() template bool Foam::functionObjects::components::calcComponents() { - typedef GeometricField VolFieldType; - typedef GeometricField SurfaceFieldType; - - if (foundObject(fieldName_)) + if (foundObject>(fieldName_)) { - return calcFieldComponents(); + return calcFieldComponents>(); } - else if (foundObject(fieldName_)) + else if (foundObject>(fieldName_)) { - return calcFieldComponents(); + return calcFieldComponents>(); } else { diff --git a/src/functionObjects/field/ddt/ddtTemplates.C b/src/functionObjects/field/ddt/ddtTemplates.C index f30d7c8849..0433f348d4 100644 --- a/src/functionObjects/field/ddt/ddtTemplates.C +++ b/src/functionObjects/field/ddt/ddtTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,14 +30,12 @@ License template bool Foam::functionObjects::ddt::calcDdt() { - typedef GeometricField VolFieldType; - - if (foundObject(fieldName_)) + if (foundObject>(fieldName_)) { return store ( resultName_, - fvc::ddt(lookupObject(fieldName_)) + fvc::ddt(lookupObject>(fieldName_)) ); } else diff --git a/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C b/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C index 350ad3a2dd..9ffaa8a626 100644 --- a/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C +++ b/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,7 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transformField const FieldType& field ) { - word transFieldName(transformFieldName(field.name())); + const word transFieldName(transformFieldName(field.name())); store ( @@ -52,25 +52,22 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform const word& fieldName ) { - typedef GeometricField VolFieldType; - typedef GeometricField SurfaceFieldType; - - if (mesh_.foundObject(fieldName)) + if (mesh_.foundObject>(fieldName)) { DebugInfo << type() << ": Field " << fieldName << endl; - transformField + transformField> ( - mesh_.lookupObject(fieldName) + mesh_.lookupObject>(fieldName) ); } - else if (mesh_.foundObject(fieldName)) + else if (mesh_.foundObject>(fieldName)) { DebugInfo << type() << ": Field " << fieldName << endl; - transformField + transformField> ( - mesh_.lookupObject(fieldName) + mesh_.lookupObject>(fieldName) ); } } diff --git a/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C b/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C index 486b59598e..e475c0882a 100644 --- a/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C +++ b/src/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -84,9 +84,6 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::processFields bool& found ) { - typedef GeometricField vf; - typedef GeometricField sf; - const wordList fields1 = region1Ptr_->fields(); const dictionary& results1 = region1Ptr_->resultDict(); @@ -101,7 +98,10 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::processFields if ( - (obr_.foundObject(fieldName) || obr_.foundObject(fieldName)) + ( + obr_.foundObject>(fieldName) + || obr_.foundObject>(fieldName) + ) && results2.found(fieldName) ) { diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H index f19f9e8191..5117375c7a 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H @@ -474,14 +474,14 @@ public: template tmp> filterField ( - const GeometricField& field + const SurfaceField& field ) const; //- Filter a volume field according to faceIds template tmp> filterField ( - const GeometricField& field + const VolField& field ) const; //- Read from dictionary diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C index 8276c3408e..f4b725924c 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,18 +38,15 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::validField const word& fieldName ) const { - typedef GeometricField sf; - typedef GeometricField vf; - if ( regionType_ != regionTypes::sampledSurface - && obr_.foundObject(fieldName) + && obr_.foundObject>(fieldName) ) { return true; } - else if (obr_.foundObject(fieldName)) + else if (obr_.foundObject>(fieldName)) { return true; } @@ -65,14 +62,12 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues const word& fieldName ) const { - typedef GeometricField vf; - typedef GeometricField sf; - if (regionType_ == regionTypes::sampledSurface) { - if (obr_.foundObject(fieldName)) + if (obr_.foundObject>(fieldName)) { - const vf& fld = obr_.lookupObject(fieldName); + const VolField& fld = + obr_.lookupObject>(fieldName); if (surfacePtr_().interpolate()) { @@ -102,7 +97,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues return surfacePtr_().sample(fld); } } - else if (obr_.foundObject(fieldName)) + else if (obr_.foundObject>(fieldName)) { FatalErrorInFunction << "Surface field " << fieldName @@ -113,14 +108,16 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues } else { - if (obr_.foundObject(fieldName)) + if (obr_.foundObject>(fieldName)) { - const vf& fld = obr_.lookupObject(fieldName); + const VolField& fld = + obr_.lookupObject>(fieldName); return filterField(fld); } - else if (obr_.foundObject(fieldName)) + else if (obr_.foundObject>(fieldName)) { - const sf& fld = obr_.lookupObject(fieldName); + const SurfaceField& fld = + obr_.lookupObject>(fieldName); return filterField(fld); } } @@ -408,7 +405,7 @@ template Foam::tmp> Foam::functionObjects::fieldValues::surfaceFieldValue::filterField ( - const GeometricField& field + const VolField& field ) const { tmp> tvalues(new Field(faceId_.size())); @@ -442,7 +439,7 @@ template Foam::tmp> Foam::functionObjects::fieldValues::surfaceFieldValue::filterField ( - const GeometricField& field + const SurfaceField& field ) const { tmp> tvalues(new Field(faceId_.size())); diff --git a/src/functionObjects/field/fieldValues/volFieldValue/volFieldValueTemplates.C b/src/functionObjects/field/fieldValues/volFieldValue/volFieldValueTemplates.C index 9221858549..a72a8e4e47 100644 --- a/src/functionObjects/field/fieldValues/volFieldValue/volFieldValueTemplates.C +++ b/src/functionObjects/field/fieldValues/volFieldValue/volFieldValueTemplates.C @@ -34,9 +34,7 @@ bool Foam::functionObjects::fieldValues::volFieldValue::validField const word& fieldName ) const { - typedef GeometricField vf; - - if (obr_.foundObject(fieldName)) + if (obr_.foundObject>(fieldName)) { return true; } @@ -52,11 +50,9 @@ Foam::functionObjects::fieldValues::volFieldValue::getFieldValues const word& fieldName ) const { - typedef GeometricField vf; - - if (obr_.foundObject(fieldName)) + if (obr_.foundObject>(fieldName)) { - return filterField(obr_.lookupObject(fieldName)); + return filterField(obr_.lookupObject>(fieldName)); } FatalErrorInFunction diff --git a/src/functionObjects/field/grad/gradTemplates.C b/src/functionObjects/field/grad/gradTemplates.C index d1d672ed86..7885a903f2 100644 --- a/src/functionObjects/field/grad/gradTemplates.C +++ b/src/functionObjects/field/grad/gradTemplates.C @@ -30,24 +30,21 @@ License template bool Foam::functionObjects::grad::calcGrad() { - typedef GeometricField VolFieldType; - typedef GeometricField SurfaceFieldType; - - if (foundObject(fieldName_)) + if (foundObject>(fieldName_)) { return store ( resultName_, - fvc::grad(lookupObject(fieldName_)), + fvc::grad(lookupObject>(fieldName_)), mesh_.changing() && mesh_.solution().cache(resultName_) ); } - else if (foundObject(fieldName_)) + else if (foundObject>(fieldName_)) { return store ( resultName_, - fvc::grad(lookupObject(fieldName_)), + fvc::grad(lookupObject>(fieldName_)), mesh_.changing() && mesh_.solution().cache(resultName_) ); } diff --git a/src/functionObjects/field/mag/magTemplates.C b/src/functionObjects/field/mag/magTemplates.C index c65c3cbad7..46072876b4 100644 --- a/src/functionObjects/field/mag/magTemplates.C +++ b/src/functionObjects/field/mag/magTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,23 +31,20 @@ License template bool Foam::functionObjects::mag::calcMag() { - typedef GeometricField VolFieldType; - typedef GeometricField SurfaceFieldType; - - if (foundObject(fieldName_)) + if (foundObject>(fieldName_)) { return store ( resultName_, - Foam::mag(lookupObject(fieldName_)) + Foam::mag(lookupObject>(fieldName_)) ); } - else if (foundObject(fieldName_)) + else if (foundObject>(fieldName_)) { return store ( resultName_, - Foam::mag(lookupObject(fieldName_)) + Foam::mag(lookupObject>(fieldName_)) ); } else diff --git a/src/functionObjects/field/magSqr/magSqrTemplates.C b/src/functionObjects/field/magSqr/magSqrTemplates.C index 1b359a27a5..dea5d54350 100644 --- a/src/functionObjects/field/magSqr/magSqrTemplates.C +++ b/src/functionObjects/field/magSqr/magSqrTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,23 +31,20 @@ License template bool Foam::functionObjects::magSqr::calcMagSqr() { - typedef GeometricField VolFieldType; - typedef GeometricField SurfaceFieldType; - - if (foundObject(fieldName_)) + if (foundObject>(fieldName_)) { return store ( resultName_, - Foam::magSqr(lookupObject(fieldName_)) + Foam::magSqr(lookupObject>(fieldName_)) ); } - else if (foundObject(fieldName_)) + else if (foundObject>(fieldName_)) { return store ( resultName_, - Foam::magSqr(lookupObject(fieldName_)) + Foam::magSqr(lookupObject>(fieldName_)) ); } else diff --git a/src/functionObjects/field/nearWallFields/nearWallFields.H b/src/functionObjects/field/nearWallFields/nearWallFields.H index b508e8d8a3..ff911668e2 100644 --- a/src/functionObjects/field/nearWallFields/nearWallFields.H +++ b/src/functionObjects/field/nearWallFields/nearWallFields.H @@ -147,7 +147,7 @@ protected: template void createFields ( - PtrList>& + PtrList>& ) const; //- Override boundary fields with sampled values @@ -155,13 +155,13 @@ protected: void sampleBoundaryField ( const interpolationCellPoint& interpolator, - GeometricField& fld + VolField& fld ) const; template void sampleFields ( - PtrList>& + PtrList>& ) const; diff --git a/src/functionObjects/field/nearWallFields/nearWallFieldsTemplates.C b/src/functionObjects/field/nearWallFields/nearWallFieldsTemplates.C index 974a7cbec7..e56d8c91f5 100644 --- a/src/functionObjects/field/nearWallFields/nearWallFieldsTemplates.C +++ b/src/functionObjects/field/nearWallFields/nearWallFieldsTemplates.C @@ -30,16 +30,14 @@ License template void Foam::functionObjects::nearWallFields::createFields ( - PtrList>& sflds + PtrList>& sflds ) const { - typedef GeometricField VolFieldType; + HashTable*> flds(obr_.lookupClass>()); - HashTable flds(obr_.lookupClass()); - - forAllConstIter(typename HashTable, flds, iter) + forAllConstIter(typename HashTable*>, flds, iter) { - const VolFieldType& fld = *iter(); + const VolField& fld = *iter(); if (fieldMap_.found(fld.name())) { @@ -59,7 +57,7 @@ void Foam::functionObjects::nearWallFields::createFields sflds.set ( sz, - new VolFieldType + new VolField ( IOobject ( @@ -84,7 +82,7 @@ template void Foam::functionObjects::nearWallFields::sampleBoundaryField ( const interpolationCellPoint& interpolator, - GeometricField& fld + VolField& fld ) const { // Construct flat fields for all patch faces to be sampled @@ -108,7 +106,7 @@ void Foam::functionObjects::nearWallFields::sampleBoundaryField sampledValues ); - typename GeometricField:: + typename VolField:: Boundary& fldBf = fld.boundaryFieldRef(); // Pick up data @@ -133,15 +131,13 @@ void Foam::functionObjects::nearWallFields::sampleBoundaryField template void Foam::functionObjects::nearWallFields::sampleFields ( - PtrList>& sflds + PtrList>& sflds ) const { - typedef GeometricField VolFieldType; - forAll(sflds, i) { const word& fldName = reverseFieldMap_[sflds[i].name()]; - const VolFieldType& fld = obr_.lookupObject(fldName); + const VolField& fld = obr_.lookupObject>(fldName); // Take over internal and boundary values sflds[i] == fld; diff --git a/src/functionObjects/field/randomise/randomiseTemplates.C b/src/functionObjects/field/randomise/randomiseTemplates.C index fa50d10017..eab4379618 100644 --- a/src/functionObjects/field/randomise/randomiseTemplates.C +++ b/src/functionObjects/field/randomise/randomiseTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,14 +31,12 @@ License template bool Foam::functionObjects::randomise::calcRandomised() { - typedef GeometricField VolFieldType; - - if (foundObject(fieldName_)) + if (foundObject>(fieldName_)) { - const VolFieldType& field = lookupObject(fieldName_); + const VolField& field = lookupObject>(fieldName_); - tmp rfieldt(new VolFieldType(field)); - VolFieldType& rfield = rfieldt.ref(); + tmp> rfieldt(new VolField(field)); + VolField& rfield = rfieldt.ref(); Random rand(1234567); diff --git a/src/functionObjects/field/readFields/readFields.H b/src/functionObjects/field/readFields/readFields.H index 295b7b79ee..55f14caf03 100644 --- a/src/functionObjects/field/readFields/readFields.H +++ b/src/functionObjects/field/readFields/readFields.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -107,8 +107,8 @@ protected: void loadField ( const word&, - PtrList>&, - PtrList>& + PtrList>&, + PtrList>& ) const; diff --git a/src/functionObjects/field/readFields/readFieldsTemplates.C b/src/functionObjects/field/readFields/readFieldsTemplates.C index db762a697b..77dc19b9c5 100644 --- a/src/functionObjects/field/readFields/readFieldsTemplates.C +++ b/src/functionObjects/field/readFields/readFieldsTemplates.C @@ -34,20 +34,17 @@ template void Foam::functionObjects::readFields::loadField ( const word& fieldName, - PtrList>& vflds, - PtrList>& sflds + PtrList>& vflds, + PtrList>& sflds ) const { - typedef GeometricField VolFieldType; - typedef GeometricField SurfaceFieldType; - - if (obr_.foundObject(fieldName)) + if (obr_.foundObject>(fieldName)) { DebugInfo << "readFields : Field " << fieldName << " already in database" << endl; } - else if (obr_.foundObject(fieldName)) + else if (obr_.foundObject>(fieldName)) { DebugInfo << "readFields : Field " << fieldName @@ -67,7 +64,7 @@ void Foam::functionObjects::readFields::loadField if ( fieldHeader.headerOk() - && fieldHeader.headerClassName() == VolFieldType::typeName + && fieldHeader.headerClassName() == VolField::typeName ) { // Store field locally @@ -75,12 +72,12 @@ void Foam::functionObjects::readFields::loadField label sz = vflds.size(); vflds.setSize(sz+1); - vflds.set(sz, new VolFieldType(fieldHeader, mesh_)); + vflds.set(sz, new VolField(fieldHeader, mesh_)); } else if ( fieldHeader.headerOk() - && fieldHeader.headerClassName() == SurfaceFieldType::typeName + && fieldHeader.headerClassName() == SurfaceField::typeName ) { // Store field locally @@ -88,7 +85,7 @@ void Foam::functionObjects::readFields::loadField label sz = sflds.size(); sflds.setSize(sz+1); - sflds.set(sz, new SurfaceFieldType(fieldHeader, mesh_)); + sflds.set(sz, new SurfaceField(fieldHeader, mesh_)); } } } diff --git a/src/functionObjects/field/reconstruct/reconstruct.C b/src/functionObjects/field/reconstruct/reconstruct.C index 4664f9386a..1701abf8c7 100644 --- a/src/functionObjects/field/reconstruct/reconstruct.C +++ b/src/functionObjects/field/reconstruct/reconstruct.C @@ -44,14 +44,12 @@ namespace functionObjects template bool Foam::functionObjects::reconstruct::calcReconstruction() { - typedef GeometricField SurfaceFieldType; - - if (foundObject(fieldName_)) + if (foundObject>(fieldName_)) { return store ( resultName_, - fvc::reconstruct(lookupObject(fieldName_)), + fvc::reconstruct(lookupObject>(fieldName_)), mesh_.changing() && mesh_.solution().cache(resultName_) ); } diff --git a/src/functionObjects/field/scale/scaleTemplates.C b/src/functionObjects/field/scale/scaleTemplates.C index 7b7763eb72..76eccef800 100644 --- a/src/functionObjects/field/scale/scaleTemplates.C +++ b/src/functionObjects/field/scale/scaleTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,23 +31,20 @@ License template bool Foam::functionObjects::scale::calcScale() { - typedef GeometricField VolFieldType; - typedef GeometricField SurfaceFieldType; - - if (foundObject(fieldName_)) + if (foundObject>(fieldName_)) { return store ( resultName_, - scale_*lookupObject(fieldName_) + scale_*lookupObject>(fieldName_) ); } - else if (foundObject(fieldName_)) + else if (foundObject>(fieldName_)) { return store ( resultName_, - scale_*lookupObject(fieldName_) + scale_*lookupObject>(fieldName_) ); } else diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFields.H b/src/functionObjects/field/turbulenceFields/turbulenceFields.H index a5c59ea533..2e042a2fb4 100644 --- a/src/functionObjects/field/turbulenceFields/turbulenceFields.H +++ b/src/functionObjects/field/turbulenceFields/turbulenceFields.H @@ -158,7 +158,7 @@ protected: void processField ( const word& fieldName, - const tmp>& tvalue + const tmp>& tvalue ); diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C b/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C index 5e227bf12d..5b9b2db4cb 100644 --- a/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C +++ b/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C @@ -31,19 +31,17 @@ template void Foam::functionObjects::turbulenceFields::processField ( const word& fieldName, - const tmp>& tvalue + const tmp>& tvalue ) { - typedef GeometricField FieldType; - const word scopedName ( IOobject::groupName(prefix_ + fieldName, phaseName_) ); - if (obr_.foundObject(scopedName)) + if (obr_.foundObject>(scopedName)) { - obr_.lookupObjectRef(scopedName) == tvalue(); + obr_.lookupObjectRef>(scopedName) == tvalue(); } else if (obr_.found(scopedName)) { @@ -56,7 +54,7 @@ void Foam::functionObjects::turbulenceFields::processField { obr_.store ( - new FieldType + new VolField ( IOobject ( diff --git a/src/functionObjects/utilities/residuals/residualsTemplates.C b/src/functionObjects/utilities/residuals/residualsTemplates.C index 557729bd8f..a6b46ce494 100644 --- a/src/functionObjects/utilities/residuals/residualsTemplates.C +++ b/src/functionObjects/utilities/residuals/residualsTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,9 +33,7 @@ License template void Foam::functionObjects::residuals::writeFileHeader(const word& fieldName) { - typedef GeometricField fieldType; - - if (obr_.foundObject(fieldName)) + if (obr_.foundObject>(fieldName)) { typename pTraits::labelType validComponents ( @@ -60,9 +58,7 @@ void Foam::functionObjects::residuals::writeFileHeader(const word& fieldName) template void Foam::functionObjects::residuals::writeResidual(const word& fieldName) { - typedef GeometricField fieldType; - - if (obr_.foundObject(fieldName)) + if (obr_.foundObject>(fieldName)) { if (Residuals::found(mesh_, fieldName)) {