Integrate upstream master while preserving upstream ground API - #12
Merged
Merged
Conversation
The zero-current ground mode (NEC GE -1) was documented but effectively treated as no ground: build_connections() guarded every plane check with ignd > 0, so below-plane and in-plane segments were silently accepted and no ground model was required. Per NEC-2 Part 3, when I1 is nonzero no segment may extend below the ground plane or lie in it, and the ground parameters must be specified on a GN card. - Add nec_ground_connection to the C API: ZERO_CURRENT stays the stable public ABI value 2 while the native geometry receives -1. - Validate both signed ground modes in build_connections(); GE -1 keeps the Fortran connection semantics (a ground-touching end stays a free end, so current goes to zero there) and the low-horizontal-wire escape hatch (only a segment with both ends exactly on the plane is rejected as lying in it). - Fail at simulate() when a non-none connection has no ground model instead of silently running free space. - discone.nec gains the missing GN 1; test_example1 completes the geometry with 0, matching its free-space deck. - Unit tests cover the plane checks for both signed modes, the ABI mapping, and the ground-model requirement (closes tmolteno#133).
The zero-current fix makes a non-none ground connection without a GN card fail at simulate(), so test_example1 (a free-space dipole whose deck comment shows plain "GE") must complete the geometry with flag 0. Add a comment so the change is not mistaken for a typo.
…-mode fix: implement GE -1 zero-current ground mode and signed-mode validation
Retain upstream ground validation, C API enum, tests, and fixture fixes. Resolve geometry and simulation conflicts while preserving fork symmetry and medium initialization. Rename the fork stateful enum to nec_model_ground_connection and compile the C/C++ headers together in both orders.
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.
Merge
tmolteno/necpp:masterat9b6d00dinto this fork, resolving the conflicts with its stateful API. This uses a real merge commit with both master histories as parents, so future upstream updates retain their ancestry. Supersedes #11 with a fork-owned source branch.Upstream's
nec_ground_connectionenum, C API implementation, ground validation, added tests, fixture fixes, and changelog text are retained. The geometry conflict adopts upstream's ground-contact logic;simulate()retains the fork'sactivate_medium_parameters()before upstream's missing-ground-model check. Both sets of geometry tests are preserved.The fork's stateful C++ enum is renamed to
nec_model_ground_connectionto avoid the public-header name collision. Native C++ callers using that type must update and rebuild. C/WASM signatures and numeric values are unchanged. Two existing fork test files now compile the C and C++ public headers in opposite orders to guard against another collision.Validation: