writeObjectsBase: Added static Switch logFalse for default initialisation of log

avoiding erroneously setting the log Switch reference to false when logging is
not required.
This commit is contained in:
Henry Weller
2022-10-09 22:07:55 +01:00
parent 56023e97fb
commit 03b17d695b
7 changed files with 20 additions and 14 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -118,7 +118,7 @@ public:
writeLocalObjects writeLocalObjects
( (
const objectRegistry& obr, const objectRegistry& obr,
const Switch& logRef const Switch& logRef = logFalse
); );
//- Disallow default bitwise copy construction //- Disallow default bitwise copy construction

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,6 +27,11 @@ License
#include "Time.H" #include "Time.H"
#include "dictionary.H" #include "dictionary.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::Switch Foam::functionObjects::writeObjectsBase::logFalse(false);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::functionObjects::writeObjectsBase::resetWriteObjectName void Foam::functionObjects::writeObjectsBase::resetWriteObjectName

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -96,6 +96,9 @@ protected:
//- Reference to the region objectRegistry //- Reference to the region objectRegistry
const objectRegistry& writeObr_; const objectRegistry& writeObr_;
//- False switch to which log_ defaults
static const Switch logFalse;
//- Reference to the inheriting function object's log variable //- Reference to the inheriting function object's log variable
const Switch& log_; const Switch& log_;
@ -131,7 +134,7 @@ public:
writeObjectsBase writeObjectsBase
( (
const objectRegistry& obr, const objectRegistry& obr,
const Switch& logRef const Switch& logRef = logFalse
); );
//- Disallow default bitwise copy construction //- Disallow default bitwise copy construction

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -56,7 +56,7 @@ Foam::functionObjects::Qdot::Qdot
) )
: :
fvMeshFunctionObject(name, runTime, dict), fvMeshFunctionObject(name, runTime, dict),
writeLocalObjects(obr_, false), writeLocalObjects(obr_),
phaseName_(word::null) phaseName_(word::null)
{ {
read(dict); read(dict);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -55,8 +55,6 @@ class Qdot
public fvMeshFunctionObject, public fvMeshFunctionObject,
public writeLocalObjects public writeLocalObjects
{ {
private:
// Private Data // Private Data
//- The name of the phase //- The name of the phase

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -52,7 +52,7 @@ Foam::functionObjects::shearStress::shearStress
) )
: :
fvMeshFunctionObject(name, runTime, dict), fvMeshFunctionObject(name, runTime, dict),
writeLocalObjects(obr_, false), writeLocalObjects(obr_),
phaseName_(word::null) phaseName_(word::null)
{ {
read(dict); read(dict);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,7 +49,7 @@ Foam::functionObjects::totalEnthalpy::totalEnthalpy
) )
: :
fvMeshFunctionObject(name, runTime, dict), fvMeshFunctionObject(name, runTime, dict),
writeLocalObjects(obr_, false), writeLocalObjects(obr_),
phaseName_(word::null) phaseName_(word::null)
{ {
read(dict); read(dict);