Fix report generation for models with quads and plates (fixes #268)#321
Merged
Merged
Conversation
Reporting.create_report() raised KeyError: 'Combo 1' for any model containing quads or plates. The report template passed the load combination name as the third positional argument to the elements' shear()/moment()/membrane() methods, whose signature is (xi, eta, local=True, combo_name='Combo 1'). The name therefore landed in the 'local' slot and combo_name stayed at its default 'Combo 1', which is not analyzed in most models, raising KeyError on the node displacement lookup. Pass combo_name as a keyword so 'local' keeps its default. Also fix the membrane() result indexing, which returns a (3, 1) column vector: some cells indexed it as [n] (leaving a 1-element array that the '%.3g' format filter cannot render) instead of [n][0] like shear()/moment(). Adds Testing/test_reporting.py covering a quad+plate model analyzed for a single custom-named combo (so the default 'Combo 1' is never solved). Fixes JWock82#268
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the remaining reporting breakage from #268 (the quad/plate case @boustrephon reported, which was never addressed).
Problem
Reporting.create_report()raisesKeyError: 'Combo 1'for any model containing quads or plates — e.g.Examples/Shear Wall - Advanced.py:Root cause
Quad3D/Plate3Dshear(),moment()andmembrane()all have the signatureThe report template called them as
quad.shear(-1, -1, combo.name)— so the combo name was bound tolocal, andcombo_namekept its default'Combo 1'. Since most models never analyze the default'Combo 1', the subsequentnode.DX['Combo 1']lookup raisedKeyError. (Themember.*calls are unaffected — their third positional arg genuinely iscombo_name.)A second, latent template bug was masked behind the first:
membrane()returns a(3, 1)column vector, but several cells indexed it as[n]instead of[n][0], leaving a 1-element array that the"%.3g" | format(...)filter cannot render (TypeError: only 0-dimensional arrays can be converted to Python scalars).Fix
combo_name=combo.nameas a keyword on everyplate/quadshear/moment/membranecall (80 sites) solocalkeeps its intended default.[n][0](24 sites), matchingshear/momentand the already-correct membrane cells.Template-only change — no solver code touched.
Verification
Examples/Shear Wall - Advanced.py+create_report(...)now renders a complete 8 MB HTML report (previously raised immediately).Testing/test_reporting.py: builds a supported quad and plate under pressure, analyzes a single custom-named combo (1.4D) so the defaultCombo 1is never solved, generates the HTML report, and asserts it does not raise, that the analyzed combo appears, and thatCombo 1does not. The test fails onmain(KeyError: 'Combo 1') and passes with this change.Note: #268 originally bundled three problems; the first two were resolved in v1.2.0 / v1.5.0, and this addresses the last outstanding one. Happy to retarget to a dedicated issue number if you'd prefer.