diff --git a/src/OpenFOAM/matrices/solution/solution.H b/src/OpenFOAM/matrices/solution/solution.H index 68bb0d8d7d..e6a8040c72 100644 --- a/src/OpenFOAM/matrices/solution/solution.H +++ b/src/OpenFOAM/matrices/solution/solution.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -112,6 +112,15 @@ public: //- Return true if the given field should be cached bool cache(const word& name) const; + //- Helper for printing cache message + template + static void cachePrintMessage + ( + const char* message, + const word& name, + const FieldType& vf + ); + //- Return true if the relaxation factor is given for the field bool relaxField(const word& name) const; @@ -148,6 +157,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository +# include "solutionTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/OpenFOAM/matrices/solution/solutionTemplates.C b/src/OpenFOAM/matrices/solution/solutionTemplates.C new file mode 100644 index 0000000000..6c16f79172 --- /dev/null +++ b/src/OpenFOAM/matrices/solution/solutionTemplates.C @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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 "solution.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +void Foam::solution::cachePrintMessage +( + const char* message, + const word& name, + const FieldType& vf +) +{ + if (solution::debug) + { + Info<< "Cache: " << message << token::SPACE << name + << ", originating from " << vf.name() + << " event No. " << vf.eventNo() + << endl; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C b/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C index d3d0116805..c7f49d3c83 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -87,25 +87,6 @@ Foam::fv::gradScheme::~gradScheme() // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - template - inline void cachePrintMessage - ( - const char* message, - const word& name, - const GeometricField& vf - ) - { - if (solution::debug) - { - Info<< "Cache: " << message << token::SPACE << name - << ", " << vf.name() << " event No. " << vf.eventNo() - << endl; - } - } -} - template Foam::tmp < @@ -129,12 +110,12 @@ Foam::fv::gradScheme::grad { if (!mesh().objectRegistry::template foundObject(name)) { - cachePrintMessage("Calculating and caching", name, vsf); + solution::cachePrintMessage("Calculating and caching", name, vsf); tmp tgGrad = calcGrad(vsf, name); regIOobject::store(tgGrad.ptr()); } - cachePrintMessage("Retrieving", name, vsf); + solution::cachePrintMessage("Retrieving", name, vsf); GradFieldType& gGrad = const_cast ( mesh().objectRegistry::template lookupObject(name) @@ -146,14 +127,14 @@ Foam::fv::gradScheme::grad } else { - cachePrintMessage("Deleting", name, vsf); + solution::cachePrintMessage("Deleting", name, vsf); gGrad.release(); delete &gGrad; - cachePrintMessage("Recalculating", name, vsf); + solution::cachePrintMessage("Recalculating", name, vsf); tmp tgGrad = calcGrad(vsf, name); - cachePrintMessage("Storing", name, vsf); + solution::cachePrintMessage("Storing", name, vsf); regIOobject::store(tgGrad.ptr()); GradFieldType& gGrad = const_cast ( @@ -180,13 +161,13 @@ Foam::fv::gradScheme::grad if (gGrad.ownedByRegistry()) { - cachePrintMessage("Deleting", name, vsf); + solution::cachePrintMessage("Deleting", name, vsf); gGrad.release(); delete &gGrad; } } - cachePrintMessage("Calculating", name, vsf); + solution::cachePrintMessage("Calculating", name, vsf); return calcGrad(vsf, name); } }