ENH: functionObjects: force writing when used through execFlowFunctionObjects

This commit is contained in:
mattijs
2010-10-26 16:23:36 +01:00
parent 3a2822ece1
commit 797c4a7457
7 changed files with 18 additions and 12 deletions

View File

@ -68,13 +68,13 @@ namespace Foam
functionObjectList fol(runTime, dict); functionObjectList fol(runTime, dict);
fol.start(); fol.start();
fol.execute(); fol.execute(true); // override outputControl - force writing
} }
else else
{ {
functionObjectList fol(runTime); functionObjectList fol(runTime);
fol.start(); fol.start();
fol.execute(); fol.execute(true); // override outputControl - force writing
} }
} }
} }

View File

@ -128,7 +128,10 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::start()
template<class OutputFilter> template<class OutputFilter>
bool Foam::OutputFilterFunctionObject<OutputFilter>::execute() bool Foam::OutputFilterFunctionObject<OutputFilter>::execute
(
const bool forceWrite
)
{ {
if (enabled_) if (enabled_)
{ {
@ -139,7 +142,7 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute()
ptr_->execute(); ptr_->execute();
if (outputControl_.output()) if (forceWrite || outputControl_.output())
{ {
ptr_->write(); ptr_->write();
} }

View File

@ -183,7 +183,7 @@ public:
virtual bool start(); virtual bool start();
//- Called at each ++ or += of the time-loop //- Called at each ++ or += of the time-loop
virtual bool execute(); virtual bool execute(const bool forceWrite);
//- Called when Time::run() determines that the time-loop exits //- Called when Time::run() determines that the time-loop exits
virtual bool end(); virtual bool end();

View File

@ -112,7 +112,7 @@ const Foam::word& Foam::functionObject::name() const
bool Foam::functionObject::end() bool Foam::functionObject::end()
{ {
return execute(); return execute(false);
} }

View File

@ -147,8 +147,9 @@ public:
//- Called at the start of the time-loop //- Called at the start of the time-loop
virtual bool start() = 0; virtual bool start() = 0;
//- Called at each ++ or += of the time-loop //- Called at each ++ or += of the time-loop. forceWrite overrides the
virtual bool execute() = 0; // outputControl behaviour.
virtual bool execute(const bool forceWrite) = 0;
//- Called when Time::run() determines that the time-loop exits. //- Called when Time::run() determines that the time-loop exits.
// By default it simply calls execute(). // By default it simply calls execute().

View File

@ -144,7 +144,7 @@ bool Foam::functionObjectList::start()
} }
bool Foam::functionObjectList::execute() bool Foam::functionObjectList::execute(const bool forceWrite)
{ {
bool ok = true; bool ok = true;
@ -157,7 +157,7 @@ bool Foam::functionObjectList::execute()
forAll(*this, objectI) forAll(*this, objectI)
{ {
ok = operator[](objectI).execute() && ok; ok = operator[](objectI).execute(forceWrite) && ok;
} }
} }

View File

@ -153,8 +153,10 @@ public:
//- Called at the start of the time-loop //- Called at the start of the time-loop
virtual bool start(); virtual bool start();
//- Called at each ++ or += of the time-loop //- Called at each ++ or += of the time-loop. forceWrite overrides
virtual bool execute(); // the usual outputControl behaviour and forces writing always
// (used in postprocessing mode)
virtual bool execute(const bool forceWrite = false);
//- Called when Time::run() determines that the time-loop exits //- Called when Time::run() determines that the time-loop exits
virtual bool end(); virtual bool end();