functionObjectList added manualStart()/manualExecute()
- can call start()/execute() manually regardless of the execution status
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user