Skip to content

Commit

Permalink
ENH: updated initialisation for fieldAverage function object - mantis…
Browse files Browse the repository at this point in the history
… #841
  • Loading branch information
andy committed May 13, 2013
1 parent 37cd7df commit d14f3f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Expand Up @@ -311,6 +311,7 @@ Foam::fieldAverage::fieldAverage
prevTimeIndex_(-1),
resetOnRestart_(false),
resetOnOutput_(false),
initialised_(false),
faItems_(),
meanScalarFields_(),
meanVectorFields_(),
Expand Down Expand Up @@ -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;
}
}

Expand All @@ -374,6 +371,16 @@ void Foam::fieldAverage::execute()
{
if (active_)
{
if (!initialised_)
{
initialize();

// ensure first averaging works unconditionally
prevTimeIndex_ = -1;

initialised_ = true;
}

calcAverages();
}
}
Expand Down
Expand Up @@ -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_;
Expand Down

0 comments on commit d14f3f6

Please sign in to comment.