ENH: updated initialisation for fieldAverage function object - mantis #841
This commit is contained in:
parent
a41c30ff04
commit
1ecf2b471a
@ -311,6 +311,7 @@ Foam::fieldAverage::fieldAverage
|
||||
prevTimeIndex_(-1),
|
||||
resetOnRestart_(false),
|
||||
resetOnOutput_(false),
|
||||
initialised_(false),
|
||||
faItems_(),
|
||||
meanScalarFields_(),
|
||||
meanVectorFields_(),
|
||||
@ -361,11 +362,7 @@ void Foam::fieldAverage::read(const dictionary& dict)
|
||||
dict.readIfPresent("resetOnOutput", resetOnOutput_);
|
||||
dict.lookup("fields") >> faItems_;
|
||||
|
||||
initialize();
|
||||
readAveragingProperties();
|
||||
|
||||
// ensure first averaging works unconditionally
|
||||
prevTimeIndex_ = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -374,6 +371,16 @@ void Foam::fieldAverage::execute()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
if (!initialised_)
|
||||
{
|
||||
initialize();
|
||||
|
||||
// ensure first averaging works unconditionally
|
||||
prevTimeIndex_ = -1;
|
||||
|
||||
initialised_ = true;
|
||||
}
|
||||
|
||||
calcAverages();
|
||||
}
|
||||
}
|
||||
|
@ -171,6 +171,9 @@ protected:
|
||||
//- Reset the averaging process on output flag
|
||||
Switch resetOnOutput_;
|
||||
|
||||
//- Initialised flag
|
||||
bool initialised_;
|
||||
|
||||
//- List of field average items, describing what averages to be
|
||||
// calculated and output
|
||||
List<fieldAverageItem> faItems_;
|
||||
|
Loading…
Reference in New Issue
Block a user