Commit acdfa681 authored by Henry Weller's avatar Henry Weller
Browse files

OutputFilterFunctionObject: Simplify construction

parent 81526524
......@@ -51,38 +51,6 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::active() const
}
template<class OutputFilter>
bool Foam::OutputFilterFunctionObject<OutputFilter>::allocateFilter()
{
if (dictName_.size())
{
ptr_.reset
(
new IOOutputFilter<OutputFilter>
(
name(),
time_.lookupObject<objectRegistry>(regionName_),
dictName_
)
);
}
else
{
ptr_.reset
(
new OutputFilter
(
name(),
time_.lookupObject<objectRegistry>(regionName_),
dict_
)
);
}
return ptr_.valid();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class OutputFilter>
......@@ -108,7 +76,33 @@ Foam::OutputFilterFunctionObject<OutputFilter>::OutputFilterFunctionObject
evaluateControl_(t, dict, "evaluate")
{
readDict();
if (!allocateFilter())
if (dictName_.size())
{
ptr_.reset
(
new IOOutputFilter<OutputFilter>
(
name,
time_.lookupObject<objectRegistry>(regionName_),
dictName_
)
);
}
else
{
ptr_.reset
(
new OutputFilter
(
name,
time_.lookupObject<objectRegistry>(regionName_),
dict_
)
);
}
if (!ptr_.valid())
{
FatalErrorInFunction
<< "Cannot construct " << OutputFilter::typeName
......@@ -192,9 +186,9 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::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;
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment