From 828a8bf32681b4c813abdf9e91414b85b19581cc Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 22 Aug 2013 17:12:38 +0100 Subject: [PATCH 1/7] Mixing plane update --- .../Case1.1_mixingPlane_sector_AB_60deg/system/fvSchemes | 4 +++- .../system/fvSchemes | 6 +++++- .../twoBlocksMixingPlane_dirY_spanZ/system/fvSchemes | 6 +++++- .../twoBlocksMixingPlane_dirZ_spanY/system/fvSchemes | 6 +++++- .../simpleFoam/mixingPlaneAxial/system/fvSchemes | 8 +++++++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/system/fvSchemes b/tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/system/fvSchemes index e4d576141..aa65ec5da 100644 --- a/tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/system/fvSchemes +++ b/tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/system/fvSchemes @@ -70,6 +70,8 @@ fluxRequired mixingPlane { - default zeroGradient; + default areaAveraging; } + + // ************************************************************************* // diff --git a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlaneMismatch_dirY_spanZ/system/fvSchemes b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlaneMismatch_dirY_spanZ/system/fvSchemes index cfb797a4e..befc9ee32 100644 --- a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlaneMismatch_dirY_spanZ/system/fvSchemes +++ b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlaneMismatch_dirY_spanZ/system/fvSchemes @@ -57,6 +57,10 @@ fluxRequired mixingPlane { - default zeroGradient; + default areaAveraging; + p areaAveraging; + U fluxAveraging; } + + // ************************************************************************* // diff --git a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirY_spanZ/system/fvSchemes b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirY_spanZ/system/fvSchemes index cfb797a4e..befc9ee32 100644 --- a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirY_spanZ/system/fvSchemes +++ b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirY_spanZ/system/fvSchemes @@ -57,6 +57,10 @@ fluxRequired mixingPlane { - default zeroGradient; + default areaAveraging; + p areaAveraging; + U fluxAveraging; } + + // ************************************************************************* // diff --git a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirZ_spanY/system/fvSchemes b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirZ_spanY/system/fvSchemes index cfb797a4e..befc9ee32 100644 --- a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirZ_spanY/system/fvSchemes +++ b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirZ_spanY/system/fvSchemes @@ -57,6 +57,10 @@ fluxRequired mixingPlane { - default zeroGradient; + default areaAveraging; + p areaAveraging; + U fluxAveraging; } + + // ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/mixingPlaneAxial/system/fvSchemes b/tutorials/incompressible/simpleFoam/mixingPlaneAxial/system/fvSchemes index 5a533e6a7..2693f4302 100644 --- a/tutorials/incompressible/simpleFoam/mixingPlaneAxial/system/fvSchemes +++ b/tutorials/incompressible/simpleFoam/mixingPlaneAxial/system/fvSchemes @@ -69,7 +69,13 @@ fluxRequired mixingPlane { - default zeroGradient; + default areaAveraging; + p areaAveraging; + U fluxAveraging; + + k fluxAveraging; + epsilon fluxAveraging; } + // ************************************************************************* // From a47a1b55772720a5926566ccbd9b7a2d0b847cdd Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 26 Aug 2013 11:59:53 +0100 Subject: [PATCH 2/7] Safe execution when phi is not present --- ...sureInletOutletVelocityFvPatchVectorField.C | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C index 9e470b5d2..9b6ff6b8f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C @@ -175,10 +175,22 @@ void pressureInletOutletVelocityFvPatchVectorField::updateCoeffs() return; } - const fvsPatchField& phip = - lookupPatchField(phiName_); + if (this->db().objectRegistry::found(phiName_)) + { + const fvsPatchField& phip = + lookupPatchField(phiName_); - valueFraction() = neg(phip)*(I - sqr(patch().nf())); + valueFraction() = neg(phip)*(I - sqr(patch().nf())); + } + else + { + InfoIn + ( + "pressureInletOutletVelocityFvPatchVectorField::updateCoeffs()" + )<< "Cannot find phi. Return" << endl; + + valueFraction() = symmTensor::one; + } directionMixedFvPatchVectorField::updateCoeffs(); directionMixedFvPatchVectorField::evaluate(); From 244849fac235523353fc4dd8809a723bdce354b7 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 26 Aug 2013 12:00:13 +0100 Subject: [PATCH 3/7] Profiling update, Bernhard Gscheider --- src/OpenFOAM/Make/files | 8 +-- src/OpenFOAM/db/Time/Time.C | 22 +++++--- src/OpenFOAM/db/Time/TimeIO.C | 2 +- .../functionObjectList/functionObjectList.C | 2 +- .../Profiling.H => profiling/profiling.H} | 12 ++--- .../profilingInfo.C} | 20 ++++---- .../profilingInfo.H} | 49 +++++++++--------- .../profilingPool.C} | 42 ++++++++-------- .../profilingPool.H} | 50 +++++++++---------- .../profilingStack.C} | 36 ++++++------- .../profilingStack.H} | 40 +++++++-------- .../profilingTrigger.C} | 16 +++--- .../profilingTrigger.H} | 30 +++++------ .../BlockLduMatrix/BlockLduMatrixATmul.C | 3 ++ .../matrices/lduMatrix/lduMatrix/lduMatrix.H | 5 +- .../solvers/smoothSolver/smoothSolver.C | 6 +-- .../fvMatrices/fvMatrix/fvMatrixSolve.C | 4 +- .../fvScalarMatrix/fvScalarMatrix.C | 4 +- .../fvMatrices/solvers/MULES/MULES.C | 6 +-- src/lagrangian/basic/Cloud/Cloud.C | 2 +- src/lduSolvers/Make/files | 2 + 21 files changed, 186 insertions(+), 175 deletions(-) rename src/OpenFOAM/global/{Profiling/Profiling.H => profiling/profiling.H} (88%) rename src/OpenFOAM/global/{Profiling/ProfilingInfo.C => profiling/profilingInfo.C} (85%) rename src/OpenFOAM/global/{Profiling/ProfilingInfo.H => profiling/profilingInfo.H} (81%) rename src/OpenFOAM/global/{Profiling/ProfilingPool.C => profiling/profilingPool.C} (76%) rename src/OpenFOAM/global/{Profiling/ProfilingPool.H => profiling/profilingPool.H} (72%) rename src/OpenFOAM/global/{Profiling/ProfilingStack.C => profiling/profilingStack.C} (73%) rename src/OpenFOAM/global/{Profiling/ProfilingStack.H => profiling/profilingStack.H} (77%) rename src/OpenFOAM/global/{Profiling/ProfilingTrigger.C => profiling/profilingTrigger.C} (84%) rename src/OpenFOAM/global/{Profiling/ProfilingTrigger.H => profiling/profilingTrigger.H} (81%) diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index db1ffb7f3..ea42e3ce8 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -3,10 +3,10 @@ global/dimensionedConstants/dimensionedConstants.C global/argList/argList.C global/clock/clock.C -global/Profiling/ProfilingInfo.C -global/Profiling/ProfilingPool.C -global/Profiling/ProfilingStack.C -global/Profiling/ProfilingTrigger.C +global/profiling/profilingInfo.C +global/profiling/profilingPool.C +global/profiling/profilingStack.C +global/profiling/profilingTrigger.C bools = primitives/bools $(bools)/bool/bool.C diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index b552dae85..c5b00a86d 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -27,8 +27,8 @@ License #include "Time.H" #include "PstreamReduceOps.H" -#include "ProfilingPool.H" -#include "Profiling.H" +#include "profilingPool.H" +#include "profiling.H" #include @@ -242,8 +242,10 @@ Foam::Time::Time { setControls(); - ProfilingPool::initProfiling( - IOobject( + profilingPool::initprofiling + ( + IOobject + ( "profilingInfo", timeName(), "uniform", @@ -310,8 +312,10 @@ Foam::Time::Time { setControls(); - ProfilingPool::initProfiling( - IOobject( + profilingPool::initprofiling + ( + IOobject + ( "profilingInfo", timeName(), "uniform", @@ -374,8 +378,10 @@ Foam::Time::Time readLibs_(controlDict_, "libs"), functionObjects_(*this, enableFunctionObjects) { - ProfilingPool::initProfiling( - IOobject( + profilingPool::initprofiling + ( + IOobject + ( "profilingInfo", timeName(), "uniform", diff --git a/src/OpenFOAM/db/Time/TimeIO.C b/src/OpenFOAM/db/Time/TimeIO.C index 4bedbaa0c..1c159ae10 100644 --- a/src/OpenFOAM/db/Time/TimeIO.C +++ b/src/OpenFOAM/db/Time/TimeIO.C @@ -27,7 +27,7 @@ License #include "Time.H" #include "PstreamReduceOps.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 109244985..7d1a986a5 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -27,7 +27,7 @@ License #include "functionObjectList.H" #include "Time.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/Profiling/Profiling.H b/src/OpenFOAM/global/profiling/profiling.H similarity index 88% rename from src/OpenFOAM/global/Profiling/Profiling.H rename to src/OpenFOAM/global/profiling/profiling.H index f51c8451e..e6ffbdaf4 100644 --- a/src/OpenFOAM/global/Profiling/Profiling.H +++ b/src/OpenFOAM/global/profiling/profiling.H @@ -25,7 +25,7 @@ License Class Description - Add everything necessary for Profiling plus a macro + Add everything necessary for profiling plus a macro Originally proposed in http://www.cfd-online.com/Forums/openfoam-bugs/64081-feature-proposal-application-level-profiling.html @@ -34,17 +34,17 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Profiling_H -#define Profiling_H +#ifndef profiling_H +#define profiling_H -#include "ProfilingTrigger.H" +#include "profilingTrigger.H" // to be used at the beginning of a section to be profiled // profiling ends automatically at the end of a block -#define addProfile(name) Foam::ProfilingTrigger profileTriggerFor##name (#name) +#define addProfile(name) Foam::profilingTrigger profileTriggerFor##name (#name) // Use this if a description with spaces, colons etc should be added -#define addProfile2(name,descr) Foam::ProfilingTrigger profileTriggerFor##name (descr) +#define addProfile2(name,descr) Foam::profilingTrigger profileTriggerFor##name (descr) // this is only needed if profiling should end before the end of a block #define endProfile(name) profileTriggerFor##name.stop() diff --git a/src/OpenFOAM/global/Profiling/ProfilingInfo.C b/src/OpenFOAM/global/profiling/profilingInfo.C similarity index 85% rename from src/OpenFOAM/global/Profiling/ProfilingInfo.C rename to src/OpenFOAM/global/profiling/profilingInfo.C index e56496baa..b9f74a971 100644 --- a/src/OpenFOAM/global/Profiling/ProfilingInfo.C +++ b/src/OpenFOAM/global/profiling/profilingInfo.C @@ -24,21 +24,21 @@ License \*---------------------------------------------------------------------------*/ -#include "ProfilingInfo.H" +#include "profilingInfo.H" #include "dictionary.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -Foam::label Foam::ProfilingInfo::nextId_(0); +Foam::label Foam::profilingInfo::nextId_(0); -Foam::label Foam::ProfilingInfo::getID() +Foam::label Foam::profilingInfo::getID() { nextId_++; return nextId_; } -void Foam::ProfilingInfo::raiseID(label maxVal) +void Foam::profilingInfo::raiseID(label maxVal) { if(maxVal>nextId_) { nextId_=maxVal; @@ -50,7 +50,7 @@ void Foam::ProfilingInfo::raiseID(label maxVal) // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::ProfilingInfo::ProfilingInfo() +Foam::profilingInfo::profilingInfo() : calls_(0), totalTime_(0.), @@ -62,7 +62,7 @@ Foam::ProfilingInfo::ProfilingInfo() {} -Foam::ProfilingInfo::ProfilingInfo(ProfilingInfo &parent,const string &descr) +Foam::profilingInfo::profilingInfo(profilingInfo &parent,const string &descr) : calls_(0), totalTime_(0.), @@ -75,13 +75,13 @@ Foam::ProfilingInfo::ProfilingInfo(ProfilingInfo &parent,const string &descr) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::ProfilingInfo::~ProfilingInfo() +Foam::profilingInfo::~profilingInfo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::ProfilingInfo::update(scalar elapsedTimee) +void Foam::profilingInfo::update(scalar elapsedTimee) { calls_++; totalTime_+=elapsedTimee; @@ -90,7 +90,7 @@ void Foam::ProfilingInfo::update(scalar elapsedTimee) } } -void Foam::ProfilingInfo::writeWithOffset(Ostream &os,bool offset,scalar time,scalar childTimes) const +void Foam::profilingInfo::writeWithOffset(Ostream &os,bool offset,scalar time,scalar childTimes) const { dictionary tmp; @@ -112,7 +112,7 @@ void Foam::ProfilingInfo::writeWithOffset(Ostream &os,bool offset,scalar time,sc // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // -Foam::Ostream& Foam::operator<<(Ostream& os, const ProfilingInfo& info) +Foam::Ostream& Foam::operator<<(Ostream& os, const profilingInfo& info) { info.writeWithOffset(os); diff --git a/src/OpenFOAM/global/Profiling/ProfilingInfo.H b/src/OpenFOAM/global/profiling/profilingInfo.H similarity index 81% rename from src/OpenFOAM/global/Profiling/ProfilingInfo.H rename to src/OpenFOAM/global/profiling/profilingInfo.H index 7891733ec..beeacd8ed 100644 --- a/src/OpenFOAM/global/Profiling/ProfilingInfo.H +++ b/src/OpenFOAM/global/profiling/profilingInfo.H @@ -23,18 +23,18 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::ProfilingInfo + Foam::profilingInfo Description Information needed for profiling SourceFiles - ProfilingInfo.C + profilingInfo.C \*---------------------------------------------------------------------------*/ -#ifndef ProfilingInfo_H -#define ProfilingInfo_H +#ifndef profilingInfo_H +#define profilingInfo_H #include "label.H" #include "scalar.H" @@ -45,19 +45,20 @@ namespace Foam { // Forward declaration of classes - // class Istream; - class Ostream; - class ProfilingStack; - class ProfilingPool; - class ProfilingInfo; - Ostream& operator<<(Ostream&, const ProfilingInfo&); +// class Istream; +class Ostream; +class profilingStack; +class profilingPool; +class profilingInfo; + +Ostream& operator<<(Ostream&, const profilingInfo&); /*---------------------------------------------------------------------------*\ - Class ProfilingInfo Declaration + Class profilingInfo Declaration \*---------------------------------------------------------------------------*/ -class ProfilingInfo +class profilingInfo { // Private data @@ -74,7 +75,7 @@ class ProfilingInfo label id_; // pointer to the parent object (if there is any) - ProfilingInfo &parent_; + profilingInfo &parent_; // what this does string description_; @@ -85,10 +86,10 @@ class ProfilingInfo // Private Member Functions //- Disallow default bitwise copy construct - ProfilingInfo(const ProfilingInfo&); + profilingInfo(const profilingInfo&); //- Disallow default bitwise assignment - void operator=(const ProfilingInfo&); + void operator=(const profilingInfo&); // Static data members @@ -110,7 +111,7 @@ protected: { onStack_=false; } //- Construct null - only the master-element - ProfilingInfo(); + profilingInfo(); void writeWithOffset(Ostream &os,bool offset=false,scalar time=0,scalar childTime=0) const; @@ -119,14 +120,14 @@ public: // Constructors //- Construct from components - ProfilingInfo(ProfilingInfo &parent,const string &descr); + profilingInfo(profilingInfo &parent,const string &descr); // //- Construct from Istream -// ProfilingInfo(Istream&); +// profilingInfo(Istream&); // Destructor - ~ProfilingInfo(); + ~profilingInfo(); // Member Functions @@ -151,19 +152,19 @@ public: const string &description() const { return description_; } - const ProfilingInfo &parent() const + const profilingInfo &parent() const { return parent_; } //- Update it with a new timing information void update(scalar elapsedTime); - friend class ProfilingStack; - friend class ProfilingPool; + friend class profilingStack; + friend class profilingPool; // IOstream Operators - // friend Istream& operator>>(Istream&, ProfilingInfo&); - friend Ostream& operator<<(Ostream&, const ProfilingInfo&); + // friend Istream& operator>>(Istream&, profilingInfo&); + friend Ostream& operator<<(Ostream&, const profilingInfo&); }; diff --git a/src/OpenFOAM/global/Profiling/ProfilingPool.C b/src/OpenFOAM/global/profiling/profilingPool.C similarity index 76% rename from src/OpenFOAM/global/Profiling/ProfilingPool.C rename to src/OpenFOAM/global/profiling/profilingPool.C index 722129085..8a2928f5e 100644 --- a/src/OpenFOAM/global/Profiling/ProfilingPool.C +++ b/src/OpenFOAM/global/profiling/profilingPool.C @@ -24,18 +24,18 @@ License \*---------------------------------------------------------------------------*/ -#include "ProfilingPool.H" +#include "profilingPool.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -Foam::ProfilingPool* Foam::ProfilingPool::thePool_(NULL); +Foam::profilingPool* Foam::profilingPool::thePool_(NULL); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::ProfilingPool::ProfilingPool(const IOobject &ob) +Foam::profilingPool::profilingPool(const IOobject &ob) : regIOobject(ob), globalTime_() @@ -45,7 +45,7 @@ Foam::ProfilingPool::ProfilingPool(const IOobject &ob) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::ProfilingPool::~ProfilingPool() +Foam::profilingPool::~profilingPool() { for(mapIterator it=map().begin();it!=map().end();++it) { delete it->second; @@ -56,32 +56,32 @@ Foam::ProfilingPool::~ProfilingPool() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::ProfilingPool::initProfiling(const IOobject &ob) +void Foam::profilingPool::initprofiling(const IOobject &ob) { if(thePool_!=NULL) { - WarningIn("Foam::ProfilingPool::initProfiling(const IOobject &)") + WarningIn("Foam::profilingPool::initprofiling(const IOobject &)") << "Singleton already initialized\n" << endl; } else { - thePool_=new ProfilingPool(ob); - ProfilingInfo *master=new ProfilingInfo(); + thePool_=new profilingPool(ob); + profilingInfo *master=new profilingInfo(); thePool_->map().insert(make_pair(master->description(),master)); thePool_->stack().push(*master); - ProfilingPool::rememberTimer(*master,thePool_->globalTime_); + profilingPool::rememberTimer(*master,thePool_->globalTime_); } } -Foam::ProfilingInfo &Foam::ProfilingPool::getInfo(const string &name) +Foam::profilingInfo &Foam::profilingPool::getInfo(const string &name) { if(thePool_==NULL) { - FatalErrorIn("Foam::ProfilingPool::addInfo(const string &name)") + FatalErrorIn("Foam::profilingPool::addInfo(const string &name)") << "Sinleton not initialized\n" << endl << abort(FatalError); } - ProfilingStack &stack=thePool_->stack(); + profilingStack &stack=thePool_->stack(); mapType &map=thePool_->map(); - ProfilingInfo *found=NULL; + profilingInfo *found=NULL; for(mapIterator it=map.lower_bound(name);it!=map.upper_bound(name);++it) { if(it->second->parent().id()==stack.top().id()) { @@ -91,7 +91,7 @@ Foam::ProfilingInfo &Foam::ProfilingPool::getInfo(const string &name) } if(found==NULL) { - found=new ProfilingInfo(stack.top(),name); + found=new profilingInfo(stack.top(),name); map.insert(make_pair(name,found)); } @@ -100,10 +100,10 @@ Foam::ProfilingInfo &Foam::ProfilingPool::getInfo(const string &name) return *found; } -void Foam::ProfilingPool::rememberTimer(const ProfilingInfo &info,clockTime &timer) +void Foam::profilingPool::rememberTimer(const profilingInfo &info,clockTime &timer) { if(thePool_==NULL) { - FatalErrorIn("Foam::ProfilingPool::rememberTimer(const ProfilingInfo &info,clockTime &timer)") + FatalErrorIn("Foam::profilingPool::rememberTimer(const profilingInfo &info,clockTime &timer)") << "Singleton not initialized\n" << endl << abort(FatalError); } @@ -111,18 +111,18 @@ void Foam::ProfilingPool::rememberTimer(const ProfilingInfo &info,clockTime &tim thePool_->stack().addTimer(info,timer); } -void Foam::ProfilingPool::remove(const ProfilingInfo &info) +void Foam::profilingPool::remove(const profilingInfo &info) { if(thePool_==NULL) { - FatalErrorIn("Foam::ProfilingPool::addInfo(const string &name)") + FatalErrorIn("Foam::profilingPool::addInfo(const string &name)") << "Singleton not initialized\n" << endl << abort(FatalError); } - ProfilingStack &stack=thePool_->stack(); + profilingStack &stack=thePool_->stack(); if(info.id()!=stack.top().id()) { - FatalErrorIn("Foam::ProfilingPool::update(const string &name)") + FatalErrorIn("Foam::profilingPool::update(const string &name)") << "The id " << info.id() << " of the updated info " << info.description() << " is no the same as the one on top of the stack: " << stack.top().id() << " (" << stack.top().description() << ")\n" << endl @@ -132,7 +132,7 @@ void Foam::ProfilingPool::remove(const ProfilingInfo &info) stack.pop(); } -bool Foam::ProfilingPool::writeData(Ostream &os) const +bool Foam::profilingPool::writeData(Ostream &os) const { os << "profilingInfo" << nl << indent << token::BEGIN_LIST << incrIndent << nl; diff --git a/src/OpenFOAM/global/Profiling/ProfilingPool.H b/src/OpenFOAM/global/profiling/profilingPool.H similarity index 72% rename from src/OpenFOAM/global/Profiling/ProfilingPool.H rename to src/OpenFOAM/global/profiling/profilingPool.H index 92d8fa216..7defcfa5a 100644 --- a/src/OpenFOAM/global/Profiling/ProfilingPool.H +++ b/src/OpenFOAM/global/profiling/profilingPool.H @@ -23,26 +23,26 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::ProfilingPool + Foam::profilingPool Description - Collects all the data for Profiling + Collects all the data for profiling SourceFiles - ProfilingPool.C + profilingPool.C \*---------------------------------------------------------------------------*/ -#ifndef ProfilingPool_H -#define ProfilingPool_H +#ifndef profilingPool_H +#define profilingPool_H #include "regIOobject.H" #include "clockTime.H" #include -#include "ProfilingInfo.H" -#include "ProfilingStack.H" +#include "profilingInfo.H" +#include "profilingStack.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,50 +54,50 @@ namespace Foam class Ostream; // // Forward declaration of friend functions and operators -// Istream& operator>>(Istream&, ProfilingPool&); -// Ostream& operator<<(Ostream&, const ProfilingPool&); +// Istream& operator>>(Istream&, profilingPool&); +// Ostream& operator<<(Ostream&, const profilingPool&); /*---------------------------------------------------------------------------*\ - Class ProfilingPool Declaration + Class profilingPool Declaration \*---------------------------------------------------------------------------*/ -class ProfilingPool +class profilingPool : public regIOobject { // Private data - typedef std::multimap mapType; - typedef std::pair mapValues; + typedef std::multimap mapType; + typedef std::pair mapValues; typedef mapType::iterator mapIterator; typedef mapType::const_iterator mapConstIterator; mapType allInfo_; - ProfilingStack theStack_; + profilingStack theStack_; clockTime globalTime_; // Private Member Functions //- Disallow default bitwise copy construct - ProfilingPool(const ProfilingPool&); + profilingPool(const profilingPool&); //- Disallow default bitwise assignment - void operator=(const ProfilingPool&); + void operator=(const profilingPool&); // Static data members //- the only possible Pool-Object - static ProfilingPool *thePool_; + static profilingPool *thePool_; //- Construct null - ProfilingPool(const IOobject &); + profilingPool(const IOobject &); // Destructor - ~ProfilingPool(); + ~profilingPool(); mapType &map() { return allInfo_; } @@ -105,21 +105,21 @@ class ProfilingPool const mapType &map() const { return allInfo_; } - ProfilingStack &stack() + profilingStack &stack() { return theStack_; } - const ProfilingStack &stack() const + const profilingStack &stack() const { return theStack_; } public: - static void initProfiling(const IOobject &); + static void initprofiling(const IOobject &); - static ProfilingInfo &getInfo(const string &name); + static profilingInfo &getInfo(const string &name); - static void remove(const ProfilingInfo &info); + static void remove(const profilingInfo &info); - static void rememberTimer(const ProfilingInfo &info,clockTime &timer); + static void rememberTimer(const profilingInfo &info,clockTime &timer); virtual bool writeData(Ostream &) const; }; diff --git a/src/OpenFOAM/global/Profiling/ProfilingStack.C b/src/OpenFOAM/global/profiling/profilingStack.C similarity index 73% rename from src/OpenFOAM/global/Profiling/ProfilingStack.C rename to src/OpenFOAM/global/profiling/profilingStack.C index aa41a5df0..bf1a53dcb 100644 --- a/src/OpenFOAM/global/Profiling/ProfilingStack.C +++ b/src/OpenFOAM/global/profiling/profilingStack.C @@ -24,56 +24,56 @@ License \*---------------------------------------------------------------------------*/ -#include "ProfilingStack.H" -#include "ProfilingInfo.H" +#include "profilingStack.H" +#include "profilingInfo.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::ProfilingStack::ProfilingStack() +Foam::profilingStack::profilingStack() : - LIFOStack() + LIFOStack() {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::ProfilingStack::~ProfilingStack() +Foam::profilingStack::~profilingStack() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::ProfilingInfo &Foam::ProfilingStack::top() const +Foam::profilingInfo &Foam::profilingStack::top() const { - return *LIFOStack::top(); + return *LIFOStack::top(); } -Foam::ProfilingInfo &Foam::ProfilingStack::bottom() const +Foam::profilingInfo &Foam::profilingStack::bottom() const { - return *LIFOStack::bottom(); + return *LIFOStack::bottom(); } -bool Foam::ProfilingStack::empty() const +bool Foam::profilingStack::empty() const { - return LIFOStack::empty(); + return LIFOStack::empty(); } -void Foam::ProfilingStack::push(ProfilingInfo &a) +void Foam::profilingStack::push(profilingInfo &a) { - LIFOStack::push(&a); + LIFOStack::push(&a); top().addedToStack(); } -Foam::ProfilingInfo &Foam::ProfilingStack::pop() +Foam::profilingInfo &Foam::profilingStack::pop() { top().removedFromStack(); - return *LIFOStack::pop(); + return *LIFOStack::pop(); } -void Foam::ProfilingStack::writeStackContents(Ostream &os) const +void Foam::profilingStack::writeStackContents(Ostream &os) const { if(empty()) { return; @@ -81,7 +81,7 @@ void Foam::ProfilingStack::writeStackContents(Ostream &os) const const_iterator it=begin(); scalar oldElapsed=0; do { - const ProfilingInfo &info=*(*it); + const profilingInfo &info=*(*it); scalar elapsed=timers_[info.id()]->elapsedTime(); info.writeWithOffset(os,true,elapsed,oldElapsed); @@ -91,7 +91,7 @@ void Foam::ProfilingStack::writeStackContents(Ostream &os) const } while(it!=end()); } -void Foam::ProfilingStack::addTimer(const ProfilingInfo &info,clockTime &timer) +void Foam::profilingStack::addTimer(const profilingInfo &info,clockTime &timer) { timers_.insert(info.id(),&timer); } diff --git a/src/OpenFOAM/global/Profiling/ProfilingStack.H b/src/OpenFOAM/global/profiling/profilingStack.H similarity index 77% rename from src/OpenFOAM/global/Profiling/ProfilingStack.H rename to src/OpenFOAM/global/profiling/profilingStack.H index 17773ba1e..51941aa57 100644 --- a/src/OpenFOAM/global/Profiling/ProfilingStack.H +++ b/src/OpenFOAM/global/profiling/profilingStack.H @@ -23,18 +23,18 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::ProfilingStack + Foam::profilingStack Description - Stack of the ProfilingInfo-items that are currently used + Stack of the profilingInfo-items that are currently used SourceFiles - ProfilingStack.C + profilingStack.C \*---------------------------------------------------------------------------*/ -#ifndef ProfilingStack_H -#define ProfilingStack_H +#ifndef profilingStack_H +#define profilingStack_H #include "LIFOStack.H" #include "clockTime.H" @@ -45,57 +45,57 @@ namespace Foam { // Forward declaration of classes - class ProfilingInfo; - class ProfilingPool; + class profilingInfo; + class profilingPool; class Ostream; /*---------------------------------------------------------------------------*\ - Class ProfilingStack Declaration + Class profilingStack Declaration \*---------------------------------------------------------------------------*/ -class ProfilingStack +class profilingStack : - private LIFOStack + private LIFOStack { // Private Member Functions //- Disallow default bitwise copy construct - ProfilingStack(const ProfilingStack&); + profilingStack(const profilingStack&); //- Disallow default bitwise assignment - void operator=(const ProfilingStack&); + void operator=(const profilingStack&); //- remember the timers for the correct stack-output HashTable timers_; protected: void writeStackContents(Ostream &) const; - void addTimer(const ProfilingInfo &info,clockTime &timer); + void addTimer(const profilingInfo &info,clockTime &timer); public: // Constructors //- Construct null - ProfilingStack(); + profilingStack(); // Destructor - ~ProfilingStack(); + ~profilingStack(); // Members that encapsulate the original stack-class - ProfilingInfo &top() const; + profilingInfo &top() const; - ProfilingInfo &bottom() const; + profilingInfo &bottom() const; bool empty() const; - void push(ProfilingInfo &); + void push(profilingInfo &); - ProfilingInfo &pop(); + profilingInfo &pop(); - friend class ProfilingPool; + friend class profilingPool; }; diff --git a/src/OpenFOAM/global/Profiling/ProfilingTrigger.C b/src/OpenFOAM/global/profiling/profilingTrigger.C similarity index 84% rename from src/OpenFOAM/global/Profiling/ProfilingTrigger.C rename to src/OpenFOAM/global/profiling/profilingTrigger.C index 3d49d0022..7efbb23ef 100644 --- a/src/OpenFOAM/global/Profiling/ProfilingTrigger.C +++ b/src/OpenFOAM/global/profiling/profilingTrigger.C @@ -24,28 +24,28 @@ License \*---------------------------------------------------------------------------*/ -#include "ProfilingTrigger.H" +#include "profilingTrigger.H" -#include "ProfilingPool.H" +#include "profilingPool.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::ProfilingTrigger::ProfilingTrigger(const string &name) +Foam::profilingTrigger::profilingTrigger(const string &name) : clock_(), - info_(ProfilingPool::getInfo(name)), + info_(profilingPool::getInfo(name)), running_(true) { - ProfilingPool::rememberTimer(info(),clock()); + profilingPool::rememberTimer(info(),clock()); } // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::ProfilingTrigger::~ProfilingTrigger() +Foam::profilingTrigger::~profilingTrigger() { stop(); } @@ -53,12 +53,12 @@ Foam::ProfilingTrigger::~ProfilingTrigger() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::ProfilingTrigger::stop() +void Foam::profilingTrigger::stop() { if(running_) { scalar elapsed=clock_.elapsedTime(); info_.update(elapsed); - ProfilingPool::remove(info_); + profilingPool::remove(info_); running_=false; } } diff --git a/src/OpenFOAM/global/Profiling/ProfilingTrigger.H b/src/OpenFOAM/global/profiling/profilingTrigger.H similarity index 81% rename from src/OpenFOAM/global/Profiling/ProfilingTrigger.H rename to src/OpenFOAM/global/profiling/profilingTrigger.H index b8252fd3e..b8b4b1c51 100644 --- a/src/OpenFOAM/global/Profiling/ProfilingTrigger.H +++ b/src/OpenFOAM/global/profiling/profilingTrigger.H @@ -23,18 +23,18 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::ProfilingTrigger + Foam::profilingTrigger Description The object that does the actual measuring SourceFiles - ProfilingTrigger.C + profilingTrigger.C \*---------------------------------------------------------------------------*/ -#ifndef ProfilingTrigger_H -#define ProfilingTrigger_H +#ifndef profilingTrigger_H +#define profilingTrigger_H #include "clockTime.H" #include "string.H" @@ -44,50 +44,50 @@ SourceFiles namespace Foam { - class ProfilingInfo; - class ProfilingPool; + class profilingInfo; + class profilingPool; /*---------------------------------------------------------------------------*\ - Class ProfilingTrigger Declaration + Class profilingTrigger Declaration \*---------------------------------------------------------------------------*/ -class ProfilingTrigger +class profilingTrigger { // Private data clockTime clock_; - ProfilingInfo &info_; + profilingInfo &info_; bool running_; // Private Member Functions //- Disallow default bitwise copy construct - ProfilingTrigger(const ProfilingTrigger&); + profilingTrigger(const profilingTrigger&); //- Disallow default bitwise assignment - void operator=(const ProfilingTrigger&); + void operator=(const profilingTrigger&); protected: clockTime &clock() { return clock_; } - const ProfilingInfo &info() const + const profilingInfo &info() const { return info_; } public: // Constructors - ProfilingTrigger(const string &name); + profilingTrigger(const string &name); - ~ProfilingTrigger(); + ~profilingTrigger(); void stop(); - friend class ProfilingPool; + friend class profilingPool; }; diff --git a/src/OpenFOAM/matrices/blockLduMatrix/BlockLduMatrix/BlockLduMatrixATmul.C b/src/OpenFOAM/matrices/blockLduMatrix/BlockLduMatrix/BlockLduMatrixATmul.C index 63fcbd174..1ead6bbe5 100644 --- a/src/OpenFOAM/matrices/blockLduMatrix/BlockLduMatrix/BlockLduMatrixATmul.C +++ b/src/OpenFOAM/matrices/blockLduMatrix/BlockLduMatrix/BlockLduMatrixATmul.C @@ -67,6 +67,9 @@ void Foam::BlockLduMatrix::AmulCore const TypeCoeffField& Diag = this->diag(); const TypeCoeffField& Upper = this->upper(); + // Create multiplication function object + typename BlockCoeff::multiply mult; + // Diagonal multiplication, no indirection multiply(Ax, Diag, x); diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H index 87484b4c9..2390192aa 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H @@ -60,8 +60,7 @@ SourceFiles #include "typeInfo.H" #include "autoPtr.H" #include "runTimeSelectionTables.H" - -#include "ProfilingTrigger.H" +#include "profilingTrigger.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -276,7 +275,7 @@ public: const lduInterfaceFieldPtrsList& interfaces_; - ProfilingTrigger profile_; + profilingTrigger profile_; // Protected Member Functions diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C b/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C index e87484047..088812091 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C @@ -26,7 +26,7 @@ License #include "smoothSolver.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -90,7 +90,7 @@ Foam::lduSolverPerformance Foam::smoothSolver::solve // If the nSweeps_ is negative do a fixed number of sweeps if (nSweeps_ < 0) { - ProfilingTrigger smoothProfile("lduMatrix::smoother_"+fieldName()); + profilingTrigger smoothProfile("lduMatrix::smoother_"+fieldName()); autoPtr smootherPtr = lduMatrix::smoother::New ( @@ -139,7 +139,7 @@ Foam::lduSolverPerformance Foam::smoothSolver::solve // Check convergence, solve if not converged if (!stop(solverPerf)) { - ProfilingTrigger smoothProfile("lduMatrix::smoother_"+fieldName()); + profilingTrigger smoothProfile("lduMatrix::smoother_"+fieldName()); autoPtr smootherPtr = lduMatrix::smoother::New diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C index cc763dfcd..afb670da1 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -58,7 +58,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve const dictionary& solverControls ) { - ProfilingTrigger profSolve("fvMatrix::solve_"+psi_.name()); + profilingTrigger profSolve("fvMatrix::solve_"+psi_.name()); if (debug) { diff --git a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C index 0f1a8a82f..f01cc32a7 100644 --- a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C +++ b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C @@ -27,7 +27,7 @@ License #include "fvScalarMatrix.H" #include "zeroGradientFvPatchFields.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -143,7 +143,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve const dictionary& solverControls ) { - ProfilingTrigger profSolve("fvMatrix::solve_"+psi_.name()); + profilingTrigger profSolve("fvMatrix::solve_"+psi_.name()); if (debug) { diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C index 23532c2e5..ef9684470 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C @@ -37,7 +37,7 @@ License #include "fvCFD.H" -#include "ProfilingTrigger.H" +#include "profilingTrigger.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,7 +50,7 @@ void Foam::MULES::explicitSolve const scalar psiMin ) { - ProfilingTrigger trigger("MULES::explicitSolve"); + profilingTrigger trigger("MULES::explicitSolve"); explicitSolve ( geometricOneField(), @@ -72,7 +72,7 @@ void Foam::MULES::implicitSolve const scalar psiMin ) { - ProfilingTrigger trigger("MULES::implicitSolve"); + profilingTrigger trigger("MULES::implicitSolve"); implicitSolve ( geometricOneField(), diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C index 30aa3f8bd..2c4bfb1a3 100644 --- a/src/lagrangian/basic/Cloud/Cloud.C +++ b/src/lagrangian/basic/Cloud/Cloud.C @@ -32,7 +32,7 @@ License #include "Time.H" #include "OFstream.H" -#include "Profiling.H" +#include "profiling.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/lduSolvers/Make/files b/src/lduSolvers/Make/files index 7d891ced3..ab36ce6b1 100644 --- a/src/lduSolvers/Make/files +++ b/src/lduSolvers/Make/files @@ -30,5 +30,7 @@ $(amg)/coarseAmgLevel.C amgPolicy = $(amg)/amgPolicy $(amgPolicy)/amgPolicy.C $(amgPolicy)/pamgPolicy.C +$(amgPolicy)/aamgPolicy.C +$(amgPolicy)/samgPolicy.C LIB = $(FOAM_LIBBIN)/liblduSolvers From 5c2c9f6bdc1df511c459027078d34bd33900d50f Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 26 Aug 2013 12:17:20 +0100 Subject: [PATCH 4/7] Clean-up of profiling code --- src/OpenFOAM/global/profiling/profilingPool.C | 111 +++++++++++------- src/OpenFOAM/global/profiling/profilingPool.H | 73 +++++++----- 2 files changed, 116 insertions(+), 68 deletions(-) diff --git a/src/OpenFOAM/global/profiling/profilingPool.C b/src/OpenFOAM/global/profiling/profilingPool.C index 8a2928f5e..fec64586f 100644 --- a/src/OpenFOAM/global/profiling/profilingPool.C +++ b/src/OpenFOAM/global/profiling/profilingPool.C @@ -33,6 +33,7 @@ Foam::profilingPool* Foam::profilingPool::thePool_(NULL); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::profilingPool::profilingPool(const IOobject &ob) @@ -47,10 +48,12 @@ Foam::profilingPool::profilingPool(const IOobject &ob) Foam::profilingPool::~profilingPool() { - for(mapIterator it=map().begin();it!=map().end();++it) { + for(mapIterator it = map().begin(); it != map().end(); ++it) + { delete it->second; } - map().erase(allInfo_.begin(),allInfo_.end()); + + map().erase(allInfo_.begin(), allInfo_.end()); } @@ -58,11 +61,9 @@ Foam::profilingPool::~profilingPool() void Foam::profilingPool::initprofiling(const IOobject &ob) { - if(thePool_!=NULL) { - WarningIn("Foam::profilingPool::initprofiling(const IOobject &)") - << "Singleton already initialized\n" << endl; - } else { - thePool_=new profilingPool(ob); + if (!thePool_) + { + thePool_ = new profilingPool(ob); profilingInfo *master=new profilingInfo(); thePool_->map().insert(make_pair(master->description(),master)); thePool_->stack().push(*master); @@ -70,28 +71,37 @@ void Foam::profilingPool::initprofiling(const IOobject &ob) } } -Foam::profilingInfo &Foam::profilingPool::getInfo(const string &name) +Foam::profilingInfo &Foam::profilingPool::getInfo(const string& name) { - if(thePool_==NULL) { - FatalErrorIn("Foam::profilingPool::addInfo(const string &name)") - << "Sinleton not initialized\n" << endl - << abort(FatalError); + if (!thePool_) + { + FatalErrorIn("profilingPool::addInfo(const string& name)") + << "Singleton not initialized\n" << endl + << abort(FatalError); } - profilingStack &stack=thePool_->stack(); - mapType &map=thePool_->map(); + profilingStack& stack = thePool_->stack(); + mapType& map = thePool_->map(); - profilingInfo *found=NULL; + profilingInfo* found = NULL; - for(mapIterator it=map.lower_bound(name);it!=map.upper_bound(name);++it) { - if(it->second->parent().id()==stack.top().id()) { - found=it->second; + for + ( + mapIterator it = map.lower_bound(name); + it != map.upper_bound(name); + ++it + ) + { + if (it->second->parent().id()==stack.top().id()) + { + found = it->second; break; } } - if(found==NULL) { - found=new profilingInfo(stack.top(),name); + if (!found) + { + found = new profilingInfo(stack.top(),name); map.insert(make_pair(name,found)); } @@ -100,51 +110,70 @@ Foam::profilingInfo &Foam::profilingPool::getInfo(const string &name) return *found; } -void Foam::profilingPool::rememberTimer(const profilingInfo &info,clockTime &timer) + +void Foam::profilingPool::rememberTimer +( + const profilingInfo& info, + clockTime& timer +) { - if(thePool_==NULL) { - FatalErrorIn("Foam::profilingPool::rememberTimer(const profilingInfo &info,clockTime &timer)") - << "Singleton not initialized\n" << endl - << abort(FatalError); + if(!thePool_) + { + FatalErrorIn + ( + "profilingPool::rememberTimer(const profilingInfo Foam&info, " + "clockTime& timer)" + ) << "Singleton not initialized\n" << endl + << abort(FatalError); } - thePool_->stack().addTimer(info,timer); + thePool_->stack().addTimer(info, timer); } + void Foam::profilingPool::remove(const profilingInfo &info) { - if(thePool_==NULL) { - FatalErrorIn("Foam::profilingPool::addInfo(const string &name)") + if(!thePool_) + { + FatalErrorIn("profilingPool::addInfo(const string& name)") << "Singleton not initialized\n" << endl - << abort(FatalError); + << abort(FatalError); } - profilingStack &stack=thePool_->stack(); + profilingStack& stack = thePool_->stack(); - if(info.id()!=stack.top().id()) { - FatalErrorIn("Foam::profilingPool::update(const string &name)") - << "The id " << info.id() << " of the updated info " << info.description() - << " is no the same as the one on top of the stack: " - << stack.top().id() << " (" << stack.top().description() << ")\n" << endl - << abort(FatalError); + if(info.id() != stack.top().id()) + { + FatalErrorIn("profilingPool::update(const string &name)") + << "The id " << info.id() << " of the updated info " + << info.description() + << " is no the same as the one on top of the stack: " + << stack.top().id() << " (" << stack.top().description() + << ")\n" << endl + << abort(FatalError); } stack.pop(); } -bool Foam::profilingPool::writeData(Ostream &os) const + +bool Foam::profilingPool::writeData(Ostream& os) const { - os << "profilingInfo" << nl << indent << token::BEGIN_LIST << incrIndent << nl; + os << "profilingInfo" << nl << indent + << token::BEGIN_LIST << incrIndent << nl; stack().writeStackContents(os); - for(mapConstIterator it=map().begin();it!=map().end();++it) { - if(!it->second->onStack()) { + for(mapConstIterator it = map().begin(); it != map().end(); ++it) + { + if(!it->second->onStack()) + { os << *(it->second); } } - os << decrIndent << indent << token::END_LIST << token::END_STATEMENT << endl; + os << decrIndent << indent << token::END_LIST + << token::END_STATEMENT << endl; return os; } diff --git a/src/OpenFOAM/global/profiling/profilingPool.H b/src/OpenFOAM/global/profiling/profilingPool.H index 7defcfa5a..76b46ff58 100644 --- a/src/OpenFOAM/global/profiling/profilingPool.H +++ b/src/OpenFOAM/global/profiling/profilingPool.H @@ -66,60 +66,79 @@ class profilingPool : public regIOobject { + // Private typedefs + + typedef std::multimap mapType; + typedef std::pair mapValues; + typedef mapType::iterator mapIterator; + typedef mapType::const_iterator mapConstIterator; + + // Private data - typedef std::multimap mapType; - typedef std::pair mapValues; - typedef mapType::iterator mapIterator; - typedef mapType::const_iterator mapConstIterator; + mapType allInfo_; - mapType allInfo_; + profilingStack theStack_; - profilingStack theStack_; + clockTime globalTime_; - clockTime globalTime_; // Private Member Functions - //- Disallow default bitwise copy construct - profilingPool(const profilingPool&); + //- Disallow default bitwise copy construct + profilingPool(const profilingPool&); - //- Disallow default bitwise assignment - void operator=(const profilingPool&); + //- Disallow default bitwise assignment + void operator=(const profilingPool&); + // Static data members - //- the only possible Pool-Object - static profilingPool *thePool_; + //- The only possible Pool-Object + static profilingPool *thePool_; - //- Construct null - profilingPool(const IOobject &); - // Destructor - + // Constructors + + //- Construct null + profilingPool(const IOobject&); + + + //- Destructor ~profilingPool(); - mapType &map() - { return allInfo_; } + + // Member functions - const mapType &map() const - { return allInfo_; } + mapType &map() + { + return allInfo_; + } - profilingStack &stack() - { return theStack_; } + const mapType &map() const + { + return allInfo_; + } - const profilingStack &stack() const - { return theStack_; } + profilingStack &stack() + { + return theStack_; + } + + const profilingStack &stack() const + { + return theStack_; + } public: static void initprofiling(const IOobject &); - static profilingInfo &getInfo(const string &name); + static profilingInfo& getInfo(const string &name); static void remove(const profilingInfo &info); - static void rememberTimer(const profilingInfo &info,clockTime &timer); + static void rememberTimer(const profilingInfo &info, clockTime &timer); virtual bool writeData(Ostream &) const; }; From 668c0ae6149ddf0939ea2c2a4a14ee207fefc13b Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 26 Aug 2013 12:18:13 +0100 Subject: [PATCH 5/7] Clean-up of profiling code --- src/OpenFOAM/global/profiling/profilingPool.H | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/OpenFOAM/global/profiling/profilingPool.H b/src/OpenFOAM/global/profiling/profilingPool.H index 76b46ff58..32f5ad4a0 100644 --- a/src/OpenFOAM/global/profiling/profilingPool.H +++ b/src/OpenFOAM/global/profiling/profilingPool.H @@ -110,37 +110,37 @@ class profilingPool // Member functions - mapType &map() + mapType& map() { return allInfo_; } - const mapType &map() const + const mapType& map() const { return allInfo_; } - profilingStack &stack() + profilingStack& stack() { return theStack_; } - const profilingStack &stack() const + const profilingStack& stack() const { return theStack_; } public: - static void initprofiling(const IOobject &); + static void initprofiling(const IOobject&); - static profilingInfo& getInfo(const string &name); + static profilingInfo& getInfo(const string& name); - static void remove(const profilingInfo &info); + static void remove(const profilingInfo& info); - static void rememberTimer(const profilingInfo &info, clockTime &timer); + static void rememberTimer(const profilingInfo& info, clockTime& timer); - virtual bool writeData(Ostream &) const; + virtual bool writeData(Ostream&) const; }; From 3776ce34c5ac9518e525ee2f0a8dbbf9a9bae206 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 26 Aug 2013 13:52:56 +0100 Subject: [PATCH 6/7] Version comment --- ThirdParty/AllMake.stage5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThirdParty/AllMake.stage5 b/ThirdParty/AllMake.stage5 index b07836ff8..bf323fab8 100755 --- a/ThirdParty/AllMake.stage5 +++ b/ThirdParty/AllMake.stage5 @@ -55,7 +55,7 @@ echo "Starting ThirdParty AllMake: Stage5 " echo "========================================" echo -# swak4Foam - Version 0.2.0 +# swak4Foam - Version 0.2.4 # In fact, we are basically tracking the head branch from the Mercurial repository # which is also replicated under the Breeder_1.7 section of the Subversion repository # From 6caa9b34cbbecdf31368f52cbfb9de8957a7bd68 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 26 Aug 2013 20:48:25 +0100 Subject: [PATCH 7/7] Fixed wrong dimension set in steady state ddt corrector --- .../ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.C index 4da741a26..52fc4dd6e 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.C @@ -243,7 +243,7 @@ steadyStateDdtScheme::fvcDdtPhiCorr mesh(), dimensioned::type> ( - "0", + "zero", rA.dimensions()*phi.dimensions()/dimTime, pTraits::type>::zero ) @@ -278,7 +278,7 @@ steadyStateDdtScheme::fvcDdtPhiCorr dimensioned::type> ( "0", - rA.dimensions()*phi.dimensions()/dimTime, + rA.dimensions()*rho.dimensions()*phi.dimensions()/dimTime, pTraits::type>::zero ) )