mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: added functionObject::execute(int) method
- this is a provision for defining execute actions that can be called largely independently of the normal time-loop constraints. This can be useful to provide hooks for sub-cycling, or to define an action that can be triggered manually or on some other event.
This commit is contained in:
@ -32,6 +32,7 @@ License
|
||||
//#include "IFstream.H"
|
||||
#include "dictionaryEntry.H"
|
||||
#include "stringOps.H"
|
||||
#include "wordRes.H"
|
||||
#include "Tuple2.H"
|
||||
#include "etcFiles.H"
|
||||
#include "IOdictionary.H"
|
||||
@ -579,6 +580,7 @@ bool Foam::functionObjectList::execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Force writing of state dictionary after function object execution
|
||||
if (time_.writeTime())
|
||||
{
|
||||
@ -600,6 +602,49 @@ bool Foam::functionObjectList::execute()
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjectList::execute(const label subIndex)
|
||||
{
|
||||
bool ok = execution_;
|
||||
|
||||
if (ok)
|
||||
{
|
||||
forAll(*this, obji)
|
||||
{
|
||||
functionObject& funcObj = operator[](obji);
|
||||
|
||||
ok = funcObj.execute(subIndex) && ok;
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjectList::execute
|
||||
(
|
||||
const wordRes& functionNames,
|
||||
const label subIndex
|
||||
)
|
||||
{
|
||||
bool ok = execution_;
|
||||
|
||||
if (ok && functionNames.size())
|
||||
{
|
||||
forAll(*this, obji)
|
||||
{
|
||||
functionObject& funcObj = operator[](obji);
|
||||
|
||||
if (functionNames.match(funcObj.name()))
|
||||
{
|
||||
ok = funcObj.execute(subIndex) && ok;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjectList::end()
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
Reference in New Issue
Block a user