diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C index 24b25675eb..4be7d70cdb 100644 --- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C +++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.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 @@ -196,14 +196,15 @@ int main(int argc, char *argv[]) if (dictIO.headerOk()) { Info<< "Refining according to " - << dictIO.path(typeGlobalFile()) << nl << endl; + << dictIO.path(typeGlobalFile::global) + << nl << endl; refineDict = IOdictionary(dictIO); } else { FatalErrorInFunction << "Cannot open specified refinement dictionary " - << dictIO.path(typeGlobalFile()) + << dictIO.path(typeGlobalFile::global) << exit(FatalError); } } @@ -212,14 +213,15 @@ int main(int argc, char *argv[]) if (dictIO.headerOk()) { Info<< "Refining according to " - << dictIO.path(typeGlobalFile()) << nl << endl; + << dictIO.path(typeGlobalFile::global) + << nl << endl; refineDict = IOdictionary(dictIO); } else { Info<< "Refinement dictionary " - << dictIO.path(typeGlobalFile()) << " not found" - << nl << endl; + << dictIO.path(typeGlobalFile::global) + << " not found" << nl << endl; } } diff --git a/src/OpenFOAM/db/IOobject/IOobject.H b/src/OpenFOAM/db/IOobject/IOobject.H index 76f9ef4b76..0da237b583 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.H +++ b/src/OpenFOAM/db/IOobject/IOobject.H @@ -500,19 +500,19 @@ public: template<> Ostream& operator<<(Ostream& os, const InfoProxy& ip); -//- Template function for obtaining global status +//- Trait for obtaining global status template -inline bool typeGlobal() +struct typeGlobal { - return false; -} + static const bool global = false; +}; -//- Template function for obtaining global write status +//- Trait for obtaining global write status template -inline bool typeGlobalFile() +struct typeGlobalFile { - return typeGlobal(); -} + static const bool global = typeGlobal::global; +}; inline IOobject unregister(const IOobject& io) { @@ -556,7 +556,7 @@ public: //- Return the object path for this Type inline fileName objectPath() const { - return objectPath(typeGlobalFile()); + return objectPath(typeGlobalFile::global); } using IOobject::filePath; @@ -564,7 +564,7 @@ public: //- Return the path for the file for this Type inline fileName filePath() const { - return filePath(Type::typeName, typeGlobalFile()); + return filePath(Type::typeName, typeGlobalFile::global); } }; diff --git a/src/OpenFOAM/db/IOobject/IOobjectTemplates.C b/src/OpenFOAM/db/IOobject/IOobjectTemplates.C index b997a26151..d9f9bff2dd 100644 --- a/src/OpenFOAM/db/IOobject/IOobjectTemplates.C +++ b/src/OpenFOAM/db/IOobject/IOobjectTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,7 @@ bool Foam::IOobject::typeHeaderOk(const bool checkType) // Everyone check or just master const bool masterOnly = - typeGlobal() + typeGlobal::global && ( IOobject::fileModificationChecking == timeStampMaster || IOobject::fileModificationChecking == inotifyMaster @@ -51,7 +51,7 @@ bool Foam::IOobject::typeHeaderOk(const bool checkType) { const fileName fName ( - filePath(Type::typeName, typeGlobalFile()) + filePath(Type::typeName, typeGlobalFile::global) ); ok = fp.readHeader(*this, fName, Type::typeName); diff --git a/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOField.H b/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOField.H index fcbefe312b..ec4acd29fe 100644 --- a/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOField.H +++ b/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOField.H @@ -69,6 +69,14 @@ public: }; +//- Trait for obtaining global status +template +struct typeGlobal> +{ + static const bool global = true; +}; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H b/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H index 66388e3a05..b1e823db28 100644 --- a/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H +++ b/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H @@ -142,6 +142,14 @@ public: }; +//- Trait for obtaining global status +template +struct typeGlobal> +{ + static const bool global = true; +}; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H index b8eb995688..72e80a492a 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.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 @@ -124,12 +124,12 @@ public: }; -//- Template function for obtaining global status +//- Trait for obtaining global status template<> -inline bool typeGlobal() +struct typeGlobal { - return true; -} + static const bool global = true; +}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/localIOdictionary.H b/src/OpenFOAM/db/IOobjects/IOdictionary/localIOdictionary.H index 078c260da2..7e2744db0c 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/localIOdictionary.H +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/localIOdictionary.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,12 +79,12 @@ public: }; -//- Template function for obtaining global status +//- Trait for obtaining global status template<> -inline bool typeGlobal() +struct typeGlobal { - return false; -} + static const bool global = false; +}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/timeIOdictionary.H b/src/OpenFOAM/db/IOobjects/IOdictionary/timeIOdictionary.H index 14e7bd1d73..c01c8b76d7 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/timeIOdictionary.H +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/timeIOdictionary.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -77,12 +77,12 @@ public: }; -//- Template function for obtaining global write status +//- Trait for obtaining global write status template<> -inline bool typeGlobalFile() +struct typeGlobalFile { - return false; -} + static const bool global = false; +}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/cfdTools/general/fvConstraints/fvConstraints.H b/src/finiteVolume/cfdTools/general/fvConstraints/fvConstraints.H index a879c58b01..0ffc16f9b7 100644 --- a/src/finiteVolume/cfdTools/general/fvConstraints/fvConstraints.H +++ b/src/finiteVolume/cfdTools/general/fvConstraints/fvConstraints.H @@ -179,12 +179,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -//- Template function for obtaining global status +//- Trait for obtaining global status template<> -inline bool typeGlobal() +struct typeGlobal { - return true; -} + static const bool global = true; +}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/cfdTools/general/fvModels/fvModels.H b/src/finiteVolume/cfdTools/general/fvModels/fvModels.H index 28d14decff..a9decb7c14 100644 --- a/src/finiteVolume/cfdTools/general/fvModels/fvModels.H +++ b/src/finiteVolume/cfdTools/general/fvModels/fvModels.H @@ -288,12 +288,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -//- Template function for obtaining global status +//- Trait for obtaining global status template<> -inline bool typeGlobal() +struct typeGlobal { - return true; -} + static const bool global = true; +}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/meshTools/coordinateSystems/coordinateSystems.H b/src/meshTools/coordinateSystems/coordinateSystems.H index e3fd28cc06..f80ac98400 100644 --- a/src/meshTools/coordinateSystems/coordinateSystems.H +++ b/src/meshTools/coordinateSystems/coordinateSystems.H @@ -156,7 +156,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template<> -inline bool typeGlobal +struct typeGlobal < MeshObject < @@ -164,10 +164,10 @@ inline bool typeGlobal GeometricMeshObject, coordinateSystems::coordinateSystems > ->() +> { - return true; -} + static const bool global = true; +}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H index b79282ffce..15eaf9e96e 100644 --- a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H +++ b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.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 @@ -143,12 +143,12 @@ public: }; -//- Template function for obtaining global status +//- Trait for obtaining global status template<> -inline bool typeGlobal() +struct typeGlobal { - return true; -} + static const bool global = true; +}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/meshTools/edgeMesh/featureEdgeMesh/featureEdgeMesh.H b/src/meshTools/edgeMesh/featureEdgeMesh/featureEdgeMesh.H index 563f04c84d..f3f3cd0847 100644 --- a/src/meshTools/edgeMesh/featureEdgeMesh/featureEdgeMesh.H +++ b/src/meshTools/edgeMesh/featureEdgeMesh/featureEdgeMesh.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 @@ -94,12 +94,12 @@ public: }; -//- Template function for obtaining global status +//- Trait for obtaining global status template<> -inline bool typeGlobal() +struct typeGlobal { - return true; -} + static const bool global = true; +}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.H b/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.H index d7da668b97..9f19b90023 100644 --- a/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.H +++ b/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.H @@ -374,12 +374,12 @@ public: }; -//- Template function for obtaining global status +//- Trait for obtaining global status template<> -inline bool typeGlobal() +struct typeGlobal { - return true; -} + static const bool global = true; +}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.H b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.H index dd139493e3..5ff2da6d90 100644 --- a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.H +++ b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.H @@ -469,12 +469,12 @@ public: }; -//- Template function for obtaining global status +//- Trait for obtaining global status template<> -inline bool typeGlobal() +struct typeGlobal { - return false; -} + static const bool global = false; +}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //