Giter Club home page Giter Club logo

tmolteno / necpp Goto Github PK

View Code? Open in Web Editor NEW
234.0 234.0 64.0 2.83 MB

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.

Home Page: http://elec.otago.ac.nz/w/index.php/Necpp

License: GNU General Public License v2.0

Python 0.97% C++ 60.83% C 16.93% Makefile 0.68% Shell 0.07% Ruby 2.82% GAP 1.31% Fortran 15.31% M4 0.93% Roff 0.08% SWIG 0.06%

necpp's People

Contributors

aknrdureegaesr avatar ccoors avatar chron0 avatar eimiar avatar guitorri avatar jamesdavid avatar jeffsf avatar maxscheel avatar nicolasbarbot avatar nudomarinero avatar partmedia avatar schlatterbeck avatar tmolteno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

necpp's Issues

build problem

Hi,
I try to execute the exemple test_nec.c located in the exemple directory. With the binary version installed with the debian package manager (libneccpp-dev 1.5.0), the build succeeded however the execution failed with:
gcc -o test_nec test_nec.c -lm -lstdc++ -lnecpp
./test_nec
Gain: 8.407404, -1.958237 +/- 16.108164 dB
RHCP Gain: 5.397104, -4.960991 +/- 16.072012 dB
LHCP Gain: 5.397104, -4.960991 +/- 16.072012 dB
terminate called after throwing an instance of 'nec_exception*'
Aborted
By building the library form sources (with lapack correctly detected by the configure script in /usr/lib/atlas-base/atlas), i still cannot link the exemple program:
gcc -o test_nec test_nec.c -lm -lstdc++ -L../src/.libs -lnecpp
../src/.libs/libnecpp.so: undefined reference to clapack_zgetrs' ../src/.libs/libnecpp.so: undefined reference toclapack_zgetrf'
collect2: error: ld returned 1 exit status
The symbols clapack_zgetrs and clapack_zgetrf are undefined in the libnecpp but are correctly defined in liblaback.
My last question is about the difference of gain values obtained with (for the same antenna) nec2 (or necpp) and the value returned by nec_gain_max() (i observe 2.15 dB for nec2 and 8.36dB for nec_gain_max() for the half wavelength antenna, the others values are equal).

Thank you for your time.

Nicolas Barbot

Difference in gain values.

Reported as part of a build-related issue. My last question is about the difference of gain values obtained with (for the same antenna) nec2 (or necpp) and the value returned by nec_gain_max() (i observe 2.15 dB for nec2 and 8.36dB for nec_gain_max() for the half wavelength antenna, the others values are equal).

Memory allocation problem

Hi,

I have memory allocation problem again. I got "segmentation fault" error message from the Ver.1.7.1 and "Runtime Error: Out of Memory" message from the Ver.1.6.1 when I tried a large 140GB simulation model which I could simulate using my modified Ver.1.5.1 reported in the Issue#13.

It seems the Ver.1.6.1 and Ver.1.7.1 still have the same problem as I reported in the Issue#13.

Regards.

Yoshi Takeyasu

FIRST SEGMENT MIDPOINT OF WIRE ... INTERSECTS WIRE ...

I have been using xnec2c to play with antenna simulations, but it is very tedious to use it for optimizations, hence my attempts with necpp.

I wasn' able to build a working model though. See this gist

https://gist.github.com/kzyapkov/02ccfb62b7d9f3d73d29271c86afd48a

The nec file works fine with xnec2c, but an identical design build with necpp results in

RuntimeError: GEOMETRY DATA ERROR -- FIRST SEGMENT MIDPOINT OF WIRE #4 (TAG ID #10) INTERSECTS WIRE #1 (TAG ID #1)

I am using the python wrapper, but trying to run nec2++ with this .nec file (or many of the examples in the xnec2c code) results in the same geometry error.

Unreachable code found.

Very small enhancement:

In matrix_algebra.cpp, void solves, line 791:

Snip*

for (int64_t k = 0; k < nop; k++ ) {
      if ( k != 0 )  {
        int64_t ia = np-1;
        for (int64_t i = 0; i < np; i++ ) {
          ia++;
          j++;
          b[ia+column_offset]= scm[j];
        }

        if ( k == nop)
          continue;
      } /* if ( k != 0 ) */

This part:

if ( k == nop)
          continue;

k can never reach the value nop since the loop defines k < nop

Imre Biacsics

Build failure on Raspbian

Hello,

I'm trying to build from the source,
on the step "3. Then do the usual thing ./configure --without-lapack make -j 4 sudo make install "
I have an error

configure: WARNING: you should use --build, --host, --target
configure: error: unrecognized option: `-j'
Try `./configure --help' for more information

How to get the magnitude and phase of the radiation patterns with the python interface

I'd like to access the get_etheta/phi_magnitude and get_etheta/phi_phase complex radiation patterns. Is there a way to do this with the python interface? So far I've tried both nec_etheta_magnitude and get_etheta_magntiude, but neither are recognized.

For instance:
etheta = []
ephi = []
for it in range(len(thetas)):
t = []
p = []
for ip in range(len(phis)):
t.append(get_etheta_magnitude(nec, 0, it, ip) + 1j* get_etheta_phase(nec, 0, it, ip))
p.append(get_ephi_magnitude(nec, 0, it, ip) + 1j*get_ephi_phase(nec, 0, it, ip))
etheta.append(np.array(t))

etheta = []
ephi = []
for it in range(len(thetas)):
t = []
p = []
for ip in range(len(phis)):
t.append(nec_etheta_magnitude(nec, 0, it, ip) + 1j* nec_etheta_phase(nec, 0, it, ip))
p.append(nec_ephi_magnitude(nec, 0, it, ip) + 1j*nec_ephi_phase(nec, 0, it, ip))
etheta.append(np.array(t))

Ruby compile error nec_exception.h: File or Directory not found

Operating system: Ubuntu 14.04 LTS (64 bit)

After successfully compiling and installing necpp, I tried to compile the Ruby module. However, compilation fails due to missing file "nec_exception.h":

$ cd Ruby/ext/necpp
$ ./build.sh

Language subdirectory: ruby
Search paths:
   ./
   ../../../src/
   ./swig_lib/ruby/
   /usr/share/swig2.0/ruby/
   ./swig_lib/
   /usr/share/swig2.0/
Preprocessing...
Starting language-specific parse...
Processing types...
C++ analysis...
Generating wrappers...
checking for clapack.h... yes
checking for clapack_zgetrf() in -llapack... yes
checking for libnecpp.h... yes
checking for nec_create() in -lnecpp... yes
creating Makefile
g++ -I. -I/usr/include/ruby-1.9.1/x86_64-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -DHAVE_CLAPACK_H -DHAVE_LIBNECPP_H -I/usr/local/include -I/usr/include/atlas -D_FORTIFY_SOURCE=2   -I/home/tim/github/necpp/src -fPIC -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -fno-strict-aliasing -fPIC -I/home/tim/github/necpp/src  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -fno-strict-aliasing -o necpp_wrap.o -c necpp_wrap.cxx
necpp_wrap.cxx:1835:27: fatal error: nec_exception.h: File or Directory not found
 #include "nec_exception.h"
                           ^
compilation terminated.
make: *** [necpp_wrap.o] Error 1
sudo make install

Am I missing something?

Typo in nec_context.cpp

Hi,

nec_context.cpp

2959 cw[jx*ipr*nw] += etk* m_geometry->ax[ij]+ ets* m_geometry->bx[ij]+ etc* m_geometry->cx[ij];

The "jx*" might be "jx+".

2959 cw[jx+ipr*nw] += etk* m_geometry->ax[ij]+ ets* m_geometry->bx[ij]+ etc* m_geometry->cx[ij];

Regards.

Yoshi Takeyasu

Undefined references in examples

This is in Ubuntu Xenial 16.04

$ make test_c
gcc -o test_c -Wl,-rpath -Wl, test_nec.o -lnecpp
//usr/local/lib/libnecpp.so: undefined reference to `clapack_zgetrs'
//usr/local/lib/libnecpp.so: undefined reference to `clapack_zgetrf'
collect2: error: ld returned 1 exit status
Makefile:34: recipe for target 'test_c' failed
make: *** [test_c] Error 1
$ make test_cpp
g++ -I ../src/ -I .. -O2 -Wall   -c -o test_cpp.o test_cpp.cpp
g++ -I ../src/ -I .. -O2 -Wall   -c -o ../src/c_ggrid.o ../src/c_ggrid.cpp
g++ -I ../src/ -I .. -O2 -Wall   -c -o ../src/matrix_algebra.o ../src/matrix_algebra.cpp
g++ -I ../src/ -I .. -O2 -Wall   -c -o ../src/nec_ground.o ../src/nec_ground.cpp
g++ -I ../src/ -I .. -O2 -Wall   -c -o ../src/c_evlcom.o ../src/c_evlcom.cpp
g++ -I ../src/ -I .. -O2 -Wall   -c -o ../src/c_plot_card.o ../src/c_plot_card.cpp
g++ -I ../src/ -I .. -O2 -Wall   -c -o ../src/misc.o ../src/misc.cpp
g++ -I ../src/ -I .. -O2 -Wall   -c -o ../src/nec_context.o ../src/nec_context.cpp
g++ -I ../src/ -I .. -O2 -Wall   -c -o ../src/nec_output.o ../src/nec_output.cpp
g++ -I ../src/ -I .. -O2 -Wall   -c -o ../src/c_geometry.o ../src/c_geometry.cpp
g++ -I ../src/ -I .. -O2 -Wall   -c -o ../src/nec_exception.o ../src/nec_exception.cpp
g++ -I ../src/ -I .. -O2 -Wall   -c -o ../src/nec_radiation_pattern.o ../src/nec_radiation_pattern.cpp
g++ -I ../src/ -I .. -O2 -Wall   -c -o ../src/nec_structure_currents.o ../src/nec_structure_currents.cpp
g++ -I ../src/ -I .. -O2 -Wall   -c -o ../src/electromag.o ../src/electromag.cpp
g++ -I ../src/ -I .. -O2 -Wall   -c -o ../src/nec_results.o ../src/nec_results.cpp
gcc -o test_cpp test_cpp.o ../src/c_ggrid.o ../src/matrix_algebra.o ../src/nec_ground.o ../src/c_evlcom.o ../src/c_plot_card.o ../src/misc.o ../src/nec_context.o ../src/nec_output.o ../src/c_geometry.o ../src/nec_exception.o ../src/nec_radiation_pattern.o ../src/nec_structure_currents.o ../src/electromag.o ../src/nec_results.o -lstdc++ -lm -llapack
./test_cpp
Nec2++ C++ example. Running (takes a few minutes...)
./test_cpp: symbol lookup error: ./test_cpp: undefined symbol: clapack_zgetrf
Makefile:62: recipe for target 'test_cpp' failed
make: *** [test_cpp] Error 127

exception with eigen library

Hi,
I see that the eigen library can replace the safe_array class.
By rebuilding libnecpp.so using "configure --with-eigen", the build succeeded however the execution of the example programm failed with:
test_nec: /usr/include/eigen3/Eigen/src/Core/DenseCoeffsBase.h:393: Eigen::DenseCoeffsBase<Derived, 1>::Scalar& Eigen::DenseCoeffsBase<Derived, 1>::operator[](Eigen::DenseCoeffsBase<Derived, 1>::Index) [with Derived = Eigen::Matrix<double, -1, 1>; Eigen::DenseCoeffsBase<Derived, 1>::Scalar = double; Eigen::DenseCoeffsBase<Derived, 1>::Index = long int]: Assertion `index >= 0 && index < size()' failed.
Aborted
which is due to a negative index in c_geometry.cpp:1840
for (int i = 0; i < ic; i++ ) {
ix= jco[i];
if ( ix <= 0) {
ix=- ix;
int ixx = ix-1;
x[ixx]= xa;
y[ixx]= ya;
z[ixx]= za;
continue;
}
where, in the first iteration ix = 0 and ixx = -1 (which is used as an index).

I would like to know if the eigen library is supported (and this issue is valid) or if this library should not be used with necpp (and you can forget my post). (This problem does not appear if i use the safe_array class).

Thank you in advance

Nicolas

Benchmark OpenBLAS, Intel MKL vs ATLAS

Hi,

This is not a problem report, but I'd like to share my benchmark of LAPACK / BLAS library. Because of my huge simulation model, I have been replacing my CPU and math-library. My conclusion is that Intel MKL is the best, OpenBLAS is worth to try.

No. of surface-patch Memory 3.16 GHz Core2 Duo 3.0 GHz Core2 Quad
(GB) ATLAS (sec) OpenBLAS (sec)
6,319 2.5 360 135
9,968 6.0 1,380 510
13,992 11.8 3,600 1,360

The simulation model (smooth-walled 3-section conical horn antenna) consists of surface-patch by SP&SC. Total run-time is measured by gettimeofday() instead of sysconf(). Note that OpenBLAS performs more than the ratio of CPU's core (Duo vs Quad). As shown in the Flat profile below, 90 % of the calculation is zgemm_kernel_n to be parallel by multi-core.

Flat profile:

Each sample counts as 0.01 seconds.
 %    cumulative    self    self    total
 time    seconds    seconds    calls    s/call    s/call    name
 89.99   289.89     289.89    zgemm_kernel_n
 3.25    300.37     10.48    sched_yield
 1.62    305.60     5.23    ztrsm_kernel_LT
 1.45    310.26     4.66    inner_advanced_thread
 0.73    312.61     2.35    39929761    0.00    0.00    nec_context::hintg(double, double, double)

matrix_algebra.cpp is modified for OpenBLAS:

extern "C"
 {
 #include </usr/lib/openblas-base/include/lapacke.h>
 #include </usr/lib/openblas-base/include/cblas.h>
 }
int info = LAPACKE_zgetrf((int) CblasColMajor, (lapack_int) n, (lapack_int) n, (lapack_complex_double*) a_in.data(), (lapack_int) ndim, (lapack_int*) ip.data());
int info = LAPACKE_zgetrs ((int) CblasColMajor, (char) CblasNoTrans, (lapack_int) n, (lapack_int) 1,  (const lapack_complex_double*) a.data(), (lapack_int) ndim, (const lapack_int*) ip.data(),  (lapack_complex_double*) b.data(), (lapack_int) n);

With regard to Transposed matrix, zgetrs.c of OpenBLAS is modified also:

if (trans_arg = = ‘O’) trans = 0;
if (trans_arg = = ‘P’) trans = 1;
if (trans_arg = = ‘Q’) trans = 2;
if (trans_arg = = ‘R’) trans = 3;

This is a dirty solution. It would be appreciated if someone suggest a better solution.
OpenBLAS is superb, but I experienced Memory Seg-Fault in case of over-60GB memory usage and 8 core CPU. Though I've confirmed that this Seg-Fault is NOT caused by NEC2++, but fixing the problem of OpenBLAS was beyond my capability. Then, I migrated to Intel MKL.

No. of surface-patch Memory 3.0 GHz Core2 Quad 2.93 GHz Dual X5570 (8 cores) 2.93 GHz Dual X5570 (8 cores)
(GB) OpenBLAS (sec) OpenBLAS (sec) Intel MKL (sec)
6,319 2.5 135 68 67
9,968 6.0 510 253 247
13,992 11.8 1,360 669 663
19,096 21.9 - 1,671 1,663
24,957 37.3 - 3,760 3,659
31,641 59.9 - 7,633 7,417
39,117 91.5 - Seg-Fault 14,004

matrix_algebra.cpp is modified for Intel MKL:

#include </opt/intel/composer_xe_201.1.117/mkl/include/mkl_lapacke.h>
#include </opt/intel/composer_xe_201.1.117/mkl/include/mkl_cblas.h>
int info = LAPACKE_zgetrf (CblasColMajor, n, n, (MKL_Complex16*) a_in.data(), ndim, (int*) ip.data());
int info = LAPACKE_zgetrs (CblasColMajor, ‘N’, n, 1, (const MKL_Complex16*) a.data(), ndim, (const int*) ip.data(), (MKL_Complex16*) b.data(), n);

Link options are:

-wl, --start-group $(MKLROOT)/lib/intel64/libmkl_intel_lp64.a $(MKLROOT)/lib/intel64/libmkl_core.a $(MKLROOT)/lib/intel64/libmkl_intel_thread.a -wl, --end-group lpthread -lm -openmp -$(MKLROOT)/include

Intel Math Kernel Library Link Line Advisor suggests these options. I used a little bit older version of the resources.
NEC2++ : ver.1.5.1
OpenBLAS : ver.2.5
Intel MKL : ver.11.1
gcc : ver.4.7.2
icc : ver.13.0.1

I hope this may help your serious number-crunching.

Best regards.

Yoshi Takeyasu

Build fails on archlinux and g++ 5.1

Build fails in catch.hpp. Seems to be some issue with nullptr_t being added in c++11. Adding -std=c++11 to src/Makefile seems to solve the issue.

Errors from g++ inlned:

In file included from safe_array_tb.cpp:20:0:
catch.hpp:812:5: error: identifier ‘nullptr’ is a keyword in C++11 [-Werror=c++0x-compat]
     inline std::nullptr_t opCast(std::nullptr_t) { return nullptr; }
     ^
In file included from safe_array_tb.cpp:20:0:
catch.hpp:812:17: error: ‘nullptr_t’ in namespace ‘std’ does not name a type
     inline std::nullptr_t opCast(std::nullptr_t) { return nullptr; }
                 ^
catch.hpp:933:58: error: ‘template<Catch::Internal::Operator Op, class T> bool Catch::Internal::compare’ conflicts with a previous declaration
     template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
                                                          ^
catch.hpp:927:44: note: previous declaration ‘namespace Catch::Internal { }::compare’
     template<Operator Op, typename T> bool compare( T* lhs, int rhs ) {
                                            ^
catch.hpp:933:53: error: ‘nullptr_t’ is not a member of ‘std’
     template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
                                                     ^
catch.hpp:933:70: error: expected primary-expression before ‘*’ token
     template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
                                                                      ^
catch.hpp:933:72: error: ‘rhs’ was not declared in this scope
     template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
                                                                        ^
catch.hpp:933:76: error: expression list treated as compound expression in initializer [-fpermissive]
     template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
                                                                            ^
catch.hpp:933:44: error: variable templates only available with -std=c++14 or -std=gnu++14 [-Werror]
     template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
                                            ^
catch.hpp:933:78: error: expected ‘;’ before ‘{’ token
     template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
                                                                              ^
catch.hpp:936:66: error: ‘std::nullptr_t’ has not been declared
     template<Operator Op, typename T> bool compare( T* lhs, std::nullptr_t ) {
                                                                  ^
catch.hpp:936:44: error: redefinition of ‘template<Catch::Internal::Operator Op, class T> bool Catch::Internal::compare(T*, int)’
     template<Operator Op, typename T> bool compare( T* lhs, std::nullptr_t ) {
                                            ^
catch.hpp:927:44: note: ‘template<Catch::Internal::Operator Op, class T> bool Catch::Internal::compare(T*, int)’ previously declared here
     template<Operator Op, typename T> bool compare( T* lhs, int rhs ) {
                                            ^
In file included from safe_array_tb.cpp:20:0:
catch.hpp:1183:38: error: ‘std::string Catch::toString’ redeclared as different kind of symbol
 std::string toString( std::nullptr_t );
                                      ^
catch.hpp:1180:13: note: previous declaration ‘std::string Catch::toString(unsigned char)’
 std::string toString( unsigned char value );
             ^
catch.hpp:1183:23: error: ‘nullptr_t’ is not a member of ‘std’
 std::string toString( std::nullptr_t );
                       ^
In file included from safe_array_tb.cpp:20:0:
catch.hpp:6977:38: error: ‘std::string Catch::toString’ redeclared as different kind of symbol
 std::string toString( std::nullptr_t ) {
                                      ^
catch.hpp:6972:13: note: previous declaration ‘std::string Catch::toString(unsigned char)’
 std::string toString( unsigned char value ) {
             ^
catch.hpp:6977:23: error: ‘nullptr_t’ is not a member of ‘std’
 std::string toString( std::nullptr_t ) {
                       ^
cc1plus: all warnings being treated as errors
Makefile:950: recipe for target 'test_manager-safe_array_tb.o

GUI Implementation

Greetings,
I am a telecommunications engineer college student from University of Carabobo (Venezuela) and i'm looking for a thesis subject, in that sense , I would like to implement a graphical user interface for Python-NECpp code, I've been reading the necpp guide and found out that there are some "to-do list" for adding new features. It would be posible to bind my thesis with Python-necpp development?

clapack.h not found

In Ubuntu 16.04 LTS, with properly intalled g++, make, automake, autoconf, libtool and libatlas-base-dev compilation will fail at:

matrix_algebra.cpp:412:21: fatal error: clapack.h: File or directory not found

Build fails with `call of overloaded ‘abs(double)’ is ambiguous`

After fixing -Werror-triggered errors, the build files due to a more substantial error:

In file included from c_evlcom_tb.cpp:1:0: c_evlcom_tb.cpp: In function ‘void test_bessel(nec_float, nec_float, nec_float, nec_float)’: c_evlcom_tb.cpp:14:35: error: call of overloaded ‘abs(double)’ is ambiguous REQUIRE((abs(j0.real() - j0r) < eps));

I cannot fix that, since I do next to nothing about C/ C++.

Hardcoded atlas path in configure.ac doesn't support different linux OSes and non-standard atlas installation locations

Edit: For necpp v1.6.1

On both Fedora 29 and CentOS 7, the configure script is unable to find atlas. It seems that the installation process assumes that atlas will be installed in a specific location, but that location is the same across different versions of linux.

On both, I have the standard atlas and atlas-devel packages installed. These packages install the atlas library into /usr/lib64/atlas, in contrast to the /usr/lib/atlas-base/atlas on Ubuntu and Debian.

I think the problem that I encountered is due to hardcoded paths in on lines 56 and 59 in the configure.ac file. The surrounding code uses AC_CHECK_LIB, but reading the autotools documentation, it seems that one should be using AC_SEARCH_LIBS instead to maximize portability.

In any case, I was able to get the configure script to work after changing the hardcoded: /usr/lib/atlas-base/atlas and /usr/lib/atlas-base/atlas -llapack to /usr/lib64/atlas and /usr/lib64/atlas -lsatlas on lines 73 and 76 of configure.ac. The latter change, /usr/lib64/atlas -lsatlas, which replaces the -llapack flag, is needed because atlas changed library names (see here). The lapack on line 75 also needs to be substituted for satlas and finally, one also needs to replace the -llapack on line 128 with -lsatlas.

Perhaps a simple solution is to provide both a configure.ac.debian and configure.ac.redhat and then as part of the installation instructions tell the use which to use?

At the very least, hopefully reporting this issue helps others install necpp on redhat-based linux distros. Cheers!

Get rid of two loops.

Hello Tim, excellent work !

I found a possible way of getting rid of 2 loops in 'void solves'.
At line 705 and 755, this piece of exact equal code:

for (int64_t k = 0; k < nop; k++ ) {
        int64_t ia= i+ k* npeq;
        scm[k]= b[ia+column_offset];
      }

      nec_complex sum_normal(scm[0]);
      for (int64_t k = 1; k < nop; k++ )
        sum_normal += scm[k];

	/* test added */
	nec_complex tester = solves_sum_cpl(b, scm, nop, npeq, i, column_offset);	
	ASSERT(tester == sum_normal);

        // ...... more code
}

I ASSERT tested the following function, but could not find a case where it is triggered.
So, I commented out 'if ( nop == 1) return;' a few lines above.

/* I: Test to see if we can snip out a loop             scm = referenced    */
nec_complex solves_sum_cpl(complex_array b, complex_array& scm, int64_t nop, int64_t npeq, int64_t i, int64_t column_offset)
{
	nec_complex sum_normal;
	for (int64_t k = 0; k < nop; k++)
	{
		scm[k] = b[(i + k * npeq) + column_offset];
		sum_normal += scm[k];
	}
	return sum_normal;
}

It integrates summing into its parent loop.

Imre Biacsics

osx build with accelerate framework any success?

i'm trying to link this against apple's accelerate framework but this program complains about not finding lapack libs when i know they in the library.

i've made progress but had to heavily modify the configure, this is osx not linux and it wouldn't recognize proper paths.

but there are a lot of these warnings
/src/nec_context.cpp:3886:8: warning: use of unary operator that may be intended as compound assignment (-=)
rfl=- rfl;
^~
i fixed these as well.

i have binaries and libs now but i pretty much had to edit the makefile by hand.

when i correct this warning, abs is for integers not floats
c_evlcom_tb.cpp:14:15: note: use function 'std::abs' instead
REQUIRE((abs(j0.real() - j0r) < eps));
^~~

for-loop iteration in nec_context.cpp

Hi,

nec_context.cpp

2466    for( kk = 1; kk < nop; kk++ )
2467            {
2468                    deter += scm[kk] * symmetry_array[k+kk*nop];
2469            }
2470            in_cm[row_offset + ka] = deter;

Comparing this for-loop with NEC2C's matrix.c :

for( kk = 1; kk < nop; kk++ )
{
deter += scm[kk]* ssx[k+kk*nop];
cm[ka+i*nrow]= deter;
}

The for-loop might be:

2466    for( kk = 1; kk < nop; kk++ )
2467            {
2468                    deter += scm[kk] * symmetry_array[k+kk*nop];
2469                    in_cm[row_offset + ka] = deter;
2470            }

Kind regards.

Yoshi Takeyasu

Errors in building process for pyNEC VC/VC++ compliers in windows

Hi @tmolteno ,
I have been compiling necpp for PyNEC package (python 3.4/3.6) in windows 7/10 using VC++ 10/14.

  1. The compiler is showing following error in misc.cpp. (This is stopping the build)
    Error: misc.cpp error C2039: 'toupper' : is not a member of 'std'

similar issue is discussed here.
https://stackoverflow.com/questions/19876746/stdtolower-and-visual-studio-2013

There might be a win compatibility issue. or requires some modification of VC++ installation.
I worked around it by including cctype in misc.cpp. This way the complier is build through the whole process.

  1. warning while passing compiler arg from setup.py -fPIC. This is related to VC++ compiler arg warning so I have included it here.
    cl : Command line warning D9002 : ignoring unknown option '-fPIC'
    I found this https://stackoverflow.com/questions/42757497/python-installation-compilation-errors. But it's not working. Is this option important?

  2. warning while linking
    LINK : warning LNK4044: unrecognized option '/lstdc++'; ignored

Please provide appropriate solution. Also, update the PyNEC submodule afterwards, so that the building process remains stable.
One suggestion why not use a "devel" branch for development and leave the master branch for release stable (tags) versions. This way module using necpp as submodule will become more stable.

Thanks

output NEC2 cards

I am using the API to create input, i.e., nec_create(), nec_wire(), nec_fr_card(), etc., is there a way to output the context/configuration to file as a traditional nec2 card deck?
I am using the Python interface.

Thanks!

NEC constantly crashing on connect_segments

I am using PyNEC python wrapper and my python code usually crashes on "Segmentation fault (core dumped)" gdb shows following:

kaklik@UST-vyvoj:~/git/NEC-models/antennas/src$ gdb /usr/bin/python2.7 core
GNU gdb (Ubuntu 7.11-0ubuntu1) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/python2.7...(no debugging symbols found)...done.

warning: core file may not match specified executable file.
[New LWP 7490]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `python helix_test.py'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 c_geometry::connect_segments (this=0x1f3b560, ignd=)

at ../necpp_src/src/c_geometry.cpp:1750

1750 xa= xa+ x2[ixx];
(gdb)

git repo seems inconsistent

While trying to create a patch for #30 I found that a freshly cloned repo is not self-consistent:

$ git clone https://github.com/tmolteno/necpp
Cloning into 'necpp'...
remote: Counting objects: 2801, done.
remote: Total 2801 (delta 0), reused 0 (delta 0), pack-reused 2801
Receiving objects: 100% (2801/2801), 2.51 MiB | 2.10 MiB/s, done.
Resolving deltas: 100% (2110/2110), done.
Checking connectivity... done.
$ cd necpp/
$ git diff --name-status
M       Python/.gitignore
M       Python/README.md

Forcing a hard reset does not resolve

$ git reset --hard HEAD
HEAD is now at ebfb4d4 Changed API of c_geometry::helix() to put the tag id and segment count at the start.
$ git diff --name-status
M       python/.gitignore
M       python/README.md

I can't install python-necpp

Greetings, I would like to use Python-necpp in order to simulate antennas in Python. I downloaded necpp-master folder and followed the instructions for Windows listed here when I run pip install necpp in command prompt I get an error message and I can't understand which is exactly the issue. I use Windows 10 and Python 2.7.

We error message goes as follow:

Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\MAGO_PC>pip install necpp
Collecting necpp
  Using cached necpp-1.7.0.3.tar.gz
Installing collected packages: necpp
  Running setup.py install for necpp ... error
    Complete output from command C:\Python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\mago_pc\\appdata\\local\\temp\\pip-build-apsxvx\\necpp\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\mago_pc\appdata\local\temp\pip-md12hm-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-2.7
    copying necpp.py -> build\lib.win32-2.7
    running build_ext
    building '_necpp' extension
    creating build\temp.win32-2.7
    creating build\temp.win32-2.7\Release
    creating build\temp.win32-2.7\Release\necpp_src
    creating build\temp.win32-2.7\Release\necpp_src\src
    C:\Users\MAGO_PC\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DBUILD_PYTHON=1 -Inecpp_src/src/ -Inecpp_src/ -IC:\Python27\include -IC:\Python27\PC /Tpnecpp_src/src\atlas_check.cpp /Fobuild\temp.win32-2.7\Release\necpp_src/src\atlas_check.obj
    atlas_check.cpp
    C:\Users\MAGO_PC\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DBUILD_PYTHON=1 -Inecpp_src/src/ -Inecpp_src/ -IC:\Python27\include -IC:\Python27\PC /Tpnecpp_src/src\c_evlcom.cpp /Fobuild\temp.win32-2.7\Release\necpp_src/src\c_evlcom.obj
    c_evlcom.cpp
    c:\users\mago_pc\appdata\local\temp\pip-build-apsxvx\necpp\necpp_src\src\typesafe_stdint.h(58) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
    error: command 'C:\\Users\\MAGO_PC\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "C:\Python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\mago_pc\\appdata\\local\\temp\\pip-build-apsxvx\\necpp\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\mago_pc\appdata\local\temp\pip-md12hm-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\mago_pc\appdata\local\temp\pip-build-apsxvx\necpp\

I need your help in order to resolve this.

Build fails on safe array 'for' clause (-Werror=misleading-indentation)

Configuration was done with Lapack disabled, Makefile was invoked using make -j 4, this is the first error encountered.

Build log:

In file included from safe_array_tb.cpp:20:0:
catch.hpp: In member function ‘bool Catch::TestSpec::Filter::matches(const Catch::TestCaseInfo&) const’:
catch.hpp:2813:17: error: this ‘for’ clause does not guard... [-Werror=misleading-indentation]
                 for( std::vector<Ptr<Pattern> >::const_iterator it = m_patterns.begin(), itEnd
= m_patterns.end(); it != itEnd; ++it )
                 ^~~
catch.hpp:2816:21: note: ...this statement, but the latter is misleadingly indented as if it is
guarded by the ‘for’
                     return true;
                     ^~~~~~

Compiler version:

g++ (SUSE Linux) 6.3.1 20170202 [gcc-6-branch revision 245119]

Helix geometry ignores ITAG value

Hello,

I have designed an antenna model with helical wires, but GH card input seems to ignore ITAG number of helix. Therefore I am unable to feed helix directly by excitation source.

Here is the NEC code, the output of nec2++ follows.

CM Helix and screen reflector for 143.05 MHz
CE End Comments
GH 1 50 1.29700E+00 6.48500E-01 1.62100E-01 1.62100E-01 1.62100E-01 1.62100E-01 2.00000E-02
GM 1 3 0.00000E+00 0.00000E+00 9.00000E+01 0.00000E+00 0.00000E+00 0.00000E+00 1.00000E+00
GW 10 2 0.00000E+00 0.00000E+00 6.48500E-01 -1.62100E-01 0.00000E+00 6.48500E-01 1.00000E-02
GW 11 2 0.00000E+00 0.00000E+00 6.48500E-01 1.62100E-01 0.00000E+00 6.48500E-01 1.00000E-02
GW 12 2 0.00000E+00 0.00000E+00 6.48500E-01 0.00000E+00 -1.62100E-01 6.48500E-01 1.00000E-02
GW 13 2 0.00000E+00 0.00000E+00 6.48500E-01 0.00000E+00 1.62100E-01 6.48500E-01 1.00000E-02
SP 0 1 -1.00000E+00 -1.00000E+00 -0.1 1.00000E+00 -1.00000E+00 -0.1 0.00000E+00
SC 0 0 1.00000E+00 1.00000E+00 -0.1 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00
GE 0 0 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00
EX 0 1 1 0 1.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00
EX 0 2 1 0 0.00000E+00 1.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00
EX 0 3 1 0 -1.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00
EX 0 4 1 0 0.00000E+00 -1.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00
FR 0 5 0 0 1.40000E+02 1.00000E+01 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00
RP 0 25 50 0 0.00000E+00 0.00000E+00 5.00000E+00 5.00000E+00 0.00000E+00 0.00000E+00
EN 0 0 0 0 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00

nec2++ -i QHA_Bolidozor_patch.nec QHA_Bolidozor_patch.out
NEC++ Runtime Error:
NO SEGMENT HAS AN ITAG OF 1

Strange output from examples when asked for (-g option)

Originally reported by Panagiotis Vouzis [email protected]

tim@cyberiad:~/github/necpp$ src/nec2++ -i test_data/example4.nec -g
Max Gain: 0.100000

tim@cyberiad:~/github/necpp$ src/nec2++ -i test_data/yagi16.nec -g
Max Gain: 188556927294897914431367423267404139715901804863826626514649923944608736065618747092792445375732910901227647326933607251968.00

Clearly the latter is wrong (and the original reporter also got strange results for the first example)

parsing nec cards:: comment character

i usually use other programs like 4nec2 and in the input files it treats the single quote character as the beginning of a comment in a line and ignores it so you can document the command.

i'm going to hack the parser and either use the single quote or maybe the # character like bash

{code}
SY hgh=20 ' Height
SY len=20 ' Wire length
SY ang=110 ' Angle between sloping wires
SY Z=len_cos(ang/2), X=len_sin(ang/2) ' Get delta-Z and -X distances
{\code}

Build failure on Raspbian

Hello,

I'm trying to build from the source,
on the step 3. Then do the usual thing ./configure --without-lapack make -j 4 sudo make install
I have an error

configure: WARNING: you should use --build, --host, --target
configure: error: unrecognized option: `-j'
Try `./configure --help' for more information

Crash if input line longer than 80 Characters

nec_main segfaults if the program meets an input line longer than 80 chars (my comments sometimes exceed the line length). Either declare line_buf[255] to give some headroom or make load_line resilient.

nsflag variable in c_geometry is unused

This generates a compiler warning, and also should be triggering a change in the output format. However it isn't being taken into account. Tagging as version 2.0 (as this piece of code -- for connecting segments -- going to be rewritten)

Build fails on macOS due to linker error

Hi,

for some reason the linker fails when building on/for macOS (10.13.6):

[eligs@aquila ~/projects/necpp:master] make
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in src
/bin/sh ../libtool  --tag=CXX   --mode=link g++  -g -O2 -all-static  -o nec2++ nec2cpp.o XGetopt.o libnecpp.la -lm 
libtool: warning: complete static linking is impossible in this configuration
libtool: link: g++ -g -O2 -o nec2++ nec2cpp.o XGetopt.o -Wl,-bind_at_load  ./.libs/libnecpp.a -lstdc++ -lm
ld: warning: ignoring file ./.libs/libnecpp.a, file was built for archive which is not the architecture being linked (x86_64): ./.libs/libnecpp.a

Due to the lib not being used, a lot of 'undefined Symbol' errors follow:

Undefined symbols for architecture x86_64:
  "usage()", referenced from:
      nec_main(int, char**, nec_output_file&) in nec2cpp.o
  "secnds(double*)", referenced from:
      nec_main(int, char**, nec_output_file&) in nec2cpp.o
  "load_line(char*, __sFILE*)", referenced from:
      nec_main(int, char**, nec_output_file&) in nec2cpp.o
      readmn(__sFILE*, __sFILE*, char*, int*, int*, int*, int*, double*, double*, double*, double*, double*, double*) in nec2cpp.o
(and so on)

When I probe libnecpp.a with objdump, it tells me things are build for mach-o-x86-64:

[eligs@aquila ~/projects/necpp:master] objdump -a src/.libs/libnecpp.a        
In archive src/.libs/libnecpp.a:

libnecpp_la-c_evlcom.o:     file format mach-o-x86-64
rw-r--r-- 0/0 294608 Jan  1 01:00 1970 libnecpp_la-c_evlcom.o
(and so on...)

So ... when the lib is built for 64 Bit x86, why does the linker refuse to use it?
Would it be possible/of some use to link dynamically instead of static?
Since I'm not that familiar with autotools and linking against libraries, I'm kind of lost here and would appreciate any help to get this project to build.
Thanks.

Python API library path

Update the python library requirements to include some information on choosing the correct lapack library path.

The python binding uses a dynamically linked library that might be in the wrong place.

GEOMETRY HAS ONE OR FEWER SEGMENTS.

NEC++ Runtime Error:
GEOMETRY HAS ONE OR FEWER SEGMENTS. Please send bug report. This causes an error that we're trying to fix.

I had the Rumtine Error in calculation of cubical object's RCS. The object consists of surface patch without wire segment. NEC2++ version is 1.7.4. Attached the NEC input file. I have confirmed the object with wire segments has no error.
Cube_9cm_RCS.txt

Wire grid modelling of cylinder

Hi,

I was trying to model a finite PEC cylinder parallel to the Y axis. The diameter of the cylinder is
chosen to be one wavelength, and the height is 1.5 wavelengths. The object is illuminated by a plane
wave propagating in the z direction and E-polarized in the x direction ( Reference attached). The input file I wrote is given below:

CM RCS of PEC Cylinder
CM F=100MHz, Radius=1.5m, Height=4.5m, seg. length=0.25m, seg. radius=0.02m
CM Tag.number 1's=For bottom and top face
CM Tag.number 2's=For side face
CM Tag.number 3=For top face extreme radial arc
CE
GW 1 1 0.24914612 -0.0206448 0 0.49829225 -0.0412897 0 0.02
GW 1 1 0.49829225 -0.0412897 0 0.74743837 -0.0619345 0 0.02
GW 1 1 0.74743837 -0.0619345 0 0.99658449 -0.0825793 0 0.02
GW 1 1 0.99658449 -0.0825793 0 1.24573062 -0.1032242 0 0.02
GW 1 1 1.24573062 -0.1032242 0 1.49487674 -0.123869 0 0.02
GW 1 1 1.24573062 -0.1032242 0 1.24573062 0.10322418 0 0.02
GW 1 1 0.99658449 -0.0825793 0 0.99658449 0.08257935 0 0.02
GW 1 1 0.74743837 -0.0619345 0 0.74743837 0.06193451 0 0.02
GW 1 1 0.49829225 -0.0412897 0 0.49829225 0.04128967 0 0.02
GW 1 1 0.24914612 -0.0206448 0 0.24914612 0.02064484 0 0.02
GM 0 1 0 0 0 0 0 4.5 1
GW 2 1 1.49487674 0.12386902 0 1.49487674 -0.123869 0 0.02
GW 2 1 1.49487674 0.12386902 0 1.49487674 0.12386902 0.25 0.02
GM 0 17 0 0 0 0 0 0.25 2
GW 3 1 1.49487674 0.12386902 4.5 1.49487674 -0.123869 4.5 0.02
GR 0 37
GM 0 0 -90 0 0 0 0 0
GE 0
EK 0
FR 0 1 0 0 100
EX 1 1 1 0 0.0 0.0 0. 0. 0
RP 0 181 1 1000 0 0 0.2 0
EN

I am stuck with the modelling of top and bottom faces as they are getting segment errors. Can someone help me with this.

RCS of PEC cylinder-Plot.pdf

PyNec helix geometry produces no wires

Hello,

It looks like this is the similar issue to Helix geometry ignores ITAG value #36 but this time for PyNEC from necpp 1.7.3.2.

When I create a helix I get an error

Traceback (most recent call last):
File "test_rp.py", line 16, in
context.geometry_complete(0)
File "/usr/local/lib/python2.7/dist-packages/PyNEC.py", line 143, in geometry_complete
return _PyNEC.nec_context_geometry_complete(self, *args)
RuntimeError: Geometry has no wires or patches.

My .py file is below

import matplotlib
matplotlib.use('Agg')

from PyNEC import *
import numpy as np

#creation of a nec context
context=nec_context()

#get the associated geometry
geo = context.get_geometry()

#add wires to the geometry
#geo.wire(0, 36, 0, 0, 0, -0.042, 0.008, 0.017, 0.001, 1.0, 1.0)
geo.helix(0.01,0.1,0.015,0.015,0.015,0.015,0.01,100,0)
context.geometry_complete(0)

context.gn_card(-1, 0, 0, 0, 0, 0, 0, 0)

#add a "ex" card to specify an excitation
context.ex_card(1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0)

#add a "fr" card to specify the frequency
context.fr_card(0, 2, 2400, 100.0e6)

#add a "rp" card to specify radiation pattern sampling parameters and to cause program execution
context.rp_card(0, 91, 1, 0, 5, 0, 0, 0.0, 45.0, 4.0, 2.0, 1.0, 0.0)

#get the radiation_pattern
rp = context.get_radiation_pattern(0)

#Gains are in decibels
gains_db = rp.get_gain()
gains = 10.0**(gains_db / 10.0)
thetas = rp.get_theta_angles() * 3.1415 / 180.0
phis = rp.get_phi_angles() * 3.1415 / 180.0

#Plot stuff
import matplotlib.pyplot as plt

ax = plt.subplot(111, polar=True)
ax.plot(thetas, gains[:,0], color='r', linewidth=3)
ax.grid(True)

ax.set_title("Gain at an elevation of 45 degrees", va='bottom')
plt.savefig('RadiationPattern.png')
plt.show()

By the way, I have not found a helix card in necpp module.

Thanks

Memory segmentation fault

Hi,

I experienced Memory segmentation fault in case of over-28.4GB simulation model.
The root cause is that multiplication of int variables handling memory allocation exceeds int type.
For example, in matrix_algebra.cpp:

234 for (int row = 0; row < n; row++ )
235 {
236     int row_offset = row*ndim;

The "row_offset" exceeds int type.
Then, I modified such variables from int to long long int as below.

matrix_algebra.cpp

236 long long int row_offset = row * ndim;
288 void lu_decompose(nec_output_file& s_output, long long int n, complex_array& a, int_array& ip, long long int ndim)
305 long long int i_offset = i * ndim;
306 long long int j_offset = 0;
321 long long int r_offset = r * ndim;
336 long long int j_offset = j * ndim;
437 void solve(int n, complex_array& a, int_array& ip, complex_array& b,
438 long long int ndim) 
497 void lu_decompose(nec_output_file& s_output, long long int n, complex_arrray& a_in, int_array& ip, long long int ndim)
633 void factrs(nec_output_file& s_output, long long int np, long long int nrow, complex_array& a, int_array& ip)
647 long long int mode_offset = mode * np;
667 void solves(complex_array& a, int_array& ip, complex_array& b, long long int neq,
668 long long int nrh, long long int np, long long int n, long long int mp, long long int m, long long int nop,
669 complex_array& symmetr_array)
689 long long int column_offset = ic * neq;
730 long long int ia = i + k * npeq;

c_geometry.cpp

3078 long long int jco1 = n_plus_2m;
3079 long long int jco2 = jco1 + m;

nec_context.cpp

1018 long long int iresrv = 0;
2332 void nec_context::cmset (long long int nrow, complex_arra& in_cm, nec_float rkhx)
2480 void nec_context::compute_marix_ss (int 1, int j2, int im1, int im2,
2481 complex_array& in_cm, long long int nrow, int itrp)
2583 void nec_context::cmsw (int j1, int 2, int i1, int i2,
2584 complex_array& in_cm, complex_array& cw, long long int ncw, long long int nrow, int itrp)
2696 void nec_context::cmws (int j, int i1, int i2, complex_array& in_cm,
2697 long long int nr, complex_array& cw, long long int nw, int itrp)
2699 long long int ipr, ipatch, ik, js=0, jx;
2799 void nec_context::cmww (int j, int i1, int i2, complex_array& in_cm,
2800 long long int nr, complex_array& cw, long long int nw, int itrp)

matrix_algebra.h

25 void lu_decompose (nec_output_file& s_output, long long int n,  complex_array& a, int_array& ip, long long int ndim); 
26 void factrs (nec_output_file& s_output, long long int np, long long int nrow, complex_array& a, int_array& ip );
27 void solve ( int n, complex_array& a, int_array& ip, complex_array& b, long long int ndim );
29 void solves (complex_array& a, int_array& ip, complex_array& b, long long int neq,
30 long long int nrh, long long int np, long long int n, long long int mp, long long int m, long long int nop,
31 complex_array& symmetry_array); 

nec_context.h

818 void cmset (long long int nrow, complex_array& in_cm,  nec_float rkhx);
819 void compute_matrix_ss (int j1, int j2, int im1, int im2,
820 complex_array& in_cm, long long int nrow, int itrp);
821 void cmsw (int j1, int j2, int i1, int i2, complex_array& in_cm,
822 complex_array& cw, long long int ncw, long long int nrow, int itrp);
823 void cmws (int j, int i1, int i2, complex_array& in_cm, long long int nr,
824 complex_array& cw, long long int nw, int itrp);
825 void cmww (int j, int i1, int i2, complex_array& in_cm, long long int nr,
826 complex_array& cw, long long int nw, int itrp);

After these modifications, NEC2++ can manipulate simulation models over 140GB.
Thank you for this great simulation tool.

Best regards.

Yoshi Takeyasu

"SP" with multiple "SC" doesn't work

Hi,

c_geometry.cpp
167 if ( card_id != "GH") // gm_num != 10 )

this "GH" should be "SC".
167 if ( card_id != "SC") // gm_num != 10 )

The comment "gm_num != 10" is correct as defined at line-114:
114 /* #define GM_NUM 12
char atst[GM_NUM] =
{
"GW", "GX", "GR", "GS", "GE", "GM",
"SP", "SM", "GA", "SC", "GH", "GF"
};
/

The 10th. gm_num is "SC", not "GH".
This error was enbugged by the NEC2C porting from the original FORTRAN code.

Hope this may help.

Yoshi Takeyasu

Ruby-Module - Wrong path in swig file

Using the build.sh script works fine, but trying to compile the Ruby module using swig will fail. Seems to be a faulty path to src/libnecpp.h

[email protected]:~/necpp/Ruby/ext/necpp$ swig -v -c++ -ruby necpp.i

Language subdirectory: ruby
Search paths:
   ./
   ./swig_lib/ruby/
   /usr/share/swig2.0/ruby/
   ./swig_lib/
   /usr/share/swig2.0/
Preprocessing...
necpp.i:49: Error: Unable to find '../src/libnecpp.h'

Build files because of -Werror (misleading indentation).

The problem is within the build process:

In file included from safe_array_tb.cpp:20:0: catch.hpp: In member function ‘bool Catch::TestSpec::Filter::matches(const Catch::TestCaseInfo&) const’: catch.hpp:2813:17: error: this ‘for’ clause does not guard... [-Werror=misleading-indentation] for( std::vector<Ptr<Pattern> >::const_iterator it = m_patterns.begin(), itEnd = m_patterns.end(); it != itEnd; ++it ) ^~~ catch.hpp:2816:21: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘for’ return true; ^~~~~~ cc1plus: all warnings being treated as errors make[2]: *** [Makefile:950: test_manager-safe_array_tb.o] Error 1 make[2]: Leaving directory '[...]/necpp/src' make[1]: *** [Makefile:469: all-recursive] Error 1 make[1]: Leaving directory '[...]/src/necpp' make: *** [Makefile:378: all] Error 2

Patch below fixes it for me:

`diff -U2 -r necpp.orig/src/catch.hpp necpp.new/src/catch.hpp
--- necpp.orig/src/catch.hpp 2016-11-01 10:16:39.000000000 +0100
+++ necpp.new/src/catch.hpp 2016-11-01 10:24:15.000000000 +0100
@@ -2814,5 +2814,5 @@
if( !(*it)->matches( testCase ) )
return false;

  •                return true;
    
  •            return true;
           }
       };
    

`

Alternatively, one could fix the Makefiles to add -Wno-error=misleading-indentation to work around that problem.

clang build fails with errors related to '=-' operator

When attempting a build on Mac OS X 10.11.3 (El Capitan) with current Xcode installed, the format of many assignments is apparently unacceptable to the clang compiler.

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Thread model: posix

The warnings are of the form:

g++ -DHAVE_CONFIG_H -I. -I..    -std=c++11 -O0 -g3 -Wall -Wextra -Werror -DNEC_ERROR_CHECK=1 -g -O2 -MT test_manager-c_geometry.o -MD -MP -MF .deps/test_manager-c_geometry.Tpo -c -o test_manager-c_geometry.o `test -f 'c_geometry.cpp' || echo './'`c_geometry.cpp
c_geometry.cpp:915:5: error: use of unary operator that may be intended as compound assignment (-=) [-Werror]
  zx=- sth;
    ^~
c_geometry.cpp:1094:10: error: use of unary operator that may be intended as compound assignment (-=) [-Werror]
    z[nx]=- e1;
         ^~

and continue until the compiler gives up.

As I'm as puzzled as clang is as to the intent of these lines, I looked at the source code obtained from [http://qsl.net/4nec2/Nec2dXS_src.zip]

It appears that this '=-' is a hold-over from FORTRAN such as
ZX=-STH

clang build does not permit use of abs() with a float-like argument

c_evlcom_tb.cpp:14:15: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
     REQUIRE((abs(j0.real() -  j0r) < eps));
              ^
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Thread model: posix

Easily resolved by using std::fabs()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.