diff --git a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C index c4f5249af0..2c36cd6d41 100644 --- a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C @@ -51,38 +51,6 @@ bool Foam::OutputFilterFunctionObject::active() const } -template -bool Foam::OutputFilterFunctionObject::allocateFilter() -{ - if (dictName_.size()) - { - ptr_.reset - ( - new IOOutputFilter - ( - name(), - time_.lookupObject(regionName_), - dictName_ - ) - ); - } - else - { - ptr_.reset - ( - new OutputFilter - ( - name(), - time_.lookupObject(regionName_), - dict_ - ) - ); - } - - return ptr_.valid(); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -108,7 +76,33 @@ Foam::OutputFilterFunctionObject::OutputFilterFunctionObject evaluateControl_(t, dict, "evaluate") { readDict(); - if (!allocateFilter()) + + if (dictName_.size()) + { + ptr_.reset + ( + new IOOutputFilter + ( + name, + time_.lookupObject(regionName_), + dictName_ + ) + ); + } + else + { + ptr_.reset + ( + new OutputFilter + ( + name, + time_.lookupObject(regionName_), + dict_ + ) + ); + } + + if (!ptr_.valid()) { FatalErrorInFunction << "Cannot construct " << OutputFilter::typeName @@ -192,9 +186,9 @@ bool Foam::OutputFilterFunctionObject::adjustTimeStep() scalar nSteps = timeToNextWrite/deltaT - SMALL; - // function objects modify deltaT inside nStepsToStartTimeChange range - // NOTE: Potential problem if two function objects dump inside the same - // interval + // functionObjects modify deltaT within nStepsToStartTimeChange + // NOTE: Potential problems arise if two function objects dump within + // the same interval if (nSteps < nStepsToStartTimeChange_) { label nStepsToNextWrite = label(nSteps) + 1; diff --git a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H index 5af1be11e9..500dd77755 100644 --- a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H @@ -103,10 +103,7 @@ class OutputFilterFunctionObject //- Read relevant dictionary entries void readDict(); - //- Creates most of the data associated with this object. - bool allocateFilter(); - - //- Returns true if active (enabled and within time bounds) + //- Returns true if within time bounds bool active() const; //- Disallow default bitwise copy construct @@ -158,9 +155,9 @@ public: // Function object control - //- Called at each ++ or += of the time-loop. forceWrite overrides - // the usual outputControl behaviour and forces writing always - // (used in post-processing mode) + //- Called at each ++ or += of the time-loop. + // forceWrite overrides the usual outputControl behaviour and + // forces writing (used in post-processing mode) virtual bool execute(const bool forceWrite = false); //- Called when Time::run() determines that the time-loop exits