Skip to content

Commit

Permalink
Fix #10103 - CheckConvexity removes colinear vertices but stops when …
Browse files Browse the repository at this point in the history
…surface is determined non-convex, causing vertex size mismatch fatal error
  • Loading branch information
jmarrec committed Jul 17, 2023
1 parent c780970 commit 20cb122
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions src/EnergyPlus/SurfaceGeometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15788,30 +15788,33 @@ namespace SurfaceGeometry {
}

if (SignFlag != PrevSignFlag) {
if (state.dataHeatBal->SolarDistribution != DataHeatBalance::Shadowing::Minimal && surfaceTmp.ExtSolar) {
if (state.dataGlobal->DisplayExtraWarnings) {
ShowWarningError(state,
format("CheckConvexity: Zone=\"{}\", Surface=\"{}\" is non-convex.",
state.dataHeatBal->Zone(surfaceTmp.Zone).Name,
surfaceTmp.Name));
int Np1 = n + 1;
if (Np1 > NSides) {
Np1 -= NSides;
}
int Np2 = n + 2;
if (Np2 > NSides) {
Np2 -= NSides;
}
ShowContinueError(state, format("...vertex {} to vertex {} to vertex {}", n, Np1, Np2));
ShowContinueError(state, format("...vertex {}=[{:.2R},{:.2R},{:.2R}]", n, X(n), Y(n), Z(n)));
ShowContinueError(state, format("...vertex {}=[{:.2R},{:.2R},{:.2R}]", Np1, X(n + 1), Y(n + 1), Z(n + 1)));
ShowContinueError(state, format("...vertex {}=[{:.2R},{:.2R},{:.2R}]", Np2, X(n + 2), Y(n + 2), Z(n + 2)));
// ShowContinueError(state, format("...theta angle=[{:.6R}]", Theta));
// ShowContinueError(state, format("...last theta angle=[{:.6R}]", LastTheta));
}
if (state.dataGlobal->DisplayExtraWarnings && surfaceTmp.ExtSolar &&
(state.dataHeatBal->SolarDistribution != DataHeatBalance::Shadowing::Minimal) &&
// Warn only once
surfaceTmp.IsConvex) {
ShowWarningError(state,
format("CheckConvexity: Zone=\"{}\", Surface=\"{}\" is non-convex.",
state.dataHeatBal->Zone(surfaceTmp.Zone).Name,
surfaceTmp.Name));
int Np1 = n + 1;
if (Np1 > NSides) {
Np1 -= NSides;
}
int Np2 = n + 2;
if (Np2 > NSides) {
Np2 -= NSides;
}
ShowContinueError(state, format("...vertex {} to vertex {} to vertex {}", n, Np1, Np2));
ShowContinueError(state, format("...vertex {}=[{:.2R},{:.2R},{:.2R}]", n, X(n), Y(n), Z(n)));
ShowContinueError(state, format("...vertex {}=[{:.2R},{:.2R},{:.2R}]", Np1, X(n + 1), Y(n + 1), Z(n + 1)));
ShowContinueError(state, format("...vertex {}=[{:.2R},{:.2R},{:.2R}]", Np2, X(n + 2), Y(n + 2), Z(n + 2)));
// ShowContinueError(state, format("...theta angle=[{:.6R}]", Theta));
// ShowContinueError(state, format("...last theta angle=[{:.6R}]", LastTheta));
}
surfaceTmp.IsConvex = false;
break;
// #10103 - We do not want to break early, because we do want to consistently remove colinear vertices
// to avoid potential vertex size mismatch fatal errors
// break;
}
PrevSignFlag = SignFlag;
LastTheta = Theta;
Expand Down

5 comments on commit 20cb122

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

10103_CheckConvexity_Colinear (jmarrec) - Win64-Windows-10-VisualStudio-16: OK (2668 of 2668 tests passed, 0 test warnings)

Build Badge Test 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.

10103_CheckConvexity_Colinear (jmarrec) - x86_64-Linux-Ubuntu-22.04-gcc-11.3: OK (3482 of 3482 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

10103_CheckConvexity_Colinear (jmarrec) - x86_64-MacOS-10.17-clang-13.0.0: OK (3441 of 3441 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

10103_CheckConvexity_Colinear (jmarrec) - x86_64-Linux-Ubuntu-22.04-gcc-11.3-UnitTestsCoverage-Debug: OK (1895 of 1895 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.

10103_CheckConvexity_Colinear (jmarrec) - x86_64-Linux-Ubuntu-22.04-gcc-11.3-IntegrationCoverage-Debug: OK (776 of 776 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.