mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added time bounds to function objects
This commit is contained in:
@ -37,6 +37,18 @@ void Foam::OutputFilterFunctionObject<OutputFilter>::readDict()
|
||||
dict_.readIfPresent("dictionary", dictName_);
|
||||
dict_.readIfPresent("enabled", enabled_);
|
||||
dict_.readIfPresent("storeFilter", storeFilter_);
|
||||
dict_.readIfPresent("timeStart", timeStart_);
|
||||
dict_.readIfPresent("timeEnd", timeEnd_);
|
||||
}
|
||||
|
||||
|
||||
template<class OutputFilter>
|
||||
bool Foam::OutputFilterFunctionObject<OutputFilter>::active() const
|
||||
{
|
||||
return
|
||||
enabled_
|
||||
&& time_.value() >= timeStart_
|
||||
&& time_.value() <= timeEnd_;
|
||||
}
|
||||
|
||||
|
||||
@ -94,6 +106,8 @@ Foam::OutputFilterFunctionObject<OutputFilter>::OutputFilterFunctionObject
|
||||
dictName_(),
|
||||
enabled_(true),
|
||||
storeFilter_(true),
|
||||
timeStart_(-VGREAT),
|
||||
timeEnd_(VGREAT),
|
||||
outputControl_(t, dict)
|
||||
{
|
||||
readDict();
|
||||
@ -121,7 +135,7 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::start()
|
||||
{
|
||||
readDict();
|
||||
|
||||
if (enabled_&&storeFilter_)
|
||||
if (enabled_ && storeFilter_)
|
||||
{
|
||||
allocateFilter();
|
||||
}
|
||||
@ -136,7 +150,7 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute
|
||||
const bool forceWrite
|
||||
)
|
||||
{
|
||||
if (enabled_)
|
||||
if (active())
|
||||
{
|
||||
if (!storeFilter_)
|
||||
{
|
||||
@ -163,7 +177,7 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute
|
||||
template<class OutputFilter>
|
||||
bool Foam::OutputFilterFunctionObject<OutputFilter>::end()
|
||||
{
|
||||
if (enabled_)
|
||||
if (active())
|
||||
{
|
||||
if (!storeFilter_)
|
||||
{
|
||||
|
||||
@ -68,18 +68,28 @@ class OutputFilterFunctionObject
|
||||
//- Input dictionary
|
||||
dictionary dict_;
|
||||
|
||||
//- Name of region
|
||||
word regionName_;
|
||||
|
||||
//- Optional dictionary name to supply required inputs
|
||||
word dictName_;
|
||||
// Optional user inputs
|
||||
|
||||
//- Switch for the execution of the functionObject
|
||||
bool enabled_;
|
||||
//- Name of region - defaults to name of polyMesh::defaultRegion
|
||||
word regionName_;
|
||||
|
||||
//- Dictionary name to supply required inputs
|
||||
word dictName_;
|
||||
|
||||
//- Switch for the execution - defaults to 'yes/on'
|
||||
bool enabled_;
|
||||
|
||||
//- Switch to store filter in between writes or use on-the-fly
|
||||
// construction - defaults to true
|
||||
bool storeFilter_;
|
||||
|
||||
//- Activation time - defaults to -VGREAT
|
||||
scalar timeStart_;
|
||||
|
||||
//- De-activation time - defaults to VGREAT
|
||||
scalar timeEnd_;
|
||||
|
||||
//- Switch to store filter in between writes or use on-the-fly
|
||||
// construction
|
||||
bool storeFilter_;
|
||||
|
||||
//- Output controls
|
||||
outputFilterOutputControl outputControl_;
|
||||
@ -99,6 +109,9 @@ class OutputFilterFunctionObject
|
||||
//- Destroys most of the data associated with this object.
|
||||
void destroyFilter();
|
||||
|
||||
//- Returns true if active (enabled and within time bounds)
|
||||
bool active() const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
OutputFilterFunctionObject(const OutputFilterFunctionObject&);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user