Skip to content

Commit dccd5c7

Browse files
authored
Apply suggestions from code review
1 parent f77cc0d commit dccd5c7

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

SU2_CFD/src/output/tools/CWindowingTools.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ su2double CWindowingTools::BumpWindow(unsigned long curTimeIter, unsigned long e
6767
}
6868

6969
void CWindowedAverage::addValue(su2double valIn, unsigned long curTimeIter,unsigned long startIter){
70-
su2double totalSum = 0;
7170
if (curTimeIter < startIter) return; // Averaging not yet started.
7271
const unsigned long windowWidth = curTimeIter - startIter + 1; // Calculate total width of window for this iteration
7372
if (curTimeIter != lastTimeIter) { // Handle new timestep
@@ -84,7 +83,7 @@ void CWindowedAverage::addValue(su2double valIn, unsigned long curTimeIter,unsig
8483
values.back() = valIn;
8584
}
8685
// Update the windowed-average from the weighted sum of previous samples and the latest sample
87-
totalSum = cachedSum + valIn*GetWndWeight(windowingFunctionId, windowWidth-1, windowWidth-1);
86+
const su2double totalSum = cachedSum + valIn*GetWndWeight(windowingFunctionId, windowWidth-1, windowWidth-1);
8887
val = totalSum / static_cast<su2double>(windowWidth);
8988
}
9089

0 commit comments

Comments
 (0)