necpp 2.2.1__tar.gz → 2.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. {necpp-2.2.1/necpp.egg-info → necpp-2.2.3}/PKG-INFO +1 -1
  2. {necpp-2.2.1 → necpp-2.2.3/necpp.egg-info}/PKG-INFO +1 -1
  3. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/c_geometry.cpp +18 -10
  4. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/matrix_algebra.cpp +5 -5
  5. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/misc.cpp +24 -2
  6. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/misc.h +1 -1
  7. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_context.cpp +6 -6
  8. {necpp-2.2.1 → necpp-2.2.3}/pyproject.toml +1 -1
  9. {necpp-2.2.1 → necpp-2.2.3}/tests/test_multiple_sc_cards.py +4 -4
  10. {necpp-2.2.1 → necpp-2.2.3}/LICENCE.txt +0 -0
  11. {necpp-2.2.1 → necpp-2.2.3}/MANIFEST.in +0 -0
  12. {necpp-2.2.1 → necpp-2.2.3}/README.md +0 -0
  13. {necpp-2.2.1 → necpp-2.2.3}/example/antenna_util.py +0 -0
  14. {necpp-2.2.1 → necpp-2.2.3}/example/different_material.py +0 -0
  15. {necpp-2.2.1 → necpp-2.2.3}/example/impedance_plot.py +0 -0
  16. {necpp-2.2.1 → necpp-2.2.3}/example/monopole.py +0 -0
  17. {necpp-2.2.1 → necpp-2.2.3}/example/optimized.py +0 -0
  18. {necpp-2.2.1 → necpp-2.2.3}/necpp.egg-info/SOURCES.txt +0 -0
  19. {necpp-2.2.1 → necpp-2.2.3}/necpp.egg-info/dependency_links.txt +0 -0
  20. {necpp-2.2.1 → necpp-2.2.3}/necpp.egg-info/top_level.txt +0 -0
  21. {necpp-2.2.1 → necpp-2.2.3}/necpp.py +0 -0
  22. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/example/test.py +0 -0
  23. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/AntennaInput.h +0 -0
  24. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/BaseInput.h +0 -0
  25. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/CurrentInput.h +0 -0
  26. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/PowerBudget.h +0 -0
  27. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/RadiationInput.h +0 -0
  28. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/XGetopt.cpp +0 -0
  29. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/XGetopt.h +0 -0
  30. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/c_evlcom.cpp +0 -0
  31. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/c_evlcom.h +0 -0
  32. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/c_geometry.h +0 -0
  33. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/c_ggrid.cpp +0 -0
  34. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/c_ggrid.h +0 -0
  35. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/c_plot_card.cpp +0 -0
  36. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/c_plot_card.h +0 -0
  37. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/common.h +0 -0
  38. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/config.h.in +0 -0
  39. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/electromag.cpp +0 -0
  40. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/electromag.h +0 -0
  41. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/libNEC.cpp +0 -0
  42. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/libnecpp.h +0 -0
  43. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/math_util.h +0 -0
  44. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/matrix_algebra.h +0 -0
  45. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec2cpp.h +0 -0
  46. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_card_parser.h +0 -0
  47. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_context.h +0 -0
  48. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_debug.h +0 -0
  49. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_exception.cpp +0 -0
  50. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_exception.h +0 -0
  51. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_ground.cpp +0 -0
  52. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_ground.h +0 -0
  53. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_output.cpp +0 -0
  54. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_output.h +0 -0
  55. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_radiation_pattern.cpp +0 -0
  56. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_radiation_pattern.h +0 -0
  57. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_results.cpp +0 -0
  58. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_results.h +0 -0
  59. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_structure_currents.cpp +0 -0
  60. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_structure_currents.h +0 -0
  61. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/nec_wire.h +0 -0
  62. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/safe_array.h +0 -0
  63. {necpp-2.2.1 → necpp-2.2.3}/necpp_src/src/typesafe_stdint.h +0 -0
  64. {necpp-2.2.1 → necpp-2.2.3}/necpp_wrap.c +0 -0
  65. {necpp-2.2.1 → necpp-2.2.3}/setup.cfg +0 -0
  66. {necpp-2.2.1 → necpp-2.2.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: necpp
3
- Version: 2.2.1
3
+ Version: 2.2.3
4
4
  Summary: Python Antenna Simulation Module (nec2++) C-style interface
5
5
  Author-email: Tim Molteno <tim@physics.otago.ac.nz>
6
6
  License-Expression: GPL-3.0-only
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: necpp
3
- Version: 2.2.1
3
+ Version: 2.2.3
4
4
  Summary: Python Antenna Simulation Module (nec2++) C-style interface
5
5
  Author-email: Tim Molteno <tim@physics.otago.ac.nz>
6
6
  License-Expression: GPL-3.0-only
@@ -1971,12 +1971,18 @@ void c_geometry::sc_card(int i2,
1971
1971
  default:
1972
1972
  throw nec_exception("PATCH DATA ERROR ns ", this->patch_type );
1973
1973
  }
1974
- patch( this->patch_type, i2,
1975
- this->patch_x1(0), this->patch_x1(1), this->patch_x1(2),
1974
+ /* The patch shape is conveyed by the ny argument (i2); nx must be 0 so
1975
+ that patch() treats this as a single shaped patch rather than an
1976
+ nx-by-ny grid (nx > 0 would expand each SC card into a grid of
1977
+ patches, bloating the interaction matrix). This mirrors the
1978
+ file-parser path (parse_sc_card), which calls
1979
+ patch(st.card_int_1 = 0, st.card_int_2, ...). */
1980
+ patch( 0, i2,
1981
+ this->patch_x1(0), this->patch_x1(1), this->patch_x1(2),
1976
1982
  this->patch_x2(0), this->patch_x2(1), this->patch_x2(2),
1977
1983
  this->patch_x3(0), this->patch_x3(1), this->patch_x3(2),
1978
1984
  this->patch_x4(0), this->patch_x4(1), this->patch_x4(2));
1979
-
1985
+
1980
1986
  _prev_sc = true;
1981
1987
  }
1982
1988
 
@@ -2024,16 +2030,18 @@ void c_geometry::sc_multiple_card(int i2,
2024
2030
  default:
2025
2031
  throw nec_exception("PATCH DATA ERROR i2 = ", i2 );
2026
2032
  }
2027
-
2028
- patch( this->patch_type, i2,
2029
- this->patch_x1(0), this->patch_x1(1), this->patch_x1(2),
2033
+
2034
+ /* See sc_card(): nx must be 0 to avoid patch() generating an nx-by-ny
2035
+ grid of patches for each linked SC card in the patch string. */
2036
+ patch( 0, i2,
2037
+ this->patch_x1(0), this->patch_x1(1), this->patch_x1(2),
2030
2038
  this->patch_x2(0), this->patch_x2(1), this->patch_x2(2),
2031
2039
  this->patch_x3(0), this->patch_x3(1), this->patch_x3(2),
2032
2040
  this->patch_x4(0), this->patch_x4(1), this->patch_x4(2));
2033
-
2041
+
2034
2042
  m_output->nec_printf( "\n"
2035
2043
  " %5d%c %10.5f %11.5f %11.5f %11.5f %11.5f %11.5f",
2036
- this->patch_type, ipt[i2],
2044
+ this->patch_type, ipt[i2],
2037
2045
  this->patch_x1(0), this->patch_x1(1), this->patch_x1(2),
2038
2046
  this->patch_x2(0), this->patch_x2(1), this->patch_x2(2));
2039
2047
 
@@ -2475,7 +2483,7 @@ void c_geometry::read_geometry_card(FILE* input_fp, char *gm,
2475
2483
  nec_float *in_x2, nec_float *in_y2, nec_float *in_z2,
2476
2484
  nec_float *in_rad )
2477
2485
  {
2478
- char line_buf[134];
2486
+ char line_buf[LINE_LEN+1];
2479
2487
  load_line( line_buf, input_fp );
2480
2488
  parse_geometry_card_line(line_buf, gm, in_i1, in_i2, in_x1, in_y1, in_z1, in_x2, in_y2, in_z2, in_rad);
2481
2489
  }
@@ -2486,7 +2494,7 @@ void c_geometry::read_geometry_card(std::istream& is, char *gm,
2486
2494
  nec_float *in_x2, nec_float *in_y2, nec_float *in_z2,
2487
2495
  nec_float *in_rad )
2488
2496
  {
2489
- char line_buf[134];
2497
+ char line_buf[LINE_LEN+1];
2490
2498
  load_line( line_buf, is );
2491
2499
  parse_geometry_card_line(line_buf, gm, in_i1, in_i2, in_x1, in_y1, in_z1, in_x2, in_y2, in_z2, in_rad);
2492
2500
  }
@@ -330,8 +330,8 @@ void factrs(nec_output_file& s_output, int64_t np, int64_t nrow, complex_arra
330
330
  for (int mode = 0; mode < num_symmetric_modes; mode++ ) {
331
331
  int64_t mode_offset = mode * np;
332
332
 
333
- complex_array a_temp = a.segment(mode_offset, a.size()-mode_offset);
334
- int_array ip_temp = ip.segment(mode_offset, ip.size()-mode_offset);
333
+ complex_array a_temp = a.eigen_segment(mode_offset, a.size()-mode_offset);
334
+ int_array ip_temp = ip.eigen_segment(mode_offset, ip.size()-mode_offset);
335
335
 
336
336
  lu_decompose(s_output, np, a_temp, ip_temp, nrow );
337
337
  }
@@ -426,9 +426,9 @@ void solves(complex_array& a, int_array& ip, complex_array& b, int64_t neq,
426
426
 
427
427
  for (int64_t ic = 0; ic < nrh; ic++ ) {
428
428
  int64_t column_offset = ic*neq;
429
- complex_array a_sub = a.segment(ia, a.size()-ia);
430
- complex_array b_sub = b.segment(ia+column_offset, b.size() - (ia+column_offset) );
431
- int_array ip_sub = ip.segment(ia, ip.size()-ia);
429
+ complex_array a_sub = a.eigen_segment(ia, a.size()-ia);
430
+ complex_array b_sub = b.eigen_segment(ia+column_offset, b.size() - (ia+column_offset) );
431
+ int_array ip_sub = ip.eigen_segment(ia, ip.size()-ia);
432
432
  solve( npeq, a_sub, ip_sub, b_sub, nrow );
433
433
  }
434
434
  } /* for( kk = 0; kk < nop; kk++ ) */
@@ -119,8 +119,19 @@ int load_line( char *buff, FILE *pfile )
119
119
  buff[num_chr] = '\0';
120
120
  eof = EOF;
121
121
  }
122
- } /* end of while( num_chr < max_chr ) */
123
-
122
+ } /* end of while( num_chr < LINE_LEN ) */
123
+
124
+ /* drain any characters past LINE_LEN so an over-length line
125
+ * cannot leak its tail into the next load_line read. Match the
126
+ * fill loop's EOF convention (set eof, fall through) rather than
127
+ * the single-quote drain's early return, so the buffer's mnemonic
128
+ * is still capitalized/terminated and the caller sees EOF. */
129
+ while( (chr != CR) && (chr != LF) )
130
+ if( (chr = fgetc(pfile)) == EOF ) {
131
+ eof = EOF;
132
+ break;
133
+ }
134
+
124
135
  /* Capitalize first two characters (mnemonics) */
125
136
  buff[0] = static_cast<char>(std::toupper(buff[0]));
126
137
  buff[1] = static_cast<char>(std::toupper(buff[1]));
@@ -175,6 +186,17 @@ int load_line( char *buff, std::istream& is )
175
186
  }
176
187
  }
177
188
 
189
+ /* drain any characters past LINE_LEN so an over-length line
190
+ * cannot leak its tail into the next load_line read. Match the
191
+ * fill loop's EOF convention (set eof, fall through). */
192
+ while ( (chr != CR) && (chr != LF) ) {
193
+ chr = is.get();
194
+ if ( !is ) {
195
+ eof = EOF;
196
+ break;
197
+ }
198
+ }
199
+
178
200
  buff[0] = static_cast<char>(std::toupper(buff[0]));
179
201
  buff[1] = static_cast<char>(std::toupper(buff[1]));
180
202
  buff[num_chr] = '\0';
@@ -9,7 +9,7 @@
9
9
  #define LF 0x0a
10
10
 
11
11
  /* max length of a line read from input file */
12
- #define LINE_LEN 132
12
+ #define LINE_LEN 512
13
13
 
14
14
  /* usage()
15
15
  *
@@ -2111,7 +2111,7 @@ void nec_context::cmset( int64_t nrow, complex_array& in_cm, nec_float rkhx) {
2111
2111
  cmww( j, i1, in2, in_cm, nrow, in_cm, nrow,1);
2112
2112
 
2113
2113
  if ( im1 <= im2) {
2114
- complex_array temp = in_cm.segment((ist-1)*nrow, in_cm.size() - ((ist-1)*nrow));
2114
+ complex_array temp = in_cm.eigen_segment((ist-1)*nrow, in_cm.size() - ((ist-1)*nrow));
2115
2115
  cmws( j, im1, im2, temp, nrow, in_cm, nrow, 1);
2116
2116
  /* CMWS (J,IM1,IM2,CM(1,IST),NROW,CM,NROW,1) */
2117
2117
  }
@@ -2148,13 +2148,13 @@ void nec_context::cmset( int64_t nrow, complex_array& in_cm, nec_float rkhx) {
2148
2148
 
2149
2149
  if ( i1 <= in2) {
2150
2150
  int64_t tmp_n = (jst-1);
2151
- complex_array temp = in_cm.segment(tmp_n, in_cm.size()-tmp_n);
2151
+ complex_array temp = in_cm.eigen_segment(tmp_n, in_cm.size()-tmp_n);
2152
2152
  cmsw( jm1, jm2, i1, in2, temp, in_cm, 0, nrow, 1);
2153
2153
  }
2154
2154
 
2155
2155
  if ( im1 <= im2) {
2156
2156
  int64_t tmp_n = (jst-1)+(ist-1)*nrow;
2157
- complex_array temp = in_cm.segment(tmp_n, in_cm.size()-tmp_n);
2157
+ complex_array temp = in_cm.eigen_segment(tmp_n, in_cm.size()-tmp_n);
2158
2158
  compute_matrix_ss( jm1, jm2, im1, im2, temp, nrow, 1);
2159
2159
  }
2160
2160
  }
@@ -2177,7 +2177,7 @@ void nec_context::cmset( int64_t nrow, complex_array& in_cm, nec_float rkhx) {
2177
2177
  scm[k] = in_cm[row_offset + ka];
2178
2178
  }
2179
2179
 
2180
- in_cm[row_offset + j] = scm.segment(0,nop).sum(); //scm.sum(0,nop);
2180
+ in_cm[row_offset + j] = scm.eigen_segment(0,nop).sum(); //scm.sum(0,nop);
2181
2181
 
2182
2182
  for( int k = 1; k < nop; k++ ) {
2183
2183
  int ka = j+ k*npeq;
@@ -6819,14 +6819,14 @@ void nec_context::ffld(nec_float thet, nec_float phi,
6819
6819
  /* electric field components */
6820
6820
  roz= rozs;
6821
6821
  { // without ground
6822
- complex_array temp = current_vector.segment(m_geometry->n_segments, current_vector.size()-m_geometry->n_segments);
6822
+ complex_array temp = current_vector.eigen_segment(m_geometry->n_segments, current_vector.size()-m_geometry->n_segments);
6823
6823
  m_geometry->fflds(rox, roy, roz, temp, &ex, &ey, &ez);
6824
6824
  }
6825
6825
  if (ground.present()) {
6826
6826
  // with ground
6827
6827
  nec_complex tempx, tempy, tempz;
6828
6828
 
6829
- complex_array temp = current_vector.segment(m_geometry->n_segments, current_vector.size()-m_geometry->n_segments);
6829
+ complex_array temp = current_vector.eigen_segment(m_geometry->n_segments, current_vector.size()-m_geometry->n_segments);
6830
6830
  m_geometry->fflds(rox, roy, -roz, temp, &tempx, &tempy, &tempz);
6831
6831
 
6832
6832
  if (ground.type_perfect()) {
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "necpp"
8
- version = "2.2.1"
8
+ version = "2.2.3"
9
9
  description = "Python Antenna Simulation Module (nec2++) C-style interface"
10
10
  readme = "README.md"
11
11
  license = "GPL-3.0-only"
@@ -299,11 +299,11 @@ class TestSurfacePatches(unittest.TestCase):
299
299
  ----- ANTENNA INPUT PARAMETERS -----
300
300
  TAG SEG VOLTAGE (VOLTS) CURRENT (AMPS) IMPEDANCE (OHMS) ADMITTANCE (MHOS) POWER
301
301
  NO. NO. REAL IMAGINARY REAL IMAGINARY REAL IMAGINARY REAL IMAGINARY (WATTS)
302
- 1 8 1.0000E+00 0.0000E+00 9.2145E-03 6.7375E-04 1.0795E+02 -7.8930E+00 9.2145E-03 6.7375E-04 4.6072E-03
302
+ 1 8 1.0000E+00 0.0000E+00 1.4793E-02 3.7433E-03 6.6908E+01 -1.6926E+01 1.4793E-02 3.7433E-03 7.3963E-03
303
303
  """
304
- self.assertAlmostEqual(nec_impedance_real(nec, 0), 1.0795e02, 3)
305
- self.assertAlmostEqual(nec_impedance_imag(nec, 0), -7.8930e00, 3)
306
- self.assertAlmostEqual(nec_gain_max(nec, 0), 10.3332, 4)
304
+ self.assertAlmostEqual(nec_impedance_real(nec, 0), 6.6908e01, 3)
305
+ self.assertAlmostEqual(nec_impedance_imag(nec, 0), -1.6926e01, 3)
306
+ self.assertAlmostEqual(nec_gain_max(nec, 0), 1.7660, 4)
307
307
 
308
308
  self.handle_nec(nec_delete(nec))
309
309
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes