c_geometry: write parsed fields back on trailing-field cards - #115
Merged
tmolteno merged 1 commit intoJul 21, 2026
Merged
Conversation
The shared geometry card parser only wrote its output pointers inside the in-loop end-of-string guards, so a card carrying more numeric fields than the two integers and seven reals it consumes returned without writing. The caller reuses one parse state across every card, so a GM move card took its repeat count from the preceding GA arc segment count and replicated the whole structure, exploding the segment total. The regression came from 220977d, which extracted the shared parser and dropped the unconditional write-back that the nec2c and xnec2c ancestors retain. Reproduce with cebik 84-8.nec, whose 12-field GM card after two 90-segment GA arcs yields 16380 segments instead of 180 and runs multi-hour at 8 GB: CM 2-element circular quad beam CM https://antenna2.github.io/cebik/books/Antenna-Modeling-Notes-Models-Vol-1-4.zip { /Vol-4/nec/84-8.nec } CE GA 1 90 .1572 0 360 .001 GA 2 90 .1722 0 360 .001 GM 0 0 0 0 0 0 .1665 0 2 0 0 0 GE 0 -1 0 EX 0 1 68 0 1.0 0.0 FR 0 1 0 0 299.8 1 RP 0 1 361 1000 90 0 1 1 EN - restore unconditional write-back of the parsed integers and reals at the normal loop-exit of the shared geometry card parser, repairing every geometry card type that carries trailing fields Signed-off-by: Eric Wheeler <necpp@z.ewheeler.org>
Owner
Review ✅ Approved & Merged@KJ7LNW — thank you for this excellent contribution. This is a textbook Key findings from review:
Nice work! |
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.
Description
The shared geometry card parser only wrote its output pointers inside the in-loop end-of-string guards. A card carrying more numeric fields than the two integers and seven reals the reader consumes left
line_idxshort of the terminator, so the write-back never fired and the caller (which reuses one parse state across every card) retained the previous card values.Concretely a
GMmove card took its repeat count from a precedingGAarc segment count and replicated the whole structure, exploding the segment total. The regression came from 220977d, which extracted the shared parser and dropped the unconditional write-back that the nec2c and xnec2c ancestors retain.Type of Change
Implementation Details
Restore the unconditional write-back of the parsed integers and reals at the normal loop-exit of the shared geometry card parser, repairing every geometry card type that carries trailing fields.
Testing
Reproduce with cebik
84-8.nec, whose 12-fieldGMcard after two 90-segmentGAarcs yielded 16380 segments instead of 180 and ran multi-hour at 8 GB: