functionObjectList added manualStart()/manualExecute()

- can call start()/execute() manually regardless of the execution status
This commit is contained in:
Mark Olesen
2009-02-13 15:10:22 +01:00
parent fafb3e8885
commit e03979ad3b
9 changed files with 98 additions and 58 deletions

View File

@ -106,6 +106,25 @@ void Foam::functionObjectList::clear()
}
void Foam::functionObjectList::on()
{
execution_ = true;
}
void Foam::functionObjectList::off()
{
// for safety, also force a read() when execution is turned back on
updated_ = execution_ = false;
}
bool Foam::functionObjectList::status() const
{
return execution_;
}
bool Foam::functionObjectList::start()
{
return read();
@ -133,19 +152,6 @@ bool Foam::functionObjectList::execute()
}
void Foam::functionObjectList::on()
{
execution_ = true;
}
void Foam::functionObjectList::off()
{
// for safety, also force a read() when execution is turned back on
updated_ = execution_ = false;
}
bool Foam::functionObjectList::read()
{
bool ok = true;
@ -273,4 +279,28 @@ bool Foam::functionObjectList::read()
}
bool Foam::functionObjectList::manualStart()
{
bool state = execution_;
execution_ = true;
bool ret = start();
execution_ = state;
return ret;
}
bool Foam::functionObjectList::manualExecute()
{
bool state = execution_;
execution_ = true;
bool ret = execute();
execution_ = state;
return ret;
}
// ************************************************************************* //

View File

@ -40,10 +40,10 @@ SourceFiles
#ifndef functionObjectList_H
#define functionObjectList_H
#include "functionObject.H"
#include "HashTable.H"
#include "PtrList.H"
#include "functionObject.H"
#include "SHA1Digest.H"
#include "HashTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -137,20 +137,32 @@ public:
virtual void clear();
//- Start is called at the start of the time-loop
virtual bool start();
//- Execute is called at each ++ or += of the time-loop
virtual bool execute();
//- Switch the function objects on
virtual void on();
//- Switch the function objects off
virtual void off();
//- Return the execution status (on/off) of the function objects
virtual bool status() const;
//- Start is called at the start of the time-loop
virtual bool start();
//- Execute is called at each ++ or += of the time-loop
virtual bool execute();
//- Read and set the function objects if their data have changed
virtual bool read();
//- Call start() manually regardless of the execution status
virtual bool manualStart();
//- Call execute() manually regardless of the execution status
virtual bool manualExecute();
};