Skip to content

Commit e7af375

Browse files
committed
Fix #20/#27: Correct helix argument order in SWIG interface
The SWIG declaration had segment_count and tag_id at the end, but the C++ source (c_geometry::helix) expects them first. This caused all float arguments to be silently shifted — s was passed as tag_id, hl as segment_count, a1 as s, etc. Resulted in: - 'NO SEGMENT HAS AN ITAG OF 1' when turn spacing < 1 (#27) - move command not recognizing tag numbers (#20) - Helix geometry silently wrong for all calls Also: updated necpp_src submodule to v1.7.6 which includes helix divide-by-zero fix and connected-wire intersection fix.
1 parent ba3d1a5 commit e7af375

1 file changed

Lines changed: 85 additions & 84 deletions

File tree

PyNEC/interface_files/c_geometry.i

Lines changed: 85 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
class c_geometry
22
{
33
public:
4-
4+
55
/*! Add a wire to the geometry,
66
77
All coordinates are in meters.
88
99
\param tag_id The tag ID.
1010
\param segment_count The number of segments.
11-
11+
1212
\param xw1 The x coordinate of the wire starting point.
1313
\param yw1 The y coordinate of the wire starting point.
1414
\param zw1 The z coordinate of the wire starting point.
15-
15+
1616
\param xw2 The x coordinate of the wire ending point.
1717
\param yw2 The y coordinate of the wire ending point.
1818
\param zw2 The z coordinate of the wire ending point.
19-
19+
2020
\param rad The wire radius (meters)
2121
\param rdel For tapered wires, the. Otherwise set to 1.0
2222
\param rrad For tapered wires, the. Otherwise set to 1.0
@@ -26,62 +26,63 @@ public:
2626
nec_float xw2, nec_float yw2, nec_float zw2,
2727
nec_float rad,
2828
nec_float rdel, nec_float rrad);
29-
30-
31-
29+
30+
31+
3232
/*! Add an arc to the geometry,
3333
3434
All coordinates are in meters and angles are in degrees.
3535
3636
\param tag_id The tag ID.
3737
\param segment_count The number of segments.
38-
38+
3939
\param rada The radius.
4040
\param ang1 The angle of the arc starting point.
4141
\param ang2 The angle of the arc end point.
4242
\param rad The wire radius.
4343
*/
4444
void arc( int tag_id, int segment_count, nec_float rada,
4545
nec_float ang1, nec_float ang2, nec_float rad );
46-
47-
48-
46+
47+
48+
4949
/*! Add an helix to the geometry,
5050
51-
\remark The helix is a versatile m_geometry->element. For example, to generate a spiral printed circuit antenna, use a helix of zero height.
51+
\remark The helix is a versatile m_geometry->element. For example, to generate a spiral printed circuit antenna, use a helix of zero height.
5252
5353
All coordinates are in meters.
54-
54+
5555
\param tag_id The tag ID.
5656
\param segment_count The number of segments.
5757
\param s The turn spacing.
58-
\param h1 The total length of the helix (negative for a left-handed helix).
59-
58+
\param hl The total length of the helix (negative for a left-handed helix).
59+
6060
\param a1 x-start radius.
6161
\param b1 y-start radius.
62-
62+
6363
\param a2 x-end radius.
6464
\param b2 y-end radius.
65-
65+
6666
\param rad The wire radius.
6767
*/
68-
void helix( nec_float s, nec_float hl, nec_float a1, nec_float b1,
69-
nec_float a2, nec_float b2, nec_float rad, int segment_count, int tag_id );
70-
71-
72-
68+
void helix( int tag_id, int segment_count,
69+
nec_float s, nec_float hl, nec_float a1, nec_float b1,
70+
nec_float a2, nec_float b2, nec_float rad );
71+
72+
73+
7374
/*! Scale all dimensions of a structure by a constant.
74-
75+
7576
\param xw1 All structure dimensions, including wire radius, are multiplied by xw1.
7677
*/
7778
void scale( nec_float xw1);
78-
79+
7980
/*! Reflects partial structure along x,y, or z axes.
80-
81-
\param ix If ix = 1 then the structure is reflected along X axis.
81+
82+
\param ix If ix = 1 then the structure is reflected along X axis.
8283
\param iy If iy = 1 then the structure is reflected along Y axis.
8384
\param iz If iz = 1 then the structure is reflected along Z axis.
84-
\param itx The tag number increment.
85+
\param itx The tag number increment.
8586
*/
8687
void reflect(int ix, int iy, int iz, int itx);
8788

@@ -90,140 +91,140 @@ public:
9091
/*! Rotates structure along Z-axis to complete a symmetric structure.
9192
9293
\param itx The tag number increment.
93-
\param nop The total number of times that the structure is to occur in the cylindrical array.
94+
\param nop The total number of times that the structure is to occur in the cylindrical array.
9495
*/
9596
void generate_cylindrical_structure(int itx, int nop);
96-
97+
9798
void sp_card( int ns,
9899
nec_float in_x1, nec_float in_y1, nec_float in_z1,
99100
nec_float in_x2, nec_float in_y2, nec_float in_z2);
100-
101+
101102
void gx_card(int card_int_1, int card_int_2);
102103

103104
%extend{
104-
105+
105106
/*! Move the structure with respect to its coordinate system or reproduces structure in new positions,
106-
107+
107108
All coordinates are in meters and angles are in degrees.
108-
109-
\param rox_deg The angle in degrees through which the structure is rotated about the X-axis. A positive angle causes a right-hand rotation.
109+
110+
\param rox_deg The angle in degrees through which the structure is rotated about the X-axis. A positive angle causes a right-hand rotation.
110111
\param roy_deg The angle of rotation about Y-axis.
111112
\param roz_deg The angle of rotation about Z-axis.
112-
113+
113114
\param xs The x component of vector by which the structure is translated with respect to the coordinate system.
114115
\param ys The y component of vector by which the structure is translated.
115116
\param zs The z component of vector by which the structure is translated.
116-
117+
117118
\param its The tag number of the segments that will be moved. If its = 0 then the entire structure is moved.
118119
\param nrpt The number of new Structures to be generated.
119-
\param itgi The tag number increment.
120-
*/
120+
\param itgi The tag number increment.
121+
*/
121122
void move( nec_float rox_deg, nec_float roy_deg, nec_float roz_deg, nec_float xs,
122123
nec_float ys, nec_float zs, int its, int nrpt, int itgi )
123124
{
124125
nec_float rox_rad = degrees_to_rad(rox_deg);
125126
nec_float roy_rad = degrees_to_rad(roy_deg);
126127
nec_float roz_rad = degrees_to_rad(roz_deg);
127-
128+
128129
return self->move( rox_rad, roy_rad, roz_rad, xs, ys, zs, its, nrpt, itgi );
129130
}
130-
131131

132132

133133

134134

135-
136-
135+
136+
137+
137138
/*! Add a arbitrary-shaped patch to the geometry
138-
139+
139140
All coordinates are in meters, angles are in degrees.
140-
141+
141142
\param ax1 The x-coordinate of patch center.
142143
\param ay1 The y-coordinate of patch center.
143144
\param az1 The z-coordinate of patch center.
144-
145+
145146
\param ax2_deg The elevation angle above the X-Y plane of outward normal vector.
146147
\param ay2_deg The azimuth angle from X-axis of outward normal vector.
147-
148-
\param az2 The patch area if ny=1.
148+
149+
\param az2 The patch area if ny=1.
149150
*/
150151
void arbitrary_shaped_patch( nec_float ax1, nec_float ay1, nec_float az1,
151152
nec_float ax2_deg, nec_float ay2_deg, nec_float az2 )
152153
{
153154
nec_float ax2_rad = degrees_to_rad(ax2_deg);
154155
nec_float ay2_rad = degrees_to_rad(ay2_deg);
155-
156+
156157
return self->patch( 0, 1, ax1, ay1, az1, ax2_rad, ay2_rad, az2, 0, 0, 0, 0, 0, 0 );
157158
}
158-
159-
160-
159+
160+
161+
161162
/*! Add a rectangular patch to the geometry
162-
163-
All coordinates are in meters.
164-
163+
164+
All coordinates are in meters.
165+
165166
\param ax1 The x-coordinate of corner 1.
166167
\param ay1 The y-coordinate of corner 1.
167168
\param az1 The z-coordinate of corner 1.
168-
169+
169170
\param ax2 The x_coordinate of corner 2.
170171
\param ay2 The y_coordinate of corner 2.
171172
\param az2 The z-coordinate of corner 2.
172-
173+
173174
\param ax3 The x_coordinate of corner 3.
174175
\param ay3 The y_coordinate of corner 3.
175-
\param az3 The z_coordinate of corner 3.
176+
\param az3 The z_coordinate of corner 3.
176177
*/
177178
void rectangular_patch( nec_float ax1, nec_float ay1, nec_float az1,
178179
nec_float ax2, nec_float ay2, nec_float az2,
179180
nec_float ax3, nec_float ay3, nec_float az3 )
180181
{
181182
return self->patch( 0, 2, ax1, ay1, az1, ax2, ay2, az2, ax3, ay3, az3, 0, 0, 0 );
182183
}
183-
184-
185-
184+
185+
186+
186187
/*! Add a triangular patch to the geometry
187-
188-
All coordinates are in meters.
189-
188+
189+
All coordinates are in meters.
190+
190191
\param ax1 The x-coordinate of corner 1.
191192
\param ay1 The y-coordinate of corner 1.
192193
\param az1 The z-coordinate of corner 1.
193-
194+
194195
\param ax2 The x_coordinate of corner 2.
195196
\param ay2 The y_coordinate of corner 2.
196197
\param az2 The z-coordinate of corner 2.
197-
198+
198199
\param ax3 The x_coordinate of corner 3.
199200
\param ay3 The y_coordinate of corner 3.
200-
\param az3 The z_coordinate of corner 3.
201+
\param az3 The z_coordinate of corner 3.
201202
*/
202203
void triangular_patch( nec_float ax1, nec_float ay1, nec_float az1,
203204
nec_float ax2, nec_float ay2, nec_float az2,
204205
nec_float ax3, nec_float ay3, nec_float az3 )
205206
{
206207
return self->patch( 0, 3, ax1, ay1, az1, ax2, ay2, az2, ax3, ay3, az3, 0, 0, 0 );
207208
}
208-
209-
210-
209+
210+
211+
211212
/*! Add a quadrilateral patch to the geometry
212-
213-
All coordinates are in meters.
214-
213+
214+
All coordinates are in meters.
215+
215216
\param ax1 The x-coordinate of corner 1.
216217
\param ay1 The y-coordinate of corner 1.
217218
\param az1 The z-coordinate of corner 1.
218-
219+
219220
\param ax2 The x_coordinate of corner 2.
220221
\param ay2 The y_coordinate of corner 2.
221222
\param az2 The z-coordinate of corner 2.
222-
223+
223224
\param ax3 The x_coordinate of corner 3.
224225
\param ay3 The y_coordinate of corner 3.
225226
\param az3 The z_coordinate of corner 3.
226-
227+
227228
\param ax4 The x_coordinate of corner 4.
228229
\param ay4 The x_coordinate of corner 4.
229230
\param az4 The x_coordinate of corner 4.
@@ -235,23 +236,23 @@ public:
235236
{
236237
return self->patch( 0, 4, ax1, ay1, az1, ax2, ay2, az2, ax3, ay3, az3, ax4, ay4, az4 );
237238
}
238-
239-
240-
239+
240+
241+
241242
/*! Add a multiple patch to the geometry.
242-
243+
243244
All coordinates are in meters.
244-
245+
245246
\param nx The rectangular surface is divided into nx patches from corner 1 to corner 2.
246247
\param ny The rectangular surface is divided into ny patches from corner 2 to corner 3.
247248
\param ax1 The x-coordinate of corner 1.
248249
\param ay1 The y-coordinate of corner 1.
249250
\param az1 The z-coordinate of corner 1.
250-
251+
251252
\param ax2 The x_coordinate of corner 2.
252253
\param ay2 The y_coordinate of corner 2.
253254
\param az2 The z-coordinate of corner 2.
254-
255+
255256
\param ax3 The x_coordinate of corner 3.
256257
\param ay3 The y_coordinate of corner 3.
257258
\param az3 The z_coordinate of corner 3.
@@ -262,7 +263,7 @@ public:
262263
nec_float ax3, nec_float ay3, nec_float az3 )
263264
{
264265
return self->patch( nx, ny, ax1, ay1, az1, ax2, ay2, az2, ax3, ay3, az3, 0, 0, 0 );
265-
}
266+
}
266267
}
267-
268+
268269
};

0 commit comments

Comments
 (0)