diff -Nru necpp-1.3.0+cvs20090101/CVS/Entries necpp-1.4.0+cvs20091005/CVS/Entries --- necpp-1.3.0+cvs20090101/CVS/Entries 2009-01-01 21:53:41.000000000 +0100 +++ necpp-1.4.0+cvs20091005/CVS/Entries 2009-10-06 00:08:23.000000000 +0200 @@ -1,15 +1,15 @@ /AUTHORS/1.5/Sun Jan 6 08:27:57 2008// /COPYING/1.1.1.1/Fri Sep 9 04:39:05 2005// -/ChangeLog/1.15/Thu Dec 18 13:04:15 2008// +/ChangeLog/1.17/Tue Jan 6 04:09:44 2009// /Doxyfile/1.4/Thu Nov 20 23:47:08 2008// /INSTALL/1.9/Sun Dec 14 21:43:40 2008// /Makefile.am/1.1.1.1/Fri Sep 9 04:39:05 2005// /Makefile.cvs/1.1.1.1/Fri Sep 9 04:39:05 2005// /Makefile.test/1.9/Mon Dec 8 01:23:43 2008// -/NEWS/1.3/Thu Jul 31 03:18:04 2008// +/NEWS/1.4/Mon Jan 5 06:30:05 2009// /README/1.6/Sun Dec 14 03:26:05 2008// -/TODO/1.4/Sun Dec 14 03:26:05 2008// -/configure.in/1.11/Sun Dec 14 03:26:05 2008// +/TODO/1.5/Tue Jan 6 04:09:44 2009// +/configure.in/1.12/Tue Jan 6 04:09:44 2009// /makefile.dist/1.6/Sun Dec 14 21:43:41 2008// -/necpp.kdevelop/1.24/Fri Dec 19 10:38:51 2008// +/necpp.kdevelop/1.25/Tue Jan 6 04:09:44 2009// D diff -Nru necpp-1.3.0+cvs20090101/ChangeLog necpp-1.4.0+cvs20091005/ChangeLog --- necpp-1.3.0+cvs20090101/ChangeLog 2008-12-18 14:04:15.000000000 +0100 +++ necpp-1.4.0+cvs20091005/ChangeLog 2009-01-06 05:09:44.000000000 +0100 @@ -1,7 +1,12 @@ Version 1.4 * Added accessor functions for radiation pattern statistics. +<<<<<<< ChangeLog * Renamed some methods * Added Ruby Wrapper to the C library +* Added code to detect wire intersections and throw an exception. +* Renamed some methods in the C library interface. This makes a more logical grouping when + getting statistics from radiation patterns. +* Added Ruby Wrapper to the C library libnecpp. This code is in the directory Ruby. Version 1.3 * Using the correct value for speed of light throughout (was using 299.8 as default freq, and this caused slight diff -Nru necpp-1.3.0+cvs20090101/NEWS necpp-1.4.0+cvs20091005/NEWS --- necpp-1.3.0+cvs20090101/NEWS 2008-07-31 05:18:04.000000000 +0200 +++ necpp-1.4.0+cvs20091005/NEWS 2009-01-05 07:30:05.000000000 +0100 @@ -1,3 +1,14 @@ +Version 1.4 + +New Ruby module. +C library interface cleanup. + + +Version 1.3 + +Switched to Lapack as the main method for doing LU decomposition. +Many many bug fixes. + Version 1.2.9 Some improvements with the configure.in file. Now detects the atlas libraries for LAPACK and uses them. Still more to be done in this area. diff -Nru necpp-1.3.0+cvs20090101/Python/PyNEC/python_module/nec_norm_rx_pattern.py necpp-1.4.0+cvs20091005/Python/PyNEC/python_module/nec_norm_rx_pattern.py --- necpp-1.3.0+cvs20090101/Python/PyNEC/python_module/nec_norm_rx_pattern.py 2005-10-28 15:40:51.000000000 +0200 +++ necpp-1.4.0+cvs20091005/Python/PyNEC/python_module/nec_norm_rx_pattern.py 2010-07-23 15:49:45.000000000 +0200 @@ -39,8 +39,8 @@ -import numarray -import numarray.ma +import numpy +import numpy.ma #some utility functions @@ -50,7 +50,7 @@ """ n_theta = _get_n_theta(arg0) n_phi = _get_n_phi(arg0) - ar = numarray.reshape(_PyNEC.nec_norm_rx_pattern_get_mag(arg0),(n_theta, n_phi)) + ar = numpy.reshape(_PyNEC.nec_norm_rx_pattern_get_mag(arg0),(n_theta, n_phi)) ar.transpose() return ar @@ -169,8 +169,8 @@ for j in range(n_theta) : l.append((theta_start+j*delta_theta, phi_start+i*delta_phi)) - ar = numarray.array(l); - ar = numarray.reshape(ar, (n_phi,n_theta,2)) + ar = numpy.array(l); + ar = numpy.reshape(ar, (n_phi,n_theta,2)) return ar @@ -187,7 +187,7 @@ Returns the array of normalized receiving gain in dB. """ mag = self.get_magnitude(*args) - gain = 20*numarray.ma.log10(mag) + gain = 20*numpy.ma.log10(mag) gain.set_fill_value(-999.999) return gain.filled() diff -Nru necpp-1.3.0+cvs20090101/Python/PyNEC/python_module/nec_radiation_pattern.py necpp-1.4.0+cvs20091005/Python/PyNEC/python_module/nec_radiation_pattern.py --- necpp-1.3.0+cvs20090101/Python/PyNEC/python_module/nec_radiation_pattern.py 2005-10-28 15:40:51.000000000 +0200 +++ necpp-1.4.0+cvs20091005/Python/PyNEC/python_module/nec_radiation_pattern.py 2010-07-23 15:49:45.000000000 +0200 @@ -39,7 +39,7 @@ -import numarray +import numpy import math import exceptions @@ -113,7 +113,7 @@ """ n_theta=_get_n_theta(arg1) n_phi=_get_n_phi(arg1) - return numarray.reshape(arg0,(n_phi,n_theta)) + return numpy.reshape(arg0,(n_phi,n_theta)) @@ -275,16 +275,16 @@ for i in range(n_phi) : for j in range(n_theta) : l.append((rho, phi_start+i*delta_phi,theta_start+j*delta_theta)) - ar = numarray.array(l); - ar = numarray.reshape(ar, (n_phi,n_theta,3)) + ar = numpy.array(l); + ar = numpy.reshape(ar, (n_phi,n_theta,3)) else : r = _get_range(*args) for i in range(n_phi) : for j in range(n_theta) : l.append((r, theta_start+j*delta_theta, phi_start+i*delta_phi)) - ar = numarray.array(l); - ar = numarray.reshape(ar, (n_phi,n_theta,3)) + ar = numpy.array(l); + ar = numpy.reshape(ar, (n_phi,n_theta,3)) return ar diff -Nru necpp-1.3.0+cvs20090101/Python/PyNEC/setup.py necpp-1.4.0+cvs20091005/Python/PyNEC/setup.py --- necpp-1.3.0+cvs20090101/Python/PyNEC/setup.py 2010-07-23 15:49:45.000000000 +0200 +++ necpp-1.4.0+cvs20091005/Python/PyNEC/setup.py 2010-07-23 15:49:45.000000000 +0200 @@ -9,15 +9,15 @@ #================================================================================================================================================================================== #checks the Numarray installation -print('\nNumarray installation check...') +print('\nNumpy installation check...') try: - from numarray import * + from numpy import * except: - print('FAILURE - PyNEC requires Numarray to be installed. Please install Numarrray first.') + print('FAILURE - PyNEC requires Numpy with old extensions numarray to be installed. Please install Numpy first first.') print('Installation aborted') sys.exit(-1) -print('SUCCESS - Numarray seems to be installed.') +print('SUCCESS - Numpy seems to be installed.') #================================================================================================================================================================================== #Detects the Python version number @@ -74,9 +74,9 @@ print('SUCCESS - Python include path found') #================================================================================================================================================================================== -#Looks for the Numarray "API path" +#Looks for the Numpy "API path" -print('\nLooking for the Numarray API path...') +print('\nLooking for the Numpy API path...') def test_api_path(str): open(os.path.join(str, 'libnumarray.h'), 'rb') @@ -87,7 +87,8 @@ if platform == 'win32' : api_path = os.path.join(sys.prefix, 'include','numarray') else : - api_path = os.path.join(sys.prefix, 'include', 'python'+python_version, 'numarray') +# api_path = os.path.join(sys.prefix, 'include', 'python'+python_version, 'numarray') + api_path = os.path.join(sys.prefix, 'share','pyshared','numpy','numarray','numpy') test_api_path(api_path) return api_path except: @@ -160,7 +161,7 @@ print('\nGenerating the makefile...') -if platform == 'linux2' or platform == 'win32' or platform == 'gnukfreebsd5' or platform == 'gnukfreebsd6': +if platform.startswith("linux") or platform.startswith("gnukfreebsd") or platform.startswith("win") : try : f = open ('makefile.'+platform, 'wb') except : @@ -178,7 +179,7 @@ list_hdrs = l + ['math_util', 'common', 'nec_results'] list_src = l + ['nec_context', 'nec_ground', 'nec_radiation_pattern', 'nec_exception', 'nec_structure_currents'] - if platform == 'linux2' or platform == 'gnukfreebsd5' or platform == 'gnukfreebsd6': + if platform.startswith("linux") or platform.startswith("gnukfreebsd") : f.write('\nPYMOD=python_module/_PyNEC.so\n'); hdrs = '\nHDRS = ' diff -Nru necpp-1.3.0+cvs20090101/Python/python_module/nec_norm_rx_pattern.py necpp-1.4.0+cvs20091005/Python/python_module/nec_norm_rx_pattern.py --- necpp-1.3.0+cvs20090101/Python/python_module/nec_norm_rx_pattern.py 2005-10-14 18:15:07.000000000 +0200 +++ necpp-1.4.0+cvs20091005/Python/python_module/nec_norm_rx_pattern.py 2010-07-23 15:49:45.000000000 +0200 @@ -39,8 +39,8 @@ -import numarray -import numarray.ma +import numpy +import numpy.ma #some utility functions @@ -50,7 +50,7 @@ """ n_theta = _get_n_theta(arg0) n_phi = _get_n_phi(arg0) - ar = numarray.reshape(_PyNEC.nec_norm_rx_pattern_get_mag(arg0),(n_theta, n_phi)) + ar = numpy.reshape(_PyNEC.nec_norm_rx_pattern_get_mag(arg0),(n_theta, n_phi)) ar.transpose() return ar @@ -169,8 +169,8 @@ for j in range(n_theta) : l.append((theta_start+j*delta_theta, phi_start+i*delta_phi)) - ar = numarray.array(l); - ar = numarray.reshape(ar, (n_phi,n_theta,2)) + ar = numpy.array(l); + ar = numpy.reshape(ar, (n_phi,n_theta,2)) return ar @@ -187,7 +187,7 @@ Returns the array of normalized receiving gain in dB. """ mag = self.get_magnitude(*args) - gain = 20*numarray.ma.log10(mag) + gain = 20*numpy.ma.log10(mag) gain.set_fill_value(-999.999) return gain.filled() diff -Nru necpp-1.3.0+cvs20090101/Python/python_module/nec_radiation_pattern.py necpp-1.4.0+cvs20091005/Python/python_module/nec_radiation_pattern.py --- necpp-1.3.0+cvs20090101/Python/python_module/nec_radiation_pattern.py 2005-10-14 18:15:07.000000000 +0200 +++ necpp-1.4.0+cvs20091005/Python/python_module/nec_radiation_pattern.py 2010-07-23 15:49:45.000000000 +0200 @@ -39,7 +39,7 @@ -import numarray +import numpy import math import exceptions @@ -113,7 +113,7 @@ """ n_theta=_get_n_theta(arg1) n_phi=_get_n_phi(arg1) - return numarray.reshape(arg0,(n_phi,n_theta)) + return numpy.reshape(arg0,(n_phi,n_theta)) @@ -259,15 +259,15 @@ for i in range(n_phi) : for j in range(n_theta) : l.append((rho, phi_start+i*delta_phi,theta_start+j*delta_theta)) - ar = numarray.array(l); - ar = numarray.reshape(ar, (n_phi,n_theta,3)) + ar = numpy.array(l); + ar = numpy.reshape(ar, (n_phi,n_theta,3)) else : for i in range(n_phi) : for j in range(n_theta) : l.append((theta_start+j*delta_theta, phi_start+i*delta_phi)) - ar = numarray.array(l); - ar = numarray.reshape(ar, (n_phi,n_theta,2)) + ar = numpy.array(l); + ar = numpy.reshape(ar, (n_phi,n_theta,2)) return ar diff -Nru necpp-1.3.0+cvs20090101/Ruby/CVS/Entries necpp-1.4.0+cvs20091005/Ruby/CVS/Entries --- necpp-1.3.0+cvs20090101/Ruby/CVS/Entries 2009-01-01 21:53:42.000000000 +0100 +++ necpp-1.4.0+cvs20091005/Ruby/CVS/Entries 2009-10-06 00:08:23.000000000 +0200 @@ -1,5 +1,5 @@ /README/1.5/Mon Dec 22 08:28:19 2008// -/build.sh/1.2/Wed Dec 31 10:54:12 2008// +/build.sh/1.3/Sun Jan 4 22:06:13 2009// /extconf.rb/1.1/Thu Dec 18 10:54:57 2008// /necpp.i/1.2/Fri Dec 19 10:36:48 2008// /test.rb/1.6/Sat Dec 27 09:23:07 2008// diff -Nru necpp-1.3.0+cvs20090101/Ruby/build.sh necpp-1.4.0+cvs20091005/Ruby/build.sh --- necpp-1.3.0+cvs20090101/Ruby/build.sh 2008-12-31 11:54:12.000000000 +0100 +++ necpp-1.4.0+cvs20091005/Ruby/build.sh 2009-01-04 23:06:13.000000000 +0100 @@ -2,7 +2,7 @@ # Script to build the nec2++ ruby module. # Change the RUBY environment variable # as appropriate for your system -RUBY=ruby +RUBY=ruby1.9 swig -v -c++ -ruby necpp.i ${RUBY} extconf.rb make diff -Nru necpp-1.3.0+cvs20090101/TODO necpp-1.4.0+cvs20091005/TODO --- necpp-1.3.0+cvs20090101/TODO 2008-12-14 04:26:05.000000000 +0100 +++ necpp-1.4.0+cvs20091005/TODO 2009-01-06 05:09:44.000000000 +0100 @@ -1,7 +1,7 @@ TODO list for nec2++ * Test and make sure that the Somerfeld Ground code is working (compare outputs with the FORTRAN version) -* BUG with S/N nec2++ -i gn2.nec �-g (check with PJW) +* BUG with S/N nec2++ -i gn2.nec -g (check with PJW) * Get CurrentInput comparison going with nec2diff * Work on Doxygen Source Documentation diff -Nru necpp-1.3.0+cvs20090101/configure.in necpp-1.4.0+cvs20091005/configure.in --- necpp-1.3.0+cvs20090101/configure.in 2008-12-14 04:26:05.000000000 +0100 +++ necpp-1.4.0+cvs20091005/configure.in 2009-01-06 05:09:44.000000000 +0100 @@ -1,7 +1,7 @@ AC_INIT(configure.in) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(necpp, 1.3.0) +AM_INIT_AUTOMAKE(necpp, 1.4.0) dnl ************************************************ diff -Nru necpp-1.3.0+cvs20090101/debian/changelog necpp-1.4.0+cvs20091005/debian/changelog --- necpp-1.3.0+cvs20090101/debian/changelog 2010-07-23 15:49:45.000000000 +0200 +++ necpp-1.4.0+cvs20091005/debian/changelog 2010-07-23 15:49:45.000000000 +0200 @@ -1,3 +1,30 @@ +necpp (1.4.0+cvs20091005-2ubuntu1) maverick; urgency=low + + * Merge from debian unstable, upstream fixes. (LP: #555555) + + -- David Sugar Thu, 08 Jul 2010 10:20:14 +0400 + +necpp (1.4.0+cvs20091005-2) unstable; urgency=low + + [ Emmanuel QUEMENER ] + * Add user manual for nec2++ and nec2diff commands + * Change compatibility version + * Fix build with gcc-4.4 (closes: #552297, #560507) + * Fix platform detection (closes: #533818) + + -- Emmanuel QUEMENER Wed, 04 Nov 2009 07:57:42 +0100 + +necpp (1.4.0+cvs20091005-1) unstable; urgency=low + + [ Emmanuel QUEMENER ] + * CVS snapshot based on new release + * Change NumArray references to NumPy in order to match next release + * Check for successful test-data/examples1.nec execution (closes: #531533) + * Correct source example in order to compile (closes: #545267) + * Change Automake build from 1.4 to 1.9 version (closes: #549135) + + -- Emmanuel QUEMENER Mon, 26 Oct 2009 10:04:00 +0200 + necpp (1.3.0+cvs20090101-1ubuntu2) karmic; urgency=low * src/XGetopt.cpp (LP: #447454) @@ -81,3 +108,60 @@ -- Emmanuel QUEMENER Thu, 1 Jun 2006 14:25:22 +0200 +necpp (1.3.0+cvs20090101-2) unstable; urgency=low + + [ Emmanuel QUEMENER ] + * Check for successful test-data/examples1.nec execution (closes: #531533) + * Correct source example in order to compile (closes: #545267) + * Change Automake build from 1.4 to 1.9 version (closes: #549135) + + -- Emmanuel QUEMENER Thu, 01 Oct 2009 12:18:53 +0200 + +necpp (1.3.0+cvs20090101-1) unstable; urgency=low + + [ Emmanuel QUEMENER ] + * CVS snapshot based on new release. + * Add Lapack and Atlas librairies dependencies + * Change dependencies to TexLive + + -- Emmanuel QUEMENER Thu, 04 Jan 2009 06:00:28 +0100 + +necpp (1.2.6+cvs20070816-1.3) unstable; urgency=low + + [ Peter Eisentraut ] + * Non-maintainer upload. + * Fixed bashism in debian/rules (patch by Chris Lamb) (closes: #484415) + * Don't ignore errors from make distclean, per lintian + * Fixed sections, per lintian + * Updated standards version + + -- Peter Eisentraut Tue, 08 Jul 2008 18:13:58 +0200 + +necpp (1.2.6+cvs20070816-1.2) unstable; urgency=low + + * Non-maintainer upload. + * Add includes needed by gcc-4.3, closes: 474838 + Thanks: peter green + + -- Riku Voipio Tue, 03 Jun 2008 17:35:42 +0300 + +necpp (1.2.6+cvs20070816-1.1) unstable; urgency=medium + + * Non-maintainer upload. + * Fix FTBFS with GCC 4.3 (Closes: #455186). + + -- Luk Claes Sat, 22 Mar 2008 08:18:08 +0000 + +necpp (1.2.6+cvs20070816-1) unstable; urgency=low + + * New release. + * Correct 4.3 compilation errors (Closes: bug#417442) + + -- Emmanuel QUEMENER Thu, 16 Aug 2007 16:17:35 +0200 + +necpp (1.2.4+cvs20060601-1) unstable; urgency=low + + * Initial release (Closes: bug#379410). + + -- Emmanuel QUEMENER Thu, 1 Jun 2006 14:25:22 +0200 + diff -Nru necpp-1.3.0+cvs20090101/debian/compat necpp-1.4.0+cvs20091005/debian/compat --- necpp-1.3.0+cvs20090101/debian/compat 2010-07-23 15:49:45.000000000 +0200 +++ necpp-1.4.0+cvs20091005/debian/compat 2010-07-23 15:49:45.000000000 +0200 @@ -1 +1 @@ -4 +5 diff -Nru necpp-1.3.0+cvs20090101/debian/control necpp-1.4.0+cvs20091005/debian/control --- necpp-1.3.0+cvs20090101/debian/control 2010-07-23 15:49:45.000000000 +0200 +++ necpp-1.4.0+cvs20091005/debian/control 2010-07-23 15:49:45.000000000 +0200 @@ -3,8 +3,8 @@ Priority: optional Maintainer: Ubuntu MOTU Developers XSBC-Original-Maintainer: Emmanuel QUEMENER -Build-Depends: debhelper (>= 5.0.37.2), autoconf, libtool, automake1.4, autotools-dev, python-all-dev, python-numarray, python-support (>= 0.3), texlive, swig, libatlas-base-dev, liblapack-dev -Standards-Version: 3.8.0 +Build-Depends: debhelper (>= 5.0.37.2), autoconf, libtool, automake1.9, autotools-dev, python-all-dev, python-numpy, python-support (>= 0.3), texlive, swig, libatlas-base-dev, liblapack-dev +Standards-Version: 3.8.3 Package: necpp Architecture: any @@ -18,6 +18,7 @@ This program is initially based on Fortran NEC2 software (also nec package). Package: libnecpp0 +Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: library to use NEC2++ @@ -29,23 +30,10 @@ This package contains a shared library, usable to build and run your own program directly using NEC2 techniques without calling nec2++ binary program. -Package: libnecpp-dev -Section: libdevel -Architecture: any -Depends: libnecpp0 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} -Description: development files for libnecpp - The NEC2 (Numerical Electromagnetics Code) is software for modelling antennas - using the Method of Moments. It was developed at Lawrence Livermore - Laboratories, and remains widely used, despite the old fashioned punched card - style input required. - . - This package contains the header files and static library needed to - compile applications that use libnecpp. - Package: python-necpp Section: python Architecture: any -Depends: ${python:Depends}, ${shlibs:Depends} +Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends} Provides: ${python:Provides} XB-Python-Version: ${python:Versions} Description: Python module for using NEC2++ @@ -56,3 +44,17 @@ . With this Python module, it is possible to use NEC2 techniques directly from Python. + +Package: libnecpp-dev +Section: libdevel +Architecture: any +Depends: libnecpp0 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: development files for libnecpp + The NEC2 (Numerical Electromagnetics Code) is software for modelling antennas + using the Method of Moments. It was developed at Lawrence Livermore + Laboratories, and remains widely used, despite the old fashioned punched card + style input required. + . + This package contains the header files and static library needed to + compile applications that use libnecpp. + diff -Nru necpp-1.3.0+cvs20090101/debian/copyright necpp-1.4.0+cvs20091005/debian/copyright --- necpp-1.3.0+cvs20090101/debian/copyright 2010-07-23 15:49:45.000000000 +0200 +++ necpp-1.4.0+cvs20091005/debian/copyright 2010-07-23 15:49:45.000000000 +0200 @@ -3,9 +3,8 @@ It was downloaded from http://alioth.debian.org/projects/necpp/ -Copyright Holder: - Tim Molteno - Remi Sassolas +Copyright 2009 Tim Molteno +Copyright 2009 Remi Sassolas License: diff -Nru necpp-1.3.0+cvs20090101/debian/rules necpp-1.4.0+cvs20091005/debian/rules --- necpp-1.3.0+cvs20090101/debian/rules 2010-07-23 15:49:45.000000000 +0200 +++ necpp-1.4.0+cvs20091005/debian/rules 2010-07-23 15:49:45.000000000 +0200 @@ -110,6 +110,7 @@ mkdir -p $(CURDIR)/debian/python-necpp/usr/share/doc/python-necpp/examples/ cp $(CURDIR)/Python/PyNEC/test_scripts/*.py $(CURDIR)/debian/python-necpp/usr/share/doc/python-necpp/examples/ + cp $(CURDIR)/Python/PyNEC/test_nec_files/*.nec $(CURDIR)/debian/python-necpp/usr/share/doc/python-necpp/examples/ # Build architecture-independent files here. @@ -124,7 +125,7 @@ dh_installdocs dh_installexamples dh_pysupport - dh_installman + dh_installman nec2++.1 nec2diff.1 dh_link dh_strip dh_compress diff -Nru necpp-1.3.0+cvs20090101/example/makefile necpp-1.4.0+cvs20091005/example/makefile --- necpp-1.3.0+cvs20090101/example/makefile 2006-01-09 22:41:12.000000000 +0100 +++ necpp-1.4.0+cvs20091005/example/makefile 2010-07-23 15:49:45.000000000 +0200 @@ -40,14 +40,14 @@ ../src/c_evlcom.cpp ../src/c_plot_card.cpp ../src/misc.cpp \ ../src/nec_context.cpp ../src/nec_output.cpp ../src/c_geometry.cpp \ ../src/nec_exception.cpp ../src/nec_radiation_pattern.cpp \ - ../src/nec_structure_currents.cpp + ../src/nec_structure_currents.cpp ../src/electromag.cpp NECPP_OBJS = $(NECPP_SRC:.cpp=.o) CPP_SRC = test_cpp.cpp CPP_OBJS = $(CPP_SRC:.cpp=.o) -CXXFLAGS=-I ../src/ -O3 +CXXFLAGS=-I ../src/ -I ../ -O3 test_cpp: ${CPP_OBJS} ${NECPP_OBJS} gcc -o test_cpp ${CPP_OBJS} ${NECPP_OBJS} -lstdc++ -lm diff -Nru necpp-1.3.0+cvs20090101/example/test_cpp.cpp necpp-1.4.0+cvs20091005/example/test_cpp.cpp --- necpp-1.3.0+cvs20090101/example/test_cpp.cpp 2006-02-15 22:22:57.000000000 +0100 +++ necpp-1.4.0+cvs20091005/example/test_cpp.cpp 2010-07-23 15:49:45.000000000 +0200 @@ -23,6 +23,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include "config.h" +#include "electromag.h" #include "c_geometry.h" #include "nec_context.h" #include "nec_exception.h" @@ -36,7 +40,8 @@ << "Nec2++ C++ example. Running (takes a few minutes...)" << endl; nec_context nec; - nec.set_results_stdout(false); + /* nec.set_results_stdout(false); */ + nec.set_results_format(RESULT_FORMAT_NEC); nec.initialize(); /* diff -Nru necpp-1.3.0+cvs20090101/nec2++.1 necpp-1.4.0+cvs20091005/nec2++.1 --- necpp-1.3.0+cvs20090101/nec2++.1 1970-01-01 01:00:00.000000000 +0100 +++ necpp-1.4.0+cvs20091005/nec2++.1 2010-07-23 15:49:45.000000000 +0200 @@ -0,0 +1,45 @@ +.TH nec2++ 1 "Nov 3, 2009" "NEC++" + +.SH NAME +nec2++ \- NEC2 (Numerical Electromagnetics Code) is software for modelling +antennas using the Method of Moments. + +.SH SYNOPSIS +.B nec2++ +.br + +.SH DESCRIPTION +.B nec2++ +performs antennas modelling using the Method of Moments. + +.SH OPTIONS +.B +.IP -i +Set the input file-name instead of standard input +.B +.IP -o] +Set the output file-name instead of standard output +.B +.IP -g +Print maximum gain to stdout. +.B +.IP -b +Perform NEC++ Benchmark. +.B +.IP -s +Print results to standard output. +.B +.IP -c +Print results in comma-separated-value (CSV) format, this options is used in conjunction with (-s) above. +.B +.IP -h +Print this usage information and exit. +.B +.IP -v +Print nec2++ version number and exit. + +.SH AUTHOR +The C++ port started and completed by Tim Molteno +The Python work is done by Remi Sassolas +This work could not have been done without the tremendous effort put into the C +port by Neoklis Kyriazis. diff -Nru necpp-1.3.0+cvs20090101/nec2diff.1 necpp-1.4.0+cvs20091005/nec2diff.1 --- necpp-1.3.0+cvs20090101/nec2diff.1 1970-01-01 01:00:00.000000000 +0100 +++ necpp-1.4.0+cvs20091005/nec2diff.1 2010-07-23 15:49:45.000000000 +0200 @@ -0,0 +1,18 @@ +.TH nec2diff 1 "Nov 3, 2009" "NEC++" + +.SH NAME +nec2diff \- NEC2 (Numerical Electromagnetics Code) is software for modelling +antennas using the Method of Moments. + +.SH SYNOPSIS +.B nec2diff + +.SH DESCRIPTION +.B nec2diff +evaluates differences between 2 result files given as parameters. + +.SH AUTHOR +The C++ port started and completed by Tim Molteno +The Python work is done by Remi Sassolas +This work could not have been done without the tremendous effort put into the C +port by Neoklis Kyriazis. diff -Nru necpp-1.3.0+cvs20090101/necpp.kdevelop necpp-1.4.0+cvs20091005/necpp.kdevelop --- necpp-1.3.0+cvs20090101/necpp.kdevelop 2008-12-19 11:38:51.000000000 +0100 +++ necpp-1.4.0+cvs20091005/necpp.kdevelop 2009-01-06 05:09:44.000000000 +0100 @@ -3,7 +3,7 @@ Tim Molteno tim@physics.otago.ac.nz - 1.3.0 + 1.4.0 KDevAutoProject C++ @@ -32,7 +32,7 @@ -b true - -b + -i ../test_data/intersection.nec -o ../test_data/intersection.out /home/tim/alioth/necpp/debug true false @@ -263,8 +263,8 @@ /usr/share/qt3 3 EmbeddedKDevDesigner - /usr/bin/qmake - /usr/bin/designer + + diff -Nru necpp-1.3.0+cvs20090101/src/CVS/Entries necpp-1.4.0+cvs20091005/src/CVS/Entries --- necpp-1.3.0+cvs20090101/src/CVS/Entries 2009-01-01 21:53:43.000000000 +0100 +++ necpp-1.4.0+cvs20091005/src/CVS/Entries 2009-10-06 00:08:23.000000000 +0200 @@ -1,7 +1,7 @@ /AntennaInput.h/1.1.1.1/Fri Sep 9 04:39:10 2005// /BaseInput.h/1.1.1.1/Fri Sep 9 04:39:10 2005// /CurrentInput.h/1.1.1.1/Fri Sep 9 04:39:10 2005// -/Makefile.am/1.6/Tue Jul 22 08:57:34 2008// +/Makefile.am/1.7/Tue Jan 6 02:31:53 2009// /PowerBudget.h/1.1.1.1/Fri Sep 9 04:39:10 2005// /RadiationInput.h/1.1.1.1/Fri Sep 9 04:39:10 2005// /XGetopt.cpp/1.2/Sun Jan 6 08:27:57 2008// @@ -10,16 +10,16 @@ /atlas_check.sh/1.3/Sun Jul 27 02:54:53 2008// /c_evlcom.cpp/1.2/Fri Jan 11 04:26:58 2008// /c_evlcom.h/1.1.1.1/Fri Sep 9 04:39:10 2005// -/c_geometry.cpp/1.14/Sun Dec 14 21:43:41 2008// -/c_geometry.h/1.5/Sun Dec 14 21:43:41 2008// +/c_geometry.cpp/1.16/Tue Jan 6 04:34:08 2009// +/c_geometry.h/1.6/Tue Jan 6 04:09:44 2009// /c_ggrid.cpp/1.5/Wed Nov 12 01:40:25 2008// /c_ggrid.h/1.4/Wed Nov 12 01:40:25 2008// /c_plot_card.cpp/1.2/Fri Aug 1 01:12:53 2008// /c_plot_card.h/1.2/Fri Aug 1 01:12:53 2008// -/common.h/1.9/Sat Dec 27 09:23:07 2008// +/common.h/1.11/Tue Jan 6 04:09:44 2009// /electromag.cpp/1.1/Fri Mar 10 00:41:19 2006// /electromag.h/1.3/Fri Mar 10 00:41:19 2006// -/libNEC.cpp/1.3/Sat Dec 27 09:23:07 2008// +/libNEC.cpp/1.4/Tue Jan 6 02:31:53 2009// /libnecpp.h/1.7/Mon Dec 29 10:02:12 2008// /math_util.h/1.6/Fri Dec 19 00:29:54 2008// /matrix_algebra.cpp/1.11/Mon Dec 8 23:39:27 2008// @@ -33,16 +33,17 @@ /nec_context.h/1.13/Sat Dec 27 09:23:07 2008// /nec_debug.h/1.1.1.1/Fri Sep 9 04:39:11 2005// /nec_exception.cpp/1.3/Mon Dec 8 23:39:27 2008// -/nec_exception.h/1.3/Mon Dec 8 23:39:27 2008// +/nec_exception.h/1.4/Tue Jan 6 04:34:08 2009// /nec_ground.cpp/1.2/Thu Mar 9 23:38:54 2006// /nec_ground.h/1.3/Mon Dec 8 23:39:27 2008// /nec_output.cpp/1.4/Wed Nov 12 01:40:25 2008// /nec_output.h/1.1.1.1/Fri Sep 9 04:39:11 2005// -/nec_radiation_pattern.cpp/1.13/Fri Dec 19 09:56:09 2008// -/nec_radiation_pattern.h/1.15/Sat Dec 27 09:23:07 2008// +/nec_radiation_pattern.cpp/1.15/Tue Jan 6 02:31:53 2009// +/nec_radiation_pattern.h/1.16/Mon Jan 5 06:30:05 2009// /nec_results.h/1.11/Thu Dec 18 13:04:16 2008// -/nec_structure_currents.cpp/1.7/Tue Dec 9 00:46:59 2008// -/nec_structure_currents.h/1.6/Fri Jan 11 04:26:58 2008// +/nec_structure_currents.cpp/1.9/Tue Jan 6 04:09:44 2009// +/nec_structure_currents.h/1.8/Tue Jan 6 04:09:44 2009// +/nec_wire.h/1.3/Tue Jan 6 04:34:08 2009// /net_solve.cpp/1.2/Sun Dec 14 03:26:05 2008// /safe_array.h/1.13/Mon Dec 29 10:02:12 2008// D diff -Nru necpp-1.3.0+cvs20090101/src/Makefile.am necpp-1.4.0+cvs20091005/src/Makefile.am --- necpp-1.3.0+cvs20090101/src/Makefile.am 2010-07-23 15:49:45.000000000 +0200 +++ necpp-1.4.0+cvs20091005/src/Makefile.am 2010-07-23 15:49:45.000000000 +0200 @@ -5,7 +5,7 @@ nec2diff_SOURCES = AntennaInput.h BaseInput.h CurrentInput.h necDiff.cpp PowerBudget.h RadiationInput.h include_HEADERS = libnecpp.h -noinst_HEADERS = nec_exception.h nec_debug.h +noinst_HEADERS = nec_debug.h nec_exception.h nec_wire.h # set the include path found by configure INCLUDES = $(all_includes) diff -Nru necpp-1.3.0+cvs20090101/src/c_geometry.cpp necpp-1.4.0+cvs20091005/src/c_geometry.cpp --- necpp-1.3.0+cvs20090101/src/c_geometry.cpp 2010-07-23 15:49:45.000000000 +0200 +++ necpp-1.4.0+cvs20091005/src/c_geometry.cpp 2010-07-23 15:49:45.000000000 +0200 @@ -17,6 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include +#include #include "c_geometry.h" #include "nec_context.h" @@ -92,56 +93,6 @@ return 0; } - -/* - parse_geometry is the main routine for input of geometry data. - - ANTLR Grammar for geometry input - - geometry - : (geometry_element {transform}*)+ - geometry_end - ; - - geometry_element - : wire - | arc - | helix - | patch - | multi_patch - ; - - transform - : scale - | reflect - | rotate - | move - ; - - wire = "GW" int int real real real real real real {taper} - taper = "GC" xxx - arc = "GA" - helix = "GH" - - patch = "SP" - multi_patch = "SM" {patch_data}+ - patch_data = "SC" - - scale = "GS" - reflect = "GX" - rotate = "GR" - move = "GM" - - geometry_end = "GE" .+ - - int: - [0-9]+; - - real: - int:{.int}; - -*/ - #include "c_plot_card.h" #include @@ -536,6 +487,7 @@ while( true ); } +#include "nec_wire.h" /** We have finished with the geometry description, now connect things up. @@ -551,7 +503,29 @@ if (card_int_2 != 0) in_context->plot_card.set_plot_real_imag_currents(); - // now proceed and complete the geometry setup... + /* Check to see whether any wires intersect with one another */ + for (uint32_t i=0; i j) + { + nec_wire b = m_wires[j]; + vector wires = a.intersect(b); + if (wires.size() > 2) + { + nec_exception* nex = new nec_exception("GEOMETRY DATA ERROR -- WIRE #"); + nex->append(j+1); + nex->append(" INTERSECTS WIRE #"); + nex->append(i+1); + throw nex; + } + } + } + } + +// now proceed and complete the geometry setup... // Check here that patches form a closed surfaceAntennaInput /* From Jerry Burke (the original author of NEC2): @@ -748,6 +722,9 @@ radz= rad; nec_3vector xs1(xw1,yw1,zw1); + nec_3vector x_end(xw2,yw2,zw2); + + m_wires.push_back(nec_wire(xs1, x_end, rad)); for (int i = istart; i < n; i++ ) { @@ -769,6 +746,7 @@ x2[n-1]= xw2; y2[n-1]= yw2; z2[n-1]= zw2; + } /*-----------------------------------------------------------------------*/ diff -Nru necpp-1.3.0+cvs20090101/src/c_geometry.h necpp-1.4.0+cvs20091005/src/c_geometry.h --- necpp-1.3.0+cvs20090101/src/c_geometry.h 2008-12-14 22:43:41.000000000 +0100 +++ necpp-1.4.0+cvs20091005/src/c_geometry.h 2009-01-06 05:09:44.000000000 +0100 @@ -27,6 +27,7 @@ class nec_context; #include "nec_output.h" +#include "nec_wire.h" @@ -165,6 +166,8 @@ nec_context* m_context; nec_output_file* m_output; + + std::vector m_wires; }; diff -Nru necpp-1.3.0+cvs20090101/src/common.h necpp-1.4.0+cvs20091005/src/common.h --- necpp-1.3.0+cvs20090101/src/common.h 2008-12-27 10:23:07.000000000 +0100 +++ necpp-1.4.0+cvs20091005/src/common.h 2009-01-06 05:09:44.000000000 +0100 @@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include /*! \brief Change basic type used by nec2++ This typedef allows us to use nec2++ with @@ -31,11 +32,11 @@ /* Version information */ #define nec_version_major "1" -#define nec_version_minor "3" -#define nec_version_build "1" +#define nec_version_minor "4" +#define nec_version_build "0" #ifndef nec_build_date - #define nec_build_date "2008-12-27" + #define nec_build_date "2009-01-02" #endif #ifndef build_version diff -Nru necpp-1.3.0+cvs20090101/src/libNEC.cpp necpp-1.4.0+cvs20091005/src/libNEC.cpp --- necpp-1.3.0+cvs20090101/src/libNEC.cpp 2008-12-27 10:23:07.000000000 +0100 +++ necpp-1.4.0+cvs20091005/src/libNEC.cpp 2009-01-06 03:31:53.000000000 +0100 @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2004-2005 by Tim Molteno * + * Copyright (C) 2004-2008 by Tim Molteno * * tim@molteno.net * * * * This program is free software; you can redistribute it and/or modify * diff -Nru necpp-1.3.0+cvs20090101/src/matrix_algebra.cpp necpp-1.4.0+cvs20091005/src/matrix_algebra.cpp --- necpp-1.3.0+cvs20090101/src/matrix_algebra.cpp 2008-12-09 00:39:27.000000000 +0100 +++ necpp-1.4.0+cvs20091005/src/matrix_algebra.cpp 2010-07-23 15:49:45.000000000 +0200 @@ -210,7 +210,7 @@ #include "matrix_algebra.h" #include "nec_output.h" -#include "config.h" +//#include "config.h" #ifdef NEC_MATRIX_CHECK //#define NEC_MATRIX_CHECK diff -Nru necpp-1.3.0+cvs20090101/src/nec_context.cpp necpp-1.4.0+cvs20091005/src/nec_context.cpp --- necpp-1.3.0+cvs20090101/src/nec_context.cpp 2010-07-23 15:49:45.000000000 +0200 +++ necpp-1.4.0+cvs20091005/src/nec_context.cpp 2010-07-23 15:49:45.000000000 +0200 @@ -22,8 +22,6 @@ #include "c_geometry.h" #include "nec_exception.h" -#include - nec_context::nec_context() { m_output_fp=NULL; diff -Nru necpp-1.3.0+cvs20090101/src/nec_exception.h necpp-1.4.0+cvs20091005/src/nec_exception.h --- necpp-1.3.0+cvs20090101/src/nec_exception.h 2008-12-09 00:39:27.000000000 +0100 +++ necpp-1.4.0+cvs20091005/src/nec_exception.h 2009-01-06 05:34:08.000000000 +0100 @@ -42,21 +42,11 @@ m_message << message << code; } - void append(const char* message) + template void append(const T& message) { m_message << message; } - void append(const int i) - { - m_message << i; - } - - void append(const nec_float i) - { - m_message << i; - } - std::string get_message() { std::string ret = m_message.str(); diff -Nru necpp-1.3.0+cvs20090101/src/nec_radiation_pattern.cpp necpp-1.4.0+cvs20091005/src/nec_radiation_pattern.cpp --- necpp-1.3.0+cvs20090101/src/nec_radiation_pattern.cpp 2008-12-19 10:56:09.000000000 +0100 +++ necpp-1.4.0+cvs20091005/src/nec_radiation_pattern.cpp 2009-01-06 03:31:53.000000000 +0100 @@ -72,7 +72,8 @@ _polarization_axial_ratio.resize(n_angles); _polarization_tilt.resize(n_angles); _polarization_sense_index.resize(n_angles); - + _averaging_scales.resize(n_angles); + _e_theta.resize(n_angles); _e_phi.resize(n_angles); _e_r.resize(n_angles); @@ -486,6 +487,7 @@ _polarization_axial_ratio[result_counter] = pol_axial_ratio; _polarization_tilt[result_counter] = tilta; _polarization_sense_index[result_counter] = pol_sense_index; + _averaging_scales[result_counter] = (sin(tha) * (n_theta - 1) / n_theta) + 1.0/n_theta; } /* if ( _ifar == 1) */ result_counter++; @@ -540,15 +542,15 @@ switch (m_rp_normalization) { case 1: - norm_type = " MAJOR AXIS"; break; + norm_type = "MAJOR AXIS"; break; case 2: - norm_type = " MINOR AXIS"; break; + norm_type = "MINOR AXIS"; break; case 3: - norm_type = " VERTICAL"; break; + norm_type = "VERTICAL"; break; case 4: - norm_type = " HORIZONTAL"; break; + norm_type = "HORIZONTAL"; break; case 5: - norm_type = " TOTAL "; break; + norm_type = "TOTAL "; break; default: throw new nec_exception("Unknown Gain Normalization Encountered."); } @@ -556,8 +558,10 @@ output_helper oh(os,_result_format); oh.section_start("NORMALIZED GAIN"); - os << " " << norm_type << " GAIN" << endl; - os << " NORMALIZATION FACTOR: "; oh.real_out(7,2,normalization_factor,false); os << " db" << endl << endl; + { stringstream mess; mess << norm_type << " GAIN"; oh.center_text(mess.str(), ""); } + { stringstream mess; mess << "NORMALIZATION FACTOR: " << normalization_factor << " dB"; oh.center_text(mess.str(), ""); } +/* os << " " << norm_type << " GAIN" << endl; + os << " NORMALIZATION FACTOR: "; oh.real_out(7,2,normalization_factor,false); os << " db" << endl << endl; */ os << " ---- ANGLES ---- ---- ANGLES ---- ---- ANGLES ----" << endl; os << " THETA PHI GAIN THETA PHI GAIN THETA PHI GAIN" << endl; os << " DEGREES DEGREES DB DEGREES DEGREES DB DEGREES DEGREES DB" << endl; diff -Nru necpp-1.3.0+cvs20090101/src/nec_radiation_pattern.h necpp-1.4.0+cvs20091005/src/nec_radiation_pattern.h --- necpp-1.3.0+cvs20090101/src/nec_radiation_pattern.h 2008-12-27 10:23:07.000000000 +0100 +++ necpp-1.4.0+cvs20091005/src/nec_radiation_pattern.h 2009-01-05 07:30:05.000000000 +0100 @@ -263,6 +263,34 @@ } /****************** STATISTICS ********************/ + + +private: + nec_float mean(real_array& pattern) const + { + nec_float sum = 0.0; + long len = pattern.size(); + for (long i=0;in; +} + +int nec_structure_currents::get_m() +{ + return m_geometry->m; +} + nec_structure_currents::nec_structure_currents(nec_context * in_context, enum excitation_type in_pattype, int in_nload, @@ -48,6 +60,7 @@ current_nb_elements = 0; q_density_nb_elements = 0; + q_density_last_printed = 0; patch_nb_elements = 0; } @@ -339,11 +352,12 @@ if ( iptflq != -1) { oh.section_start("CHARGE DENSITIES"); - os << " DISTANCES IN WAVELENGTHS" << endl << endl; + oh.center_text("DISTANCES IN WAVELENGTHS",""); + os << endl; os << " SEG TAG COORDINATES OF SEG CENTER SEG CHARGE DENSITY (COULOMBS/METER)" << endl; os << " NO: NO: X Y Z LENGTH REAL IMAGINARY MAGN PHASE" << endl; - for(int i=0; i< q_density_nb_elements; i++) + for(int i=q_density_last_printed; i< q_density_nb_elements; i++) { oh.start_record(); oh.padding(" "); @@ -359,16 +373,18 @@ oh.real_out(9,3, arg_degrees(_q_density[i]), false); oh.separator(); oh.end_record(); } + q_density_last_printed = q_density_nb_elements; } } /*if ( m_geometry->n != 0) */ if ( m_geometry->m != 0) { oh.section_start("SURFACE PATCH CURRENTS"); - os << " DISTANCE IN WAVELENGTHS" << endl; - os << " CURRENT IN AMPS/METER" << endl << endl; - os << " --------- SURFACE COMPONENTS --------"; - os << " ---------------- RECTANGULAR COMPONENTS ----------------" << endl; + oh.center_text("DISTANCES IN WAVELENGTHS",""); + oh.center_text("CURRENT IN AMPS/METER",""); + os << endl << endl; + oh.center_text("SURFACE COMPONENTS","---------"); + oh.center_text("RECTANGULAR COMPONENTS","---------"); os << " PCH --- PATCH CENTER --- TANGENT VECTOR 1 TANGENT VECTOR 2"; os << " ------- X ------ ------- Y ------ ------- Z ------" << endl; os << " No: X Y Z MAG. PHASE MAG. PHASE"; diff -Nru necpp-1.3.0+cvs20090101/src/nec_structure_currents.h necpp-1.4.0+cvs20091005/src/nec_structure_currents.h --- necpp-1.3.0+cvs20090101/src/nec_structure_currents.h 2008-01-11 05:26:58.000000000 +0100 +++ necpp-1.4.0+cvs20091005/src/nec_structure_currents.h 2009-01-06 05:09:44.000000000 +0100 @@ -22,10 +22,10 @@ #include "nec_results.h" #include "math_util.h" #include "nec_context.h" -#include "c_geometry.h" class nec_context; +class c_geometry; class nec_structure_currents : public nec_base_result { @@ -63,15 +63,9 @@ return iptflq; } - int get_n() - { - return m_geometry->n; - } + int get_n(); - int get_m() - { - return m_geometry->m; - } + int get_m(); vector get_current_segment_number() { @@ -219,6 +213,7 @@ int current_nb_elements; int q_density_nb_elements; + int q_density_last_printed; int patch_nb_elements; complex_array zarray; diff -Nru necpp-1.3.0+cvs20090101/src/nec_wire.h necpp-1.4.0+cvs20091005/src/nec_wire.h --- necpp-1.3.0+cvs20090101/src/nec_wire.h 1970-01-01 01:00:00.000000000 +0100 +++ necpp-1.4.0+cvs20091005/src/nec_wire.h 2009-01-06 05:34:08.000000000 +0100 @@ -0,0 +1,180 @@ +/* + Copyright (C) 2008 Timothy C.A. Molteno + tim@physics.otago.ac.nz + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifndef __nec_wire__ +#define __nec_wire__ + +#include "math_util.h" + +/*!\brief A class to handle properties of wires. +*/ +class nec_wire +{ +public: + nec_wire(const nec_3vector& a, const nec_3vector& b, nec_float in_radius) + : x0(a), x1(b), radius(in_radius) + { + } + + nec_3vector parametrize(nec_float s) const + { + nec_3vector ret = x0; + ret += (x1 - x0)*s; + return ret; + } + + nec_float distance(const nec_3vector& a, const nec_3vector& b) const + { + return (a - b).norm(); + } + + nec_float length() const + { + return distance(x0, x1); + } + + /*!\brief Calculate whether two wires intersect. + \return A list of the wires that should be created. + */ + std::vector intersect(nec_wire& b) + { + nec_float d2,sa,sb; + int_solve(x0,x1, b.x0, b.x1, d2,sa,sb); + + nec_float epsa = b.radius / length(); // Set by the radius of the other wires + nec_float epsb = radius / b.length(); // Set by the radius of the other wires + + std::vector ret; + + if (d2 > (radius + b.radius)) return ret; + + if ((sa >= -epsa) && (sa <= 1.0 + epsa) && (sb >= -epsb) && (sb <= 1.0 + epsb)) + { + nec_3vector a_pt = parametrize(sa); + nec_3vector b_pt = b.parametrize(sb); + + if (sa > epsa) ret.push_back(nec_wire(x0, a_pt, radius)); + if (sa < 1.0 - epsa) ret.push_back(nec_wire(a_pt, x1, radius)); + + if (sb > epsb) ret.push_back(nec_wire(b.x0, b_pt, b.radius)); + if (sb < 1.0 - epsb) ret.push_back(nec_wire(b_pt, b.x1, b.radius)); + } + + return ret; + } + + bool similar(nec_wire& b) + { + // Check if the wires share two endpoints + nec_float d1 = distance(x0, b.x0); + nec_float d2 = distance(x0, b.x1); + nec_float da = std::min(d1,d2); + + nec_float d3 = distance(x1, b.x1); + nec_float d4 = distance(x1, b.x0); + nec_float db = std::min(d3,d4); + + if ((std::abs(da) < 1e-3) && (std::abs(db) < 1e-3)) + return true; + else + return false; + } + +/*! + + We use the following Mathematica expression to get the solution for the intersection + of two cylinders. We set up the distance between the two center lines as d2 + + The equations are derived from sympy in the file intersections.py + + d2 = (a0x - b0x + sa*(a1x - a0x) - sb*(b1x - b0x))^2 + + (a0z - b0z + sa*(a1z - a0z) - sb*(b1z - b0z))^2 + + (a0y - b0y + sa*(a1y - a0y) - sb*(b1y - b0y))^2; + + soln = Solve[{D[d2,sa] == 0, D[d2,sb] == 0}, {sa,sb}]; + Simplify[soln] + + sa -> (2*a0x*(a0x - a1x) + 2*a0y*(a0y - a1y) + 2*a0z*(a0z - a1z) + 2*(-a0x \ + + a1x)*b0x + 2*(-a0y + a1y)*b0y + 2*(-a0z + a1z)*b0z + ((-4*(a0x^2 + a0y^2 + \ + a1x*b0x - a0x*(a1x + b0x) + a1y*b0y - a0y*(a1y + b0y) + (a0z - a1z)*(a0z - \ + b0z))*((a0x - a1x)*(b0x - b1x) + (a0y - a1y)*(b0y - b1y) + (a0z - a1z)*(b0z \ + - b1z)) + 4*((a0x - a1x)^2 + (a0y - a1y)^2 + (a0z - a1z)^2)*((a0x - \ + b0x)*(b0x - b1x) + (a0y - b0y)*(b0y - b1y) + (a0z - b0z)*(b0z - \ + b1z)))*(-2*(a0x - a1x)*(b0x - b1x) - 2*(a0y - a1y)*(b0y - b1y) - 2*(a0z - \ + a1z)*(b0z - b1z)))/(-4*((a0x - a1x)*(b0x - b1x) + (a0y - a1y)*(b0y - b1y) + \ + (a0z - a1z)*(b0z - b1z))^2 + 4*((a0x - a1x)^2 + (a0y - a1y)^2 + (a0z - \ + a1z)^2)*((b0x - b1x)^2 + (b0y - b1y)^2 + (b0z - b1z)^2)))/(2*((a0x - a1x)^2 \ + + (a0y - a1y)^2 + (a0z - a1z)^2)) + + sb -> -((-4*(a0x^2 + a0y^2 + a1x*b0x - \ + a0x*(a1x + b0x) + a1y*b0y - a0y*(a1y + b0y) + (a0z - a1z)*(a0z - b0z))*((a0x \ + - a1x)*(b0x - b1x) + (a0y - a1y)*(b0y - b1y) + (a0z - a1z)*(b0z - b1z)) + \ + 4*((a0x - a1x)^2 + (a0y - a1y)^2 + (a0z - a1z)^2)*((a0x - b0x)*(b0x - b1x) + \ + (a0y - b0y)*(b0y - b1y) + (a0z - b0z)*(b0z - b1z)))/(-4*((a0x - a1x)*(b0x - \ + b1x) + (a0y - a1y)*(b0y - b1y) + (a0z - a1z)*(b0z - b1z))^2 + 4*((a0x - \ + a1x)^2 + (a0y - a1y)^2 + (a0z - a1z)^2)*((b0x - b1x)^2 + (b0y - b1y)^2 + \ + (b0z - b1z)^2))) + +*/ + static void int_solve(nec_3vector& a0, nec_3vector& a1, + nec_3vector& b0, nec_3vector& b1, + nec_float& distance, nec_float& sa, nec_float& sb) + { + nec_float a0x = a0.x(); nec_float a0y = a0.y(); nec_float a0z = a0.z(); + nec_float b0x = b0.x(); nec_float b0y = b0.y(); nec_float b0z = b0.z(); + nec_float a1x = a1.x(); nec_float a1y = a1.y(); nec_float a1z = a1.z(); + nec_float b1x = b1.x(); nec_float b1y = b1.y(); nec_float b1z = b1.z(); + + nec_float a01x = (a0x - a1x); + nec_float a01y = (a0y - a1y); + nec_float a01z = (a0z - a1z); + + nec_float b01x = (b0x - b1x); + nec_float b01y = (b0y - b1y); + nec_float b01z = (b0z - b1z); + + nec_float moda = (a01x*a01x + a01y*a01y + a01z*a01z); + nec_float modb = (b01x*b01x + b01y*b01y + b01z*b01z); + + nec_float tmp2 = (a01x*b01x + a01y*b01y + a01z*b01z); + + nec_float den = (-4.0*tmp2*tmp2 + 4.0*moda*modb); + + distance = 9.0e9; sa = 2.0; sb = 2.0; + if (0 == den) return; + + nec_float tmp3 = (-4.0*(a0x*a0x + a0y*a0y + a1x*b0x - a0x*(a1x + b0x) + a1y*b0y - a0y*(a1y + b0y) + a01z*(a0z - b0z))*tmp2 + 4.0*moda*((a0x - b0x)*b01x + (a0y - b0y)*b01y + (a0z - b0z)*b01z)); + + sa = (a0x*a01x + a0y*a01y + a0z*a01z - a01x*b0x - a01y*b0y - a01z*b0z - tmp3*tmp2/den)/moda; + + sb = -(tmp3/den); + + nec_float d2 = pow((a0x - b0x + sa*(a1x - a0x) - sb*(b1x - b0x)),2) + + pow((a0z - b0z + sa*(a1z - a0z) - sb*(b1z - b0z)),2) + + pow((a0y - b0y + sa*(a1y - a0y) - sb*(b1y - b0y)),2); + + distance = std::sqrt(d2); + } + +private: + nec_3vector x0, x1; + nec_float radius; +}; + +#endif /*__nec_wire__*/ + diff -Nru necpp-1.3.0+cvs20090101/test_data/CVS/Entries necpp-1.4.0+cvs20091005/test_data/CVS/Entries --- necpp-1.3.0+cvs20090101/test_data/CVS/Entries 2009-01-01 21:53:43.000000000 +0100 +++ necpp-1.4.0+cvs20091005/test_data/CVS/Entries 2009-10-06 00:08:24.000000000 +0200 @@ -8,17 +8,19 @@ /dipole_anim.nec/1.1.1.1/Fri Sep 9 04:39:16 2005// /discone.nec/1.1.1.1/Fri Sep 9 04:39:16 2005// /ek_test.nec/1.1.1.1/Fri Sep 9 04:39:16 2005// -/example1.nec/1.2/Mon Dec 8 01:20:09 2008// +/example1.nec/1.3/Tue Jan 6 04:09:44 2009// /example2.nec/1.1.1.1/Fri Sep 9 04:39:16 2005// /example3.nec/1.2/Sat Jan 26 00:29:08 2008// /example4.nec/1.1.1.1/Fri Sep 9 04:39:16 2005// /example5.nec/1.1.1.1/Fri Sep 9 04:39:16 2005// /example6.nec/1.1.1.1/Fri Sep 9 04:39:16 2005// +/excessive_gain.nec/1.1/Thu Aug 6 04:57:40 2009// /ga_pjw_0.nec/1.1.1.1/Fri Sep 9 04:39:16 2005// /ga_pjw_1.nec/1.1.1.1/Fri Sep 9 04:39:16 2005// /gn2.nec/1.1.1.1/Fri Sep 9 04:39:16 2005// /hang.nec/1.1/Sat Jul 26 12:17:03 2008// /helix.nec/1.1.1.1/Fri Sep 9 04:39:16 2005// +/intersection.nec/1.1/Tue Jan 6 04:09:44 2009// /medium_test.nec/1.1/Fri Mar 10 00:41:19 2006// /neoklis_bug.nec/1.1/Sun Oct 29 21:28:00 2006// /passive_test1.nec/1.1.1.1/Fri Sep 9 04:39:16 2005// diff -Nru necpp-1.3.0+cvs20090101/test_data/example1.nec necpp-1.4.0+cvs20091005/test_data/example1.nec --- necpp-1.3.0+cvs20090101/test_data/example1.nec 2008-12-08 02:20:09.000000000 +0100 +++ necpp-1.4.0+cvs20091005/test_data/example1.nec 2009-01-06 05:09:44.000000000 +0100 @@ -1,5 +1,5 @@ CE EXAMPLE 1. CENTER FED LINEAR ANTENNA -GW 0,7,0.,0.,-.25,0.,0.,.25,.001 +GW 0 7 0. 0. -.25 0. 0. .25 .001 GE EX 0 0 4 0 1. XQ diff -Nru necpp-1.3.0+cvs20090101/test_data/excessive_gain.nec necpp-1.4.0+cvs20091005/test_data/excessive_gain.nec --- necpp-1.3.0+cvs20090101/test_data/excessive_gain.nec 1970-01-01 01:00:00.000000000 +0100 +++ necpp-1.4.0+cvs20091005/test_data/excessive_gain.nec 2009-08-06 06:57:40.000000000 +0200 @@ -0,0 +1,9 @@ +CM nec2++ -i necError.nec -g +CE +GW 1 11 0 0 0.0906315 0 0.131159 0.0906315 0.1 +GE 0 +GN 1 0 0 0 0 0 +FR 0 1 0 0 1600 0 +EX 0 1 1 0 1 0 0 0 0 0 +RP 0 33 36 1011 -80 0 5.0 5.0 1.0 1.0 +EN diff -Nru necpp-1.3.0+cvs20090101/test_data/intersection.nec necpp-1.4.0+cvs20091005/test_data/intersection.nec --- necpp-1.3.0+cvs20090101/test_data/intersection.nec 1970-01-01 01:00:00.000000000 +0100 +++ necpp-1.4.0+cvs20091005/test_data/intersection.nec 2009-01-06 05:09:44.000000000 +0100 @@ -0,0 +1,12 @@ +CM Test intersection +CM SHOULD FAIL with nec_exception about intersecting wires +CE +GW 0 7 0.0 0.0 0.0 1.0 1.0 0.0 .005 +GW 1 7 0.3 0.0 0.0 0.3 1.0 0.0 .005 +GE +EX 0 0 4 0 1. +XQ +LD 0 0 4 4 10. 3.000E-09 5.300E-11 +PQ +NE 0 1 1 15 .001 0 0 0. 0. .01786 +EN \ No newline at end of file