tmolteno / necpp

NEC2++ is a C++ rewrite of the Numerical Electromagnetics Code (NEC-2) with many new features like automatic error detection when you specify the structure incorrectly and much faster execution. Nec2++ can analyse radiating as well as scattering properties of structures. The simulation engine in Nec2++ is compiled into a library for easy integration into automatic antenna design systems or GUI tools. Examples are included for using Nec2++ from C/C++, Ruby and Python.
http://elec.otago.ac.nz/w/index.php/Necpp
GNU General Public License v2.0
241 stars 65 forks source link

Full output to stdout if output filename is "-". #82

Open aknrdureegaesr opened 1 month ago

aknrdureegaesr commented 1 month ago

The program's help message previously was like this:

usage: nec2++ [-i<input-file-name>] [-o<output-file-name>]
       -g: print maximum gain to stdout.
       -b: Perform NEC++ Benchmark.
       -s: print results to standard output.
       -c: print results in comma-separated-value (CSV) format,
           this options is used in conjunction with (-s) above.
       -h: print this usage information and exit.
       -v: print nec2++ version number and exit.

This fooled me into thinking I could get the simulation results via the -s command line switch. But what I actually got was a excerpt, one might call it a summary.

This actually threw me off. For some time, it was my impression that the program does considerably less calculation than what one has come to expect from a NEC2 implementation. Only after generating and reading a regular output file (accidentally), I realized that the output generated by -s is sorely incomplete.

And there was no defined way to have that output piped to stdout. To have this is very convenient in a scripting environment.

This pull request addresses that problem, in two ways: