WindowManager Array Transition (part 1) #11432
Conversation
|
|
|
|
| rbt = wm->rbop[0][n - 1]; | ||
| tt = top[n - 1][0]; | ||
| rft = rfop[n - 1][0]; | ||
| rbt = rbop[0][n - 1]; |
There was a problem hiding this comment.
Looking a the issue you found using bisect just above here (1944), why wasn't the index of top, rfop, and rbop also changed here (1951 - 1953)?
|
|
|
amirroth
left a comment
There was a problem hiding this comment.
Quick code walk-through.
|
|
||
| auto &wm = state.dataWindowManager; | ||
| Array1D<Real64> sabsPhi(nume); // Glazing system absorptance for a glass layer | ||
| std::array<Real64, nume> sabsPhi; // Glazing system absorptance for a glass layer |
There was a problem hiding this comment.
Many changes like this.
| wm->lSimpleGlazingSystem = false; | ||
|
|
||
|
|
||
| bool lSimpleGlazingSystem = false; |
There was a problem hiding this comment.
These can be local variables.
| // from properties at normal incidence | ||
| for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { | ||
| LayPtr = thisConstruct.LayerPoint(wm->LayerNum[IGlass - 1]); | ||
| for (int iGlass = 0; iGlass < NGlass; ++iGlass) { |
| // Loop over glass layers in the construction | ||
| for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { | ||
| int LayNum = 1 + 2 * (IGlass - 1); | ||
| for (int iGlass = 0; iGlass < NGlass; ++iGlass) { |
There was a problem hiding this comment.
0-based indexing.
| rbt = wm->rbop[0][n - 1]; | ||
| tt = top[n - 1][0]; | ||
| rft = rfop[n - 1][0]; | ||
| rbt = rbop[0][n - 1]; |
| for (int IGlass = 1; IGlass <= NGlass; ++IGlass) { | ||
| constr.AbsDiff(IGlass) = ShadeTrans * ShadeReflFac * solabsDiff(IGlass); | ||
| for (int iGlass = 0; iGlass < NGlass; ++iGlass) { | ||
| constr.AbsDiff(iGlass+1) = ShadeTrans * ShadeReflFac * solabsDiff[iGlass]; |
There was a problem hiding this comment.
Will transition the corresponding arrays in Construction next.
|
|
||
| RhoAir = wm->AirProps[0] + wm->AirProps[1] * (TGapOld - Constant::Kelvin); | ||
| ViscAir = wm->AirProps[4] + wm->AirProps[5] * (TGapOld - Constant::Kelvin); | ||
| RhoAir = AirDens + AirDDensDT * (TGapOld - Constant::Kelvin); |
There was a problem hiding this comment.
These should not be in an array, they should be discrete named constants.
|
|
||
| namespace Window { | ||
|
|
||
| Real64 constexpr AirDens = 1.29; |
There was a problem hiding this comment.
Not sure why these were previously in an array.
| Real64 A67 = 0.0; | ||
|
|
||
| // TEMP MOVED FROM DataHeatBalance.hh -BLB | ||
|
|
| bool HasWindows = false; | ||
| bool HasComplexWindows = false; | ||
| bool HasEQLWindows = false; // equivalent layer window defined | ||
| Real64 SimpleGlazingSHGC = 0.0; // value of SHGC for simple glazing system block model |
There was a problem hiding this comment.
In general try to reduce the number of state variables unless they are actually state that persists across time steps. Don't use state to pass information from one function to another within the same timestep, that's what local variables and arguments are for.
Pull request overview
This is a refactor that moves some arrays in WindowManager from
Array1D<>andArray2D<>tostd::array<>andstd::array<std::array<>>, transitions 1-based loops and indexing to 0-based loops and indexing, and moves some variables from state to local scope. Completing the array transition will probably take one more PR.There are no diffs.