From acdf1ad74066c8ecf654b5b7585c4b20a3e836b1 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Wed, 2 Sep 2020 11:21:42 +0100 Subject: [PATCH] fvPatch: Removed unnecessary default arguments in lookupPatchField These were marked as being necessary to resolve a bug in Gcc, but no tested version of Gcc failed to compile with these removed. It is assumed that the Gcc bug is in a version older than those supported. Also added "db()" method to fvPatch in order to remove inclusion of fvPatchFvMeshTemplates.C in fvMesh.H. The resulting inclusion strategy is significantly simpler as a result. --- src/finiteVolume/fvMesh/fvMesh.H | 1 - .../fvMesh/fvPatches/fvPatch/fvPatch.C | 8 +++- .../fvMesh/fvPatches/fvPatch/fvPatch.H | 13 +++--- .../fvPatch/fvPatchFvMeshTemplates.C | 46 ------------------- .../fvPatches/fvPatch/fvPatchTemplates.C | 16 ++++++- 5 files changed, 28 insertions(+), 56 deletions(-) delete mode 100644 src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchFvMeshTemplates.C diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H index 10af91ef33..92a9806462 100644 --- a/src/finiteVolume/fvMesh/fvMesh.H +++ b/src/finiteVolume/fvMesh/fvMesh.H @@ -409,7 +409,6 @@ fvMesh::validComponents() const; #ifdef NoRepository #include "fvMeshTemplates.C" - #include "fvPatchFvMeshTemplates.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C index 177985b551..aba753520a 100644 --- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -90,6 +90,12 @@ Foam::wordList Foam::fvPatch::constraintTypes() } +const Foam::objectRegistry& Foam::fvPatch::db() const +{ + return boundaryMesh().mesh(); +} + + const Foam::labelUList& Foam::fvPatch::faceCells() const { return polyPatch_.faceCells(); diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H index d1735cba46..eb40910d15 100644 --- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,6 +53,7 @@ namespace Foam { class fvBoundaryMesh; +class objectRegistry; class surfaceInterpolation; /*---------------------------------------------------------------------------*\ @@ -182,6 +183,9 @@ public: return boundaryMesh_; } + //- Return the local object registry + const objectRegistry& db() const; + //- Slice list to patch template const typename List::subList patchSlice(const List& l) const @@ -253,15 +257,10 @@ public: //- Lookup and return the patchField of the named field from the // local objectRegistry. - // N.B. The dummy pointer arguments are used if this function is - // instantiated within a templated function to avoid a bug in gcc. - // See inletOutletFvPatchField.C and outletInletFvPatchField.C template const typename GeometricField::Patch& lookupPatchField ( - const word& name, - const GeometricField* = nullptr, - const Type* = nullptr + const word& name ) const; diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchFvMeshTemplates.C b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchFvMeshTemplates.C deleted file mode 100644 index 7cb4f03b75..0000000000 --- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchFvMeshTemplates.C +++ /dev/null @@ -1,46 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "fvPatch.H" - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -const typename GeometricField::Patch& Foam::fvPatch::lookupPatchField -( - const word& name, - const GeometricField*, - const Type* -) const -{ - return patchField - ( - boundaryMesh().mesh().objectRegistry::template - lookupObject(name) - ); -} - - -// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchTemplates.C b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchTemplates.C index 1763c0406d..43fe121f9b 100644 --- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchTemplates.C +++ b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "fvPatch.H" +#include "objectRegistry.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -85,4 +86,17 @@ typename GeometricField::Patch& Foam::fvPatch::patchField } +template +const typename GeometricField::Patch& Foam::fvPatch::lookupPatchField +( + const word& name +) const +{ + return patchField + ( + db().template lookupObject(name) + ); +} + + // ************************************************************************* //