Skip to content

Commit

Permalink
more array to vect conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchute committed Sep 13, 2024
1 parent 0469cee commit f73581d
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/EnergyPlus/GroundHeatExchangers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1822,32 +1822,28 @@ Real64 GLHESlinky::integral(int const m, int const n, int const m1, int const n1
// Simpson's 1/3 rule of integration

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
Real64 sumIntF = 0.0;
Real64 theta = 0.0;
constexpr Real64 theta1 = 0.0;
constexpr Real64 theta2 = 2 * Constant::Pi;
Array1D<Real64> f(J0, 0.0);
std::vector<Real64> f;

Real64 h = (theta2 - theta1) / (J0 - 1);

// Calculate the function at various equally spaced x values
for (int j = 1; j <= J0; ++j) {

theta = theta1 + (j - 1) * h;

f(j) = nearFieldResponseFunction(m, n, m1, n1, eta, theta, t);
for (int j = 0; j < J0; ++j) {
theta = theta1 + j * h;
f.push_back(nearFieldResponseFunction(m, n, m1, n1, eta, theta, t));
}

if (j == 1 || j == J0) {
} else if (isEven(j)) {
f(j) = 4 * f(j);
for (int j = 1; j < J0 - 1; ++j) {
if (!isEven(j)) {
f[j] = 4 * f[j];
} else {
f(j) = 2 * f(j);
f[j] = 2 * f[j];
}

sumIntF += f(j);
}

return (h / 3) * sumIntF;
return (h / 3) * std::reduce(f.begin(), f.end());
}

//******************************************************************************
Expand Down

4 comments on commit f73581d

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ghe_bugs (mitchute) - Win64-Windows-10-VisualStudio-16: Tests Failed (0 of 0 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ghe_bugs (mitchute) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (2893 of 2893 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ghe_bugs (mitchute) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-RelWithDebInfo: OK (2077 of 2077 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ghe_bugs (mitchute) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-RelWithDebInfo: OK (799 of 799 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.