PyNEC 1.7.4__tar.gz → 1.8.2__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 (84) hide show
  1. {pynec-1.7.4 → pynec-1.8.2}/PKG-INFO +2 -3
  2. {pynec-1.7.4 → pynec-1.8.2}/PyNEC.egg-info/PKG-INFO +2 -3
  3. {pynec-1.7.4 → pynec-1.8.2}/PyNEC.egg-info/SOURCES.txt +2 -1
  4. {pynec-1.7.4 → pynec-1.8.2}/PyNEC.py +5 -2
  5. {pynec-1.7.4 → pynec-1.8.2}/PyNEC_wrap.cxx +114 -22
  6. pynec-1.8.2/example/basic_usage.py +135 -0
  7. {pynec-1.7.4 → pynec-1.8.2}/example/context_clean.py +162 -33
  8. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/config.h +4 -10
  9. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/AntennaInput.h +1 -4
  10. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/BaseInput.h +1 -4
  11. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/CurrentInput.h +12 -4
  12. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/PowerBudget.h +1 -4
  13. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/RadiationInput.h +1 -4
  14. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/c_evlcom.cpp +2 -2
  15. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/c_evlcom.h +1 -4
  16. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/c_geometry.cpp +816 -848
  17. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/c_geometry.h +47 -12
  18. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/c_ggrid.cpp +91 -126
  19. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/c_ggrid.h +19 -5
  20. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/c_plot_card.h +1 -4
  21. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/common.h +1 -4
  22. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/electromag.h +1 -4
  23. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/libNEC.cpp +5 -4
  24. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/libnecpp.h +1 -4
  25. pynec-1.8.2/necpp_src/src/math_util.h +186 -0
  26. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/matrix_algebra.cpp +71 -173
  27. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/matrix_algebra.h +6 -15
  28. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/misc.cpp +22 -16
  29. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/misc.h +1 -6
  30. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec2cpp.h +0 -2
  31. pynec-1.8.2/necpp_src/src/nec_card_parser.h +131 -0
  32. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_context.cpp +983 -1108
  33. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_context.h +46 -13
  34. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_debug.h +3 -7
  35. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_exception.cpp +2 -2
  36. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_exception.h +13 -13
  37. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_ground.cpp +5 -5
  38. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_ground.h +2 -5
  39. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_output.cpp +2 -2
  40. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_output.h +1 -4
  41. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_radiation_pattern.cpp +8 -16
  42. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_radiation_pattern.h +3 -6
  43. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_results.h +13 -75
  44. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_structure_currents.cpp +8 -16
  45. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_structure_currents.h +3 -11
  46. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_wire.h +17 -14
  47. pynec-1.8.2/necpp_src/src/safe_array.h +267 -0
  48. {pynec-1.7.4 → pynec-1.8.2}/pyproject.toml +2 -3
  49. {pynec-1.7.4 → pynec-1.8.2}/setup.py +3 -9
  50. pynec-1.7.4/necpp_src/src/atlas_check.cpp +0 -613
  51. pynec-1.7.4/necpp_src/src/math_util.h +0 -345
  52. pynec-1.7.4/necpp_src/src/safe_array.h +0 -339
  53. {pynec-1.7.4 → pynec-1.8.2}/LICENCE.txt +0 -0
  54. {pynec-1.7.4 → pynec-1.8.2}/MANIFEST.in +0 -0
  55. {pynec-1.7.4 → pynec-1.8.2}/PyNEC.egg-info/dependency_links.txt +0 -0
  56. {pynec-1.7.4 → pynec-1.8.2}/PyNEC.egg-info/requires.txt +0 -0
  57. {pynec-1.7.4 → pynec-1.8.2}/PyNEC.egg-info/top_level.txt +0 -0
  58. {pynec-1.7.4 → pynec-1.8.2}/README.md +0 -0
  59. {pynec-1.7.4 → pynec-1.8.2}/example/antenna_util.py +0 -0
  60. {pynec-1.7.4 → pynec-1.8.2}/example/dipole.py +0 -0
  61. {pynec-1.7.4 → pynec-1.8.2}/example/impedance_plot.py +0 -0
  62. {pynec-1.7.4 → pynec-1.8.2}/example/logperiodic_opt.py +0 -0
  63. {pynec-1.7.4 → pynec-1.8.2}/example/monopole.py +0 -0
  64. {pynec-1.7.4 → pynec-1.8.2}/example/monopole_realistic_ground_plane.py +0 -0
  65. {pynec-1.7.4 → pynec-1.8.2}/example/optimized.py +0 -0
  66. {pynec-1.7.4 → pynec-1.8.2}/example/radiation_pattern.py +0 -0
  67. {pynec-1.7.4 → pynec-1.8.2}/example/test_ai.py +0 -0
  68. {pynec-1.7.4 → pynec-1.8.2}/example/test_charge_densities.py +0 -0
  69. {pynec-1.7.4 → pynec-1.8.2}/example/test_ne_nh.py +0 -0
  70. {pynec-1.7.4 → pynec-1.8.2}/example/test_nrp.py +0 -0
  71. {pynec-1.7.4 → pynec-1.8.2}/example/test_rp.py +0 -0
  72. {pynec-1.7.4 → pynec-1.8.2}/example/test_rp2.py +0 -0
  73. {pynec-1.7.4 → pynec-1.8.2}/example/test_se.py +0 -0
  74. {pynec-1.7.4 → pynec-1.8.2}/example/test_structure_currents.py +0 -0
  75. {pynec-1.7.4 → pynec-1.8.2}/example/test_surface_patch_currents.py +0 -0
  76. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/XGetopt.cpp +0 -0
  77. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/XGetopt.h +0 -0
  78. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/c_plot_card.cpp +0 -0
  79. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/electromag.cpp +0 -0
  80. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/nec_results.cpp +0 -0
  81. {pynec-1.7.4 → pynec-1.8.2}/necpp_src/src/typesafe_stdint.h +0 -0
  82. {pynec-1.7.4 → pynec-1.8.2}/setup.cfg +0 -0
  83. {pynec-1.7.4 → pynec-1.8.2}/tests/test_examples.py +0 -0
  84. {pynec-1.7.4 → pynec-1.8.2}/tests/test_get_gain.py +0 -0
@@ -1,16 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyNEC
3
- Version: 1.7.4
3
+ Version: 1.8.2
4
4
  Summary: Python Antenna Simulation Module (nec2++) object-oriented interface
5
5
  Author-email: Tim Molteno <tim@physics.otago.ac.nz>
6
- License: GPLv3
6
+ License-Expression: GPL-3.0-only
7
7
  Project-URL: Homepage, http://github.com/tmolteno/python-necpp
8
8
  Project-URL: Repository, http://github.com/tmolteno/python-necpp
9
9
  Keywords: nec2,nec2++,antenna,electromagnetism,radio
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Topic :: Scientific/Engineering
12
12
  Classifier: Topic :: Communications :: Ham Radio
13
- Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
14
13
  Classifier: Programming Language :: Python :: 3
15
14
  Classifier: Intended Audience :: Science/Research
16
15
  Requires-Python: >=3.9
@@ -1,16 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyNEC
3
- Version: 1.7.4
3
+ Version: 1.8.2
4
4
  Summary: Python Antenna Simulation Module (nec2++) object-oriented interface
5
5
  Author-email: Tim Molteno <tim@physics.otago.ac.nz>
6
- License: GPLv3
6
+ License-Expression: GPL-3.0-only
7
7
  Project-URL: Homepage, http://github.com/tmolteno/python-necpp
8
8
  Project-URL: Repository, http://github.com/tmolteno/python-necpp
9
9
  Keywords: nec2,nec2++,antenna,electromagnetism,radio
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Topic :: Scientific/Engineering
12
12
  Classifier: Topic :: Communications :: Ham Radio
13
- Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
14
13
  Classifier: Programming Language :: Python :: 3
15
14
  Classifier: Intended Audience :: Science/Research
16
15
  Requires-Python: >=3.9
@@ -11,6 +11,7 @@ PyNEC.egg-info/dependency_links.txt
11
11
  PyNEC.egg-info/requires.txt
12
12
  PyNEC.egg-info/top_level.txt
13
13
  example/antenna_util.py
14
+ example/basic_usage.py
14
15
  example/context_clean.py
15
16
  example/dipole.py
16
17
  example/impedance_plot.py
@@ -36,7 +37,6 @@ necpp_src/src/PowerBudget.h
36
37
  necpp_src/src/RadiationInput.h
37
38
  necpp_src/src/XGetopt.cpp
38
39
  necpp_src/src/XGetopt.h
39
- necpp_src/src/atlas_check.cpp
40
40
  necpp_src/src/c_evlcom.cpp
41
41
  necpp_src/src/c_evlcom.h
42
42
  necpp_src/src/c_geometry.cpp
@@ -56,6 +56,7 @@ necpp_src/src/matrix_algebra.h
56
56
  necpp_src/src/misc.cpp
57
57
  necpp_src/src/misc.h
58
58
  necpp_src/src/nec2cpp.h
59
+ necpp_src/src/nec_card_parser.h
59
60
  necpp_src/src/nec_context.cpp
60
61
  necpp_src/src/nec_context.h
61
62
  necpp_src/src/nec_debug.h
@@ -198,8 +198,8 @@ class c_geometry(object):
198
198
  def arc(self, tag_id, segment_count, rada, ang1, ang2, rad):
199
199
  return _PyNEC.c_geometry_arc(self, tag_id, segment_count, rada, ang1, ang2, rad)
200
200
 
201
- def helix(self, s, hl, a1, b1, a2, b2, rad, segment_count, tag_id):
202
- return _PyNEC.c_geometry_helix(self, s, hl, a1, b1, a2, b2, rad, segment_count, tag_id)
201
+ def helix(self, tag_id, segment_count, s, hl, a1, b1, a2, b2, rad):
202
+ return _PyNEC.c_geometry_helix(self, tag_id, segment_count, s, hl, a1, b1, a2, b2, rad)
203
203
 
204
204
  def scale(self, xw1):
205
205
  return _PyNEC.c_geometry_scale(self, xw1)
@@ -213,6 +213,9 @@ class c_geometry(object):
213
213
  def sp_card(self, ns, in_x1, in_y1, in_z1, in_x2, in_y2, in_z2):
214
214
  return _PyNEC.c_geometry_sp_card(self, ns, in_x1, in_y1, in_z1, in_x2, in_y2, in_z2)
215
215
 
216
+ def sc_card(self, i2, x3, y3, z3, x4, y4, z4):
217
+ return _PyNEC.c_geometry_sc_card(self, i2, x3, y3, z3, x4, y4, z4)
218
+
216
219
  def gx_card(self, card_int_1, card_int_2):
217
220
  return _PyNEC.c_geometry_gx_card(self, card_int_1, card_int_2)
218
221
 
@@ -3620,13 +3620,13 @@ SWIGINTERN void c_geometry_move(c_geometry *self,nec_float rox_deg,nec_float roy
3620
3620
  nec_float rox_rad = degrees_to_rad(rox_deg);
3621
3621
  nec_float roy_rad = degrees_to_rad(roy_deg);
3622
3622
  nec_float roz_rad = degrees_to_rad(roz_deg);
3623
-
3623
+
3624
3624
  return self->move( rox_rad, roy_rad, roz_rad, xs, ys, zs, its, nrpt, itgi );
3625
3625
  }
3626
3626
  SWIGINTERN void c_geometry_arbitrary_shaped_patch(c_geometry *self,nec_float ax1,nec_float ay1,nec_float az1,nec_float ax2_deg,nec_float ay2_deg,nec_float az2){
3627
3627
  nec_float ax2_rad = degrees_to_rad(ax2_deg);
3628
3628
  nec_float ay2_rad = degrees_to_rad(ay2_deg);
3629
-
3629
+
3630
3630
  return self->patch( 0, 1, ax1, ay1, az1, ax2_rad, ay2_rad, az2, 0, 0, 0, 0, 0, 0 );
3631
3631
  }
3632
3632
  SWIGINTERN void c_geometry_rectangular_patch(c_geometry *self,nec_float ax1,nec_float ay1,nec_float az1,nec_float ax2,nec_float ay2,nec_float az2,nec_float ax3,nec_float ay3,nec_float az3){
@@ -6786,20 +6786,20 @@ fail:
6786
6786
  SWIGINTERN PyObject *_wrap_c_geometry_helix(PyObject *self, PyObject *args) {
6787
6787
  PyObject *resultobj = 0;
6788
6788
  c_geometry *arg1 = (c_geometry *) 0 ;
6789
- nec_float arg2 ;
6790
- nec_float arg3 ;
6789
+ int arg2 ;
6790
+ int arg3 ;
6791
6791
  nec_float arg4 ;
6792
6792
  nec_float arg5 ;
6793
6793
  nec_float arg6 ;
6794
6794
  nec_float arg7 ;
6795
6795
  nec_float arg8 ;
6796
- int arg9 ;
6797
- int arg10 ;
6796
+ nec_float arg9 ;
6797
+ nec_float arg10 ;
6798
6798
  void *argp1 = 0 ;
6799
6799
  int res1 = 0 ;
6800
- double val2 ;
6800
+ int val2 ;
6801
6801
  int ecode2 = 0 ;
6802
- double val3 ;
6802
+ int val3 ;
6803
6803
  int ecode3 = 0 ;
6804
6804
  double val4 ;
6805
6805
  int ecode4 = 0 ;
@@ -6811,9 +6811,9 @@ SWIGINTERN PyObject *_wrap_c_geometry_helix(PyObject *self, PyObject *args) {
6811
6811
  int ecode7 = 0 ;
6812
6812
  double val8 ;
6813
6813
  int ecode8 = 0 ;
6814
- int val9 ;
6814
+ double val9 ;
6815
6815
  int ecode9 = 0 ;
6816
- int val10 ;
6816
+ double val10 ;
6817
6817
  int ecode10 = 0 ;
6818
6818
  PyObject *swig_obj[10] ;
6819
6819
 
@@ -6824,16 +6824,16 @@ SWIGINTERN PyObject *_wrap_c_geometry_helix(PyObject *self, PyObject *args) {
6824
6824
  SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "c_geometry_helix" "', argument " "1"" of type '" "c_geometry *""'");
6825
6825
  }
6826
6826
  arg1 = reinterpret_cast< c_geometry * >(argp1);
6827
- ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
6827
+ ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
6828
6828
  if (!SWIG_IsOK(ecode2)) {
6829
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "c_geometry_helix" "', argument " "2"" of type '" "nec_float""'");
6829
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "c_geometry_helix" "', argument " "2"" of type '" "int""'");
6830
6830
  }
6831
- arg2 = static_cast< nec_float >(val2);
6832
- ecode3 = SWIG_AsVal_double(swig_obj[2], &val3);
6831
+ arg2 = static_cast< int >(val2);
6832
+ ecode3 = SWIG_AsVal_int(swig_obj[2], &val3);
6833
6833
  if (!SWIG_IsOK(ecode3)) {
6834
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "c_geometry_helix" "', argument " "3"" of type '" "nec_float""'");
6834
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "c_geometry_helix" "', argument " "3"" of type '" "int""'");
6835
6835
  }
6836
- arg3 = static_cast< nec_float >(val3);
6836
+ arg3 = static_cast< int >(val3);
6837
6837
  ecode4 = SWIG_AsVal_double(swig_obj[3], &val4);
6838
6838
  if (!SWIG_IsOK(ecode4)) {
6839
6839
  SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "c_geometry_helix" "', argument " "4"" of type '" "nec_float""'");
@@ -6859,16 +6859,16 @@ SWIGINTERN PyObject *_wrap_c_geometry_helix(PyObject *self, PyObject *args) {
6859
6859
  SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "c_geometry_helix" "', argument " "8"" of type '" "nec_float""'");
6860
6860
  }
6861
6861
  arg8 = static_cast< nec_float >(val8);
6862
- ecode9 = SWIG_AsVal_int(swig_obj[8], &val9);
6862
+ ecode9 = SWIG_AsVal_double(swig_obj[8], &val9);
6863
6863
  if (!SWIG_IsOK(ecode9)) {
6864
- SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "c_geometry_helix" "', argument " "9"" of type '" "int""'");
6864
+ SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "c_geometry_helix" "', argument " "9"" of type '" "nec_float""'");
6865
6865
  }
6866
- arg9 = static_cast< int >(val9);
6867
- ecode10 = SWIG_AsVal_int(swig_obj[9], &val10);
6866
+ arg9 = static_cast< nec_float >(val9);
6867
+ ecode10 = SWIG_AsVal_double(swig_obj[9], &val10);
6868
6868
  if (!SWIG_IsOK(ecode10)) {
6869
- SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "c_geometry_helix" "', argument " "10"" of type '" "int""'");
6869
+ SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "c_geometry_helix" "', argument " "10"" of type '" "nec_float""'");
6870
6870
  }
6871
- arg10 = static_cast< int >(val10);
6871
+ arg10 = static_cast< nec_float >(val10);
6872
6872
  {
6873
6873
  try {
6874
6874
  (arg1)->helix(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10);
@@ -7142,6 +7142,97 @@ fail:
7142
7142
  }
7143
7143
 
7144
7144
 
7145
+ SWIGINTERN PyObject *_wrap_c_geometry_sc_card(PyObject *self, PyObject *args) {
7146
+ PyObject *resultobj = 0;
7147
+ c_geometry *arg1 = (c_geometry *) 0 ;
7148
+ int arg2 ;
7149
+ nec_float arg3 ;
7150
+ nec_float arg4 ;
7151
+ nec_float arg5 ;
7152
+ nec_float arg6 ;
7153
+ nec_float arg7 ;
7154
+ nec_float arg8 ;
7155
+ void *argp1 = 0 ;
7156
+ int res1 = 0 ;
7157
+ int val2 ;
7158
+ int ecode2 = 0 ;
7159
+ double val3 ;
7160
+ int ecode3 = 0 ;
7161
+ double val4 ;
7162
+ int ecode4 = 0 ;
7163
+ double val5 ;
7164
+ int ecode5 = 0 ;
7165
+ double val6 ;
7166
+ int ecode6 = 0 ;
7167
+ double val7 ;
7168
+ int ecode7 = 0 ;
7169
+ double val8 ;
7170
+ int ecode8 = 0 ;
7171
+ PyObject *swig_obj[8] ;
7172
+
7173
+ (void)self;
7174
+ if (!SWIG_Python_UnpackTuple(args, "c_geometry_sc_card", 8, 8, swig_obj)) SWIG_fail;
7175
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_c_geometry, 0 | 0 );
7176
+ if (!SWIG_IsOK(res1)) {
7177
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "c_geometry_sc_card" "', argument " "1"" of type '" "c_geometry *""'");
7178
+ }
7179
+ arg1 = reinterpret_cast< c_geometry * >(argp1);
7180
+ ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
7181
+ if (!SWIG_IsOK(ecode2)) {
7182
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "c_geometry_sc_card" "', argument " "2"" of type '" "int""'");
7183
+ }
7184
+ arg2 = static_cast< int >(val2);
7185
+ ecode3 = SWIG_AsVal_double(swig_obj[2], &val3);
7186
+ if (!SWIG_IsOK(ecode3)) {
7187
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "c_geometry_sc_card" "', argument " "3"" of type '" "nec_float""'");
7188
+ }
7189
+ arg3 = static_cast< nec_float >(val3);
7190
+ ecode4 = SWIG_AsVal_double(swig_obj[3], &val4);
7191
+ if (!SWIG_IsOK(ecode4)) {
7192
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "c_geometry_sc_card" "', argument " "4"" of type '" "nec_float""'");
7193
+ }
7194
+ arg4 = static_cast< nec_float >(val4);
7195
+ ecode5 = SWIG_AsVal_double(swig_obj[4], &val5);
7196
+ if (!SWIG_IsOK(ecode5)) {
7197
+ SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "c_geometry_sc_card" "', argument " "5"" of type '" "nec_float""'");
7198
+ }
7199
+ arg5 = static_cast< nec_float >(val5);
7200
+ ecode6 = SWIG_AsVal_double(swig_obj[5], &val6);
7201
+ if (!SWIG_IsOK(ecode6)) {
7202
+ SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "c_geometry_sc_card" "', argument " "6"" of type '" "nec_float""'");
7203
+ }
7204
+ arg6 = static_cast< nec_float >(val6);
7205
+ ecode7 = SWIG_AsVal_double(swig_obj[6], &val7);
7206
+ if (!SWIG_IsOK(ecode7)) {
7207
+ SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "c_geometry_sc_card" "', argument " "7"" of type '" "nec_float""'");
7208
+ }
7209
+ arg7 = static_cast< nec_float >(val7);
7210
+ ecode8 = SWIG_AsVal_double(swig_obj[7], &val8);
7211
+ if (!SWIG_IsOK(ecode8)) {
7212
+ SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "c_geometry_sc_card" "', argument " "8"" of type '" "nec_float""'");
7213
+ }
7214
+ arg8 = static_cast< nec_float >(val8);
7215
+ {
7216
+ try {
7217
+ (arg1)->sc_card(arg2,arg3,arg4,arg5,arg6,arg7,arg8);
7218
+ }
7219
+ catch (nec_exception* nex) {
7220
+ SWIG_exception(SWIG_RuntimeError,nex->get_message().c_str());
7221
+ }
7222
+ catch (const char* message) {
7223
+ SWIG_exception(SWIG_RuntimeError,message);
7224
+ }
7225
+ catch (...) {
7226
+ SWIG_exception(SWIG_RuntimeError,"Unknown exception");
7227
+ }
7228
+ }
7229
+ resultobj = SWIG_Py_Void();
7230
+ return resultobj;
7231
+ fail:
7232
+ return NULL;
7233
+ }
7234
+
7235
+
7145
7236
  SWIGINTERN PyObject *_wrap_c_geometry_gx_card(PyObject *self, PyObject *args) {
7146
7237
  PyObject *resultobj = 0;
7147
7238
  c_geometry *arg1 = (c_geometry *) 0 ;
@@ -12210,6 +12301,7 @@ static PyMethodDef SwigMethods[] = {
12210
12301
  { "c_geometry_reflect", _wrap_c_geometry_reflect, METH_VARARGS, NULL},
12211
12302
  { "c_geometry_generate_cylindrical_structure", _wrap_c_geometry_generate_cylindrical_structure, METH_VARARGS, NULL},
12212
12303
  { "c_geometry_sp_card", _wrap_c_geometry_sp_card, METH_VARARGS, NULL},
12304
+ { "c_geometry_sc_card", _wrap_c_geometry_sc_card, METH_VARARGS, NULL},
12213
12305
  { "c_geometry_gx_card", _wrap_c_geometry_gx_card, METH_VARARGS, NULL},
12214
12306
  { "c_geometry_move", _wrap_c_geometry_move, METH_VARARGS, NULL},
12215
12307
  { "c_geometry_arbitrary_shaped_patch", _wrap_c_geometry_arbitrary_shaped_patch, METH_VARARGS, NULL},
@@ -0,0 +1,135 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Basic PyNEC usage example — demonstrates:
4
+
5
+ 1. Creating a dipole antenna with geo.wire() (Issue #22: wire args)
6
+ 2. Getting feedpoint impedance (Issue #22: feedpoint impedance)
7
+ 3. Getting structure currents (Issue #22: segment currents)
8
+ 4. Using sc_card with multiple_patch (Issue #28: SC card)
9
+
10
+ Run: python basic_usage.py
11
+ """
12
+
13
+ import numpy as np
14
+ from PyNEC import *
15
+
16
+ # ── 1. Wire arguments ──────────────────────────────────────────────────
17
+ #
18
+ # geo.wire(tag_id, segment_count,
19
+ # xw1, yw1, zw1, # start point (meters)
20
+ # xw2, yw2, zw2, # end point (meters)
21
+ # rad, # wire radius (meters)
22
+ # rdel=1.0, # segment length ratio (1.0 = uniform)
23
+ # rrad=1.0) # radius taper ratio (1.0 = no taper)
24
+ #
25
+ # Rule of thumb: use 12-20 segments per wavelength.
26
+
27
+ context = nec_context()
28
+ geo = context.get_geometry()
29
+
30
+ freq_mhz = 300.0 # 300 MHz
31
+ wavelength = 300.0 / freq_mhz
32
+ length = wavelength / 2 # half-wave dipole
33
+ radius = length / 1000
34
+
35
+ geo.wire(
36
+ tag_id=1,
37
+ segment_count=21,
38
+ xw1=0,
39
+ yw1=-length / 2,
40
+ zw1=0, # bottom end
41
+ xw2=0,
42
+ yw2=+length / 2,
43
+ zw2=0, # top end
44
+ rad=radius,
45
+ )
46
+
47
+ context.geometry_complete(0)
48
+ context.fr_card(0, 1, freq_mhz, 0)
49
+
50
+ # Excite segment 11 (center)
51
+ context.ex_card(0, 1, 11, 0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0)
52
+
53
+ # Request radiation pattern (triggers calculation)
54
+ context.rp_card(0, 90, 1, 0, 5, 0, 0, 0.0, 90.0, 1.0, 1.0, 0.0, 0.0)
55
+
56
+
57
+ # ── 2. Feedpoint impedance ─────────────────────────────────────────────
58
+ #
59
+ # get_input_parameters(index) returns a nec_antenna_input object.
60
+ # Available methods:
61
+ # .get_impedance() -> [complex, ...] impedance at each source
62
+ # .get_current() -> [complex, ...] current at each source
63
+ # .get_voltage() -> [complex, ...] voltage at each source
64
+ # .get_power() -> [float, ...] power at each source
65
+ # .get_frequency() -> float frequency in Hz
66
+ # .get_tag() -> [int, ...] segment tag numbers
67
+ # .get_segment() -> [int, ...] segment numbers
68
+
69
+ ipt = context.get_input_parameters(0)
70
+ Z = ipt.get_impedance()[0]
71
+ V = ipt.get_voltage()[0]
72
+ I = ipt.get_current()[0]
73
+ P = ipt.get_power()[0]
74
+
75
+ print("── Feedpoint ──")
76
+ print(f" Frequency: {ipt.get_frequency():.1f} MHz")
77
+ print(f" Impedance: {Z.real:.1f} + {Z.imag:+.1f}j Ω")
78
+ print(
79
+ f" VSWR (50Ω): {abs((1 + abs((Z - 50) / (Z + 50))) / (1 - abs((Z - 50) / (Z + 50)))):.3f}"
80
+ )
81
+ print()
82
+
83
+
84
+ # ── 3. Structure currents ──────────────────────────────────────────────
85
+ #
86
+ # get_structure_currents(index) returns a nec_structure_currents object.
87
+ # Available methods:
88
+ # .get_current() -> [complex, ...] currents (A)
89
+ # .get_current_segment_number() -> [int, ...] segment numbers
90
+ # .get_current_segment_tag() -> [int, ...] tag numbers
91
+ # .get_current_segment_center_x() -> [float, ...] x coords (m)
92
+ # .get_current_segment_center_y() -> [float, ...] y coords (m)
93
+ # .get_current_segment_center_z() -> [float, ...] z coords (m)
94
+ # .get_current_segment_length() -> [float, ...] segment lengths (m)
95
+ # .get_n() -> int total wire segments
96
+ # .get_m() -> int total patches
97
+ #
98
+ # Also for charge densities: get_q_density(), get_q_density_segment_*()
99
+ # And for patches: get_patch_number(), get_patch_center_*(), get_patch_e_*()
100
+
101
+ sc = context.get_structure_currents(0)
102
+ currents = sc.get_current()
103
+ tags = sc.get_current_segment_tag()
104
+
105
+ print("── Segment currents (first 5) ──")
106
+ for i in range(min(5, len(currents))):
107
+ c = currents[i]
108
+ mag = abs(c)
109
+ phase = np.angle(c, deg=True)
110
+ print(f" seg {i:2d} tag={tags[i]:2d} |I|={mag:.4f} A ∠={phase:+.1f}°")
111
+ print()
112
+
113
+
114
+ # ── 4. SC card with multiple_patch ─────────────────────────────────────
115
+ #
116
+ # multiple_patch() wraps the SM card. Immediately after it, you can add
117
+ # SC continuation cards via geo.sc_card() to define a row of patches.
118
+ # This example is adapted from necpp/tests/test_multiple_sc_cards.py.
119
+ #
120
+ # geo.multiple_patch(nx, ny,
121
+ # ax1, ay1, az1, # corner 1
122
+ # ax2, ay2, az2, # corner 2
123
+ # ax3, ay3, az3) # corner 3
124
+ #
125
+ # geo.sc_card(i2,
126
+ # x3, y3, z3, # corner 3 of next patch
127
+ # x4, y4, z4) # corner 4 of next patch
128
+
129
+ print("── SC card example ──")
130
+ ctx2 = nec_context()
131
+ g2 = ctx2.get_geometry()
132
+
133
+ g2.sp_card(3, 0.019, -0.001424, 0.078830, 0.019, 0.001424, 0.078830)
134
+ g2.sc_card(3, 0.019, 0.001424, 0.076180, 0.019, -0.001424, 0.076180)
135
+ print(" SP + SC card added successfully.")