Background
CIGUGapLayer::getThickness() has special handling for m_isDCenterMeasured that adjusts gap thickness by subtracting half the adjacent shade layer thickness on each side. This is because shade gap width is measured from the center of the shade layer rather than from its surface.
if(m_isDCenterMeasured)
{
auto prevSolid = std::dynamic_pointer_cast<CIGUSolidLayer>(getPreviousLayer());
if(prevSolid != nullptr && prevSolid->isShadeLayer())
thickness -= prevSolid->getThickness() / 2;
auto nxtSolid = std::dynamic_pointer_cast<CIGUSolidLayer>(getNextLayer());
if(nxtSolid != nullptr && nxtSolid->isShadeLayer())
thickness -= nxtSolid->getThickness() / 2;
}
Issue
This approach:
- Adds shade-specific logic inside
CIGUGapLayer which is otherwise a general-purpose gap
- Requires
dynamic_pointer_cast<CIGUSolidLayer> to check neighbor types
- Is the only remaining reason
IGUGapLayer.cpp includes IGUSolidLayer.hpp
- Mixes measurement convention concerns (D-center vs surface-to-surface) with thermal calculation
Proposal
Consider pre-computing the adjusted gap thickness in WinCalc before passing it to WCE. WinCalc already knows which layers are shades and their thicknesses, so it could subtract the half-thicknesses before creating the gap layer. WCE would then always work with surface-to-surface gap thickness, simplifying the calculation engine.
This would allow removing m_isDCenterMeasured from CIGUGapLayer and the dynamic_pointer_cast calls in getThickness().
Background
CIGUGapLayer::getThickness()has special handling form_isDCenterMeasuredthat adjusts gap thickness by subtracting half the adjacent shade layer thickness on each side. This is because shade gap width is measured from the center of the shade layer rather than from its surface.Issue
This approach:
CIGUGapLayerwhich is otherwise a general-purpose gapdynamic_pointer_cast<CIGUSolidLayer>to check neighbor typesIGUGapLayer.cppincludesIGUSolidLayer.hppProposal
Consider pre-computing the adjusted gap thickness in WinCalc before passing it to WCE. WinCalc already knows which layers are shades and their thicknesses, so it could subtract the half-thicknesses before creating the gap layer. WCE would then always work with surface-to-surface gap thickness, simplifying the calculation engine.
This would allow removing
m_isDCenterMeasuredfromCIGUGapLayerand thedynamic_pointer_castcalls ingetThickness().