Merge in modified profiling

--HG--
branch : bgschaid/minorAdditionsBranch
This commit is contained in:
Bernhard F.W. Gschaider 2013-08-28 17:40:32 +02:00
commit 9958fab9ee
30 changed files with 424 additions and 339 deletions

View file

@ -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
#

View file

@ -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

View file

@ -27,8 +27,8 @@ License
#include "Time.H"
#include "PstreamReduceOps.H"
#include "ProfilingPool.H"
#include "Profiling.H"
#include "profilingPool.H"
#include "profiling.H"
#include <sstream>
@ -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",

View file

@ -27,7 +27,7 @@ License
#include "Time.H"
#include "PstreamReduceOps.H"
#include "Profiling.H"
#include "profiling.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View file

@ -27,7 +27,7 @@ License
#include "functionObjectList.H"
#include "Time.H"
#include "Profiling.H"
#include "profiling.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //

View file

@ -1,152 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is based on 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "ProfilingPool.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
Foam::ProfilingPool* Foam::ProfilingPool::thePool_(NULL);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::ProfilingPool::ProfilingPool(const IOobject &ob)
:
regIOobject(ob),
globalTime_()
{
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::ProfilingPool::~ProfilingPool()
{
for(mapIterator it=map().begin();it!=map().end();++it) {
delete it->second;
}
map().erase(allInfo_.begin(),allInfo_.end());
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
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);
ProfilingInfo *master=new ProfilingInfo();
thePool_->map().insert(make_pair(master->description(),master));
thePool_->stack().push(*master);
ProfilingPool::rememberTimer(*master,thePool_->globalTime_);
}
}
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);
}
ProfilingStack &stack=thePool_->stack();
mapType &map=thePool_->map();
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;
break;
}
}
if(found==NULL) {
found=new ProfilingInfo(stack.top(),name);
map.insert(make_pair(name,found));
}
stack.push(*found);
return *found;
}
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);
}
thePool_->stack().addTimer(info,timer);
}
void Foam::ProfilingPool::remove(const ProfilingInfo &info)
{
if(thePool_==NULL) {
FatalErrorIn("Foam::ProfilingPool::addInfo(const string &name)")
<< "Singleton not initialized\n" << endl
<< abort(FatalError);
}
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);
}
stack.pop();
}
bool Foam::ProfilingPool::writeData(Ostream &os) const
{
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()) {
os << *(it->second);
}
}
os << decrIndent << indent << token::END_LIST << token::END_STATEMENT << endl;
return os;
}
// ************************************************************************* //

View file

@ -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()

View file

@ -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);

View file

@ -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&);
};

View file

@ -0,0 +1,181 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is based on 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "profilingPool.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
Foam::profilingPool* Foam::profilingPool::thePool_(NULL);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::profilingPool::profilingPool(const IOobject &ob)
:
regIOobject(ob),
globalTime_()
{
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::profilingPool::~profilingPool()
{
for(mapIterator it = map().begin(); it != map().end(); ++it)
{
delete it->second;
}
map().erase(allInfo_.begin(), allInfo_.end());
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::profilingPool::initprofiling(const IOobject &ob)
{
if (!thePool_)
{
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_);
}
}
Foam::profilingInfo &Foam::profilingPool::getInfo(const string& name)
{
if (!thePool_)
{
FatalErrorIn("profilingPool::addInfo(const string& name)")
<< "Singleton not initialized\n" << endl
<< abort(FatalError);
}
profilingStack& stack = thePool_->stack();
mapType& map = thePool_->map();
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;
break;
}
}
if (!found)
{
found = new profilingInfo(stack.top(),name);
map.insert(make_pair(name,found));
}
stack.push(*found);
return *found;
}
void Foam::profilingPool::rememberTimer
(
const profilingInfo& info,
clockTime& timer
)
{
if(!thePool_)
{
FatalErrorIn
(
"profilingPool::rememberTimer(const profilingInfo Foam&info, "
"clockTime& timer)"
) << "Singleton not initialized\n" << endl
<< abort(FatalError);
}
thePool_->stack().addTimer(info, timer);
}
void Foam::profilingPool::remove(const profilingInfo &info)
{
if(!thePool_)
{
FatalErrorIn("profilingPool::addInfo(const string& name)")
<< "Singleton not initialized\n" << endl
<< abort(FatalError);
}
profilingStack& stack = thePool_->stack();
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
{
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())
{
os << *(it->second);
}
}
os << decrIndent << indent << token::END_LIST
<< token::END_STATEMENT << endl;
return os;
}
// ************************************************************************* //

View file

@ -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 <map>
#include "ProfilingInfo.H"
#include "ProfilingStack.H"
#include "profilingInfo.H"
#include "profilingStack.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,74 +54,93 @@ 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 typedefs
typedef std::multimap<Foam::string,Foam::profilingInfo*> mapType;
typedef std::pair<Foam::string,Foam::profilingInfo*> mapValues;
typedef mapType::iterator mapIterator;
typedef mapType::const_iterator mapConstIterator;
// Private data
typedef std::multimap<Foam::string,Foam::ProfilingInfo*> mapType;
typedef std::pair<Foam::string,Foam::ProfilingInfo*> 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();
~ProfilingPool();
// Member functions
mapType &map()
{ return allInfo_; }
mapType& map()
{
return allInfo_;
}
const mapType &map() const
{ return allInfo_; }
const mapType& map() const
{
return allInfo_;
}
ProfilingStack &stack()
{ return theStack_; }
profilingStack& stack()
{
return theStack_;
}
const ProfilingStack &stack() const
{ return theStack_; }
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;
};

View file

@ -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<ProfilingInfo*>()
LIFOStack<profilingInfo*>()
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::ProfilingStack::~ProfilingStack()
Foam::profilingStack::~profilingStack()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::ProfilingInfo &Foam::ProfilingStack::top() const
Foam::profilingInfo &Foam::profilingStack::top() const
{
return *LIFOStack<ProfilingInfo*>::top();
return *LIFOStack<profilingInfo*>::top();
}
Foam::ProfilingInfo &Foam::ProfilingStack::bottom() const
Foam::profilingInfo &Foam::profilingStack::bottom() const
{
return *LIFOStack<ProfilingInfo*>::bottom();
return *LIFOStack<profilingInfo*>::bottom();
}
bool Foam::ProfilingStack::empty() const
bool Foam::profilingStack::empty() const
{
return LIFOStack<ProfilingInfo*>::empty();
return LIFOStack<profilingInfo*>::empty();
}
void Foam::ProfilingStack::push(ProfilingInfo &a)
void Foam::profilingStack::push(profilingInfo &a)
{
LIFOStack<ProfilingInfo*>::push(&a);
LIFOStack<profilingInfo*>::push(&a);
top().addedToStack();
}
Foam::ProfilingInfo &Foam::ProfilingStack::pop()
Foam::profilingInfo &Foam::profilingStack::pop()
{
top().removedFromStack();
return *LIFOStack<ProfilingInfo*>::pop();
return *LIFOStack<profilingInfo*>::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);
}

View file

@ -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<ProfilingInfo *>
private LIFOStack<profilingInfo *>
{
// 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<clockTime *,label> 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;
};

View file

@ -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;
}
}

View file

@ -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;
};

View file

@ -67,12 +67,12 @@ void Foam::BlockLduMatrix<Type>::AmulCore
const TypeCoeffField& Diag = this->diag();
const TypeCoeffField& Upper = this->upper();
// Diagonal multiplication, no indirection
multiply(Ax, Diag, x);
// Create multiplication function object
typename BlockCoeff<Type>::multiply mult;
// Diagonal multiplication, no indirection
multiply(Ax, Diag, x);
// Lower multiplication
if (symmetric())
@ -212,9 +212,6 @@ void Foam::BlockLduMatrix<Type>::TmulCore
// Diagonal multiplication, no indirection
multiply(Tx, Diag, x);
// Create multiplication function object
typename BlockCoeff<Type>::multiply mult;
// Upper multiplication
if (Upper.activeType() == blockCoeffBase::SCALAR)

View file

@ -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

View file

@ -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<lduMatrix::smoother> 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<lduMatrix::smoother> smootherPtr =
lduMatrix::smoother::New

View file

@ -175,10 +175,22 @@ void pressureInletOutletVelocityFvPatchVectorField::updateCoeffs()
return;
}
const fvsPatchField<scalar>& phip =
lookupPatchField<surfaceScalarField, scalar>(phiName_);
if (this->db().objectRegistry::found(phiName_))
{
const fvsPatchField<scalar>& phip =
lookupPatchField<surfaceScalarField, scalar>(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();

View file

@ -243,7 +243,7 @@ steadyStateDdtScheme<Type>::fvcDdtPhiCorr
mesh(),
dimensioned<typename flux<Type>::type>
(
"0",
"zero",
rA.dimensions()*phi.dimensions()/dimTime,
pTraits<typename flux<Type>::type>::zero
)
@ -278,7 +278,7 @@ steadyStateDdtScheme<Type>::fvcDdtPhiCorr
dimensioned<typename flux<Type>::type>
(
"0",
rA.dimensions()*phi.dimensions()/dimTime,
rA.dimensions()*rho.dimensions()*phi.dimensions()/dimTime,
pTraits<typename flux<Type>::type>::zero
)
)

View file

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "Profiling.H"
#include "profiling.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -58,7 +58,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
const dictionary& solverControls
)
{
ProfilingTrigger profSolve("fvMatrix::solve_"+psi_.name());
profilingTrigger profSolve("fvMatrix::solve_"+psi_.name());
if (debug)
{

View file

@ -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<Foam::scalar>::solve
const dictionary& solverControls
)
{
ProfilingTrigger profSolve("fvMatrix::solve_"+psi_.name());
profilingTrigger profSolve("fvMatrix::solve_"+psi_.name());
if (debug)
{

View file

@ -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(),

View file

@ -32,7 +32,7 @@ License
#include "Time.H"
#include "OFstream.H"
#include "Profiling.H"
#include "profiling.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View file

@ -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

View file

@ -70,6 +70,8 @@ fluxRequired
mixingPlane
{
default zeroGradient;
default areaAveraging;
}
// ************************************************************************* //

View file

@ -57,6 +57,10 @@ fluxRequired
mixingPlane
{
default zeroGradient;
default areaAveraging;
p areaAveraging;
U fluxAveraging;
}
// ************************************************************************* //

View file

@ -57,6 +57,10 @@ fluxRequired
mixingPlane
{
default zeroGradient;
default areaAveraging;
p areaAveraging;
U fluxAveraging;
}
// ************************************************************************* //

View file

@ -57,6 +57,10 @@ fluxRequired
mixingPlane
{
default zeroGradient;
default areaAveraging;
p areaAveraging;
U fluxAveraging;
}
// ************************************************************************* //

View file

@ -69,7 +69,13 @@ fluxRequired
mixingPlane
{
default zeroGradient;
default areaAveraging;
p areaAveraging;
U fluxAveraging;
k fluxAveraging;
epsilon fluxAveraging;
}
// ************************************************************************* //