NEC2 compiled for Mac OS X / Darwin 1.2.1.

21 November 2000
Derwood Eadie
KG4EFO@arrl.net

This binary was compiled from the NEC2 C source. The C source was obtained from 
Raymond Anderson's Unofficial Numerical Electromagnetic Code (NEC) Achive.
(http://www.qsl.net/wb6tpu/swindex.html). The source was originally from the 
ucsd.edu archives, and was converted from FORTRAN to C using f2c, according to 
the Unofficial Archives.

Some modifications to the original Makefile and sources were necessary for the 
sources to compile. I could not get the sources to compile using the supplied 
f2c.h headers, so the f2c library from Bell Labs (netlib.bell-labs.com) was
installed and linked to produce the final binary. Typographical errors in the 
Makefile and some sources which prevented compilation and linking were also 
corrected.

You can peruse diffs of the Makefile and source changes in the "nec2diffs" 
file. 

RUNNING NEC
Since NEC is a command-line program, you must run it from the OS X Terminal
program, from console, or however you normally get to the OS X command line.

Change directory (cd) to the directory where you de-compressed the original 
archive, then type "nec2darwin" (without quotes). You will then see the 
standard NEC2 prompt for an input file name. Type the name of your file here,
(try the example file EX1 for starters) and hit return. NEC2 will then prompt 
for the output file (the EX1 file displays but skips this prompt). When you 
return to the command line your output will be in the file you specified or, 
if your input file provided one, in the file your input file specified. (The 
output from EX1 will be in the file TESTEX1.)

You can use more or vi or your perferred text editor to display the output 
file. Don't be disappointed. NEC2 by itself does not produce pretty graphics.
You can further process the output file with other post-processors like 
XNECVIEW (NEC output viewer for X-Windows) to see the plots and get more 
information about your model.

For more information about using NEC, visit the Unofficial NEC Archives 
mentioned above. PDF files of all three volumes of the NEC manual are 
available there.

NOTES ABOUT ALTIVEC SUPPORT
After first getting NEC to compile, I modified the make file to recompile with 
the -faltivec flag to enable optimization for Altivec on the PowerPC G4. I  
then ran the original test files and compared run times with a non-optimized 
binary. Speed differences were negligible, and in many cases were actually 
slower. I'm not sure why processing times would be slower (other than disk 
caching), but the speed differences did not persuade me that this program  
would benefit from Altivec optimization. It may be that the source code would 
need a major re-writing to enable Altivec optimization. Further testing with 
more complex models may reveal that Altivec optimization does provide a 
meaningful improvement in speed.

USABILITY & RECOMPILING
This binary was produced on a Power Macintosh G4/400 running OS X Public Beta. 
I has not been tested on any other system configuration. You may find that 
this binary is unusable on your system. In that case, I encourage you to 
examine the changes I have made to the original sources and recompile for your 
system.

        THIS ARCHIVE DOES NOT INCLUDE SOURCE CODE OTHER THAN DIFFS.

If you wish to recompile NEC2 for Mac OS X / Darwin, you will need to get 
the f2c library from Bell Labs. The address is http://netlib.bell-labs.com. In 
addition, you will need Apple's Developer tools. Go to Apple's Developer site 
at http://www.apple.com/developer and sign up for a free Web-only account. You 
can then download the tools. You will need the tools in order to install the 
f2c library. NEC sources can be downloaded at the archive website above. I 
haven't tried it, but you should be able to use patch(1) with the diff file to 
patch the original sources with my modifications.

DISCLAIMER
Now for the legalese. This software is provided as-is. I make no warranty of 
any kind as to the usability of this software. I did not write the original 
source code from which this software was produced. I assume no responsibility 
for any loss or damage this software causes. Not responsible for lost or 
stolen items. Keep hands inside car at all times.

FEEDBACK
I appreciate your feedback! I hope to continue developing a Mac OS X usable 
version of NEC, including a front end for modeling and a back-end for viewing 
results. Getting the original NEC to compile was a huge first step. If you  
have suggestions or comments, please feel free to email me at KG4EFO@arrl.net.

Stay tuned for Mac OS X utilities for use with this port of NEC2.

