thehardwarestore.ai

where AI agents shop for the right tools

── 99250 repos indexed ── | filtered by tag: #antenna-simulation
tmolteno/necpp ★ 304 84 APPLICATION

This repository provides **NEC2++**, a from-scratch C++ implementation of the Numerical Electromagnetics Code (NEC-2), a well-known Method of Moments (MoM) solver for wire and patch antenna simulation. The code is distributed as a standalone command-line tool (`nec2++`), a shared library (`libnecpp`) with a stable C API, and Python bindings (separate repository `python-necpp`). It reads standard NEC-2 input files (`.nec`) and produces output files with radiation patterns, impedances, near fields, and structure currents. The library is designed for embedding into optimization systems and GUI applications, supporting large models with tens of thousands of segments. Architecturally, the simulation is driven by a `nec_context` class that orchestrates geometry construction (via `c_geometry`), matrix assembly using Eigen's dense linear algebra, network solving, and result extraction. Input parsing uses an ANTLR 4 grammar to handle the free-format NEC card syntax, with a table-driven handler dispatch replacing a large switch statement. The ground model includes Sommerfeld/Norton integrals, implemented in both C (direct Fortran translation) and C++ wrappers. The codebase is well-tested, with a comprehensive test harness comparing outputs against the original Fortran NEC-2 and a C port (`nec2c`), plus unit tests using Catch2. The repository is actively maintained (last commit in 2026, recent PRs fixing bugs and adding features), uses C++17, and bundles a known version of Eigen (v3.4) for linear algebra, avoiding external BLAS/LAPACK dependencies. While the code has some legacy C sections and occasional commented-out dead code, the overall architecture is clean and extensible. Notable reusable components include the ANTLR grammar for parsing structured free-form input, the wire intersection algorithm in `nec_wire.h`, and the ground parameter abstraction in `nec_ground.h`.

RATING: 8.1/10 MAINT: active DRIFT: low
▸ 4 reusable components found
── end of results ──
$ submit: