mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
allow on-the-fly construction for e.g. having hundreds of cutting planes
This commit is contained in:
@ -37,8 +37,43 @@ void Foam::OutputFilterFunctionObject<OutputFilter>::readDict()
|
|||||||
dict_.readIfPresent("region", regionName_);
|
dict_.readIfPresent("region", regionName_);
|
||||||
dict_.readIfPresent("dictionary", dictName_);
|
dict_.readIfPresent("dictionary", dictName_);
|
||||||
dict_.readIfPresent("enabled", enabled_);
|
dict_.readIfPresent("enabled", enabled_);
|
||||||
|
dict_.readIfPresent("storeFilter", storeFilter_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class OutputFilter>
|
||||||
|
void 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_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class OutputFilter>
|
||||||
|
void Foam::OutputFilterFunctionObject<OutputFilter>::destroyFilter()
|
||||||
|
{
|
||||||
|
ptr_.reset();
|
||||||
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -56,6 +91,7 @@ Foam::OutputFilterFunctionObject<OutputFilter>::OutputFilterFunctionObject
|
|||||||
regionName_(polyMesh::defaultRegion),
|
regionName_(polyMesh::defaultRegion),
|
||||||
dictName_(),
|
dictName_(),
|
||||||
enabled_(true),
|
enabled_(true),
|
||||||
|
storeFilter_(true),
|
||||||
outputControl_(t, dict)
|
outputControl_(t, dict)
|
||||||
{
|
{
|
||||||
readDict();
|
readDict();
|
||||||
@ -83,32 +119,9 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::start()
|
|||||||
{
|
{
|
||||||
readDict();
|
readDict();
|
||||||
|
|
||||||
if (enabled_)
|
if (enabled_&&storeFilter_)
|
||||||
{
|
{
|
||||||
if (dictName_.size())
|
allocateFilter();
|
||||||
{
|
|
||||||
ptr_.reset
|
|
||||||
(
|
|
||||||
new IOOutputFilter<OutputFilter>
|
|
||||||
(
|
|
||||||
name(),
|
|
||||||
time_.lookupObject<objectRegistry>(regionName_),
|
|
||||||
dictName_
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ptr_.reset
|
|
||||||
(
|
|
||||||
new OutputFilter
|
|
||||||
(
|
|
||||||
name(),
|
|
||||||
time_.lookupObject<objectRegistry>(regionName_),
|
|
||||||
dict_
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -120,12 +133,22 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute()
|
|||||||
{
|
{
|
||||||
if (enabled_)
|
if (enabled_)
|
||||||
{
|
{
|
||||||
|
if (!storeFilter_)
|
||||||
|
{
|
||||||
|
allocateFilter();
|
||||||
|
}
|
||||||
|
|
||||||
ptr_->execute();
|
ptr_->execute();
|
||||||
|
|
||||||
if (enabled_ && outputControl_.output())
|
if (enabled_ && outputControl_.output())
|
||||||
{
|
{
|
||||||
ptr_->write();
|
ptr_->write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!storeFilter_)
|
||||||
|
{
|
||||||
|
destroyFilter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -137,12 +160,22 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::end()
|
|||||||
{
|
{
|
||||||
if (enabled_)
|
if (enabled_)
|
||||||
{
|
{
|
||||||
|
if (!storeFilter_)
|
||||||
|
{
|
||||||
|
allocateFilter();
|
||||||
|
}
|
||||||
|
|
||||||
ptr_->end();
|
ptr_->end();
|
||||||
|
|
||||||
if (enabled_ && outputControl_.output())
|
if (enabled_ && outputControl_.output())
|
||||||
{
|
{
|
||||||
ptr_->write();
|
ptr_->write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!storeFilter_)
|
||||||
|
{
|
||||||
|
destroyFilter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -78,6 +78,10 @@ class OutputFilterFunctionObject
|
|||||||
//- Switch for the execution of the functionObject
|
//- Switch for the execution of the functionObject
|
||||||
bool enabled_;
|
bool enabled_;
|
||||||
|
|
||||||
|
//- Switch to store filter in between writes or use on-the-fly
|
||||||
|
// construction
|
||||||
|
bool storeFilter_;
|
||||||
|
|
||||||
//- Output controls
|
//- Output controls
|
||||||
outputFilterOutputControl outputControl_;
|
outputFilterOutputControl outputControl_;
|
||||||
|
|
||||||
@ -89,6 +93,12 @@ class OutputFilterFunctionObject
|
|||||||
|
|
||||||
//- Read relevant dictionary entries
|
//- Read relevant dictionary entries
|
||||||
void readDict();
|
void readDict();
|
||||||
|
|
||||||
|
//- Creates most of the data associated with this object.
|
||||||
|
void allocateFilter();
|
||||||
|
|
||||||
|
//- Destroys most of the data associated with this object.
|
||||||
|
void destroyFilter();
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
OutputFilterFunctionObject(const OutputFilterFunctionObject&);
|
OutputFilterFunctionObject(const OutputFilterFunctionObject&);
|
||||||
|
|||||||
Reference in New Issue
Block a user