1 #ifndef __nec_context__
2 #define __nec_context__
25 #include "math_util.h"
26 #include "matrix_algebra.h"
27 #include "electromag.h"
28 #include "nec_radiation_pattern.h"
29 #include "nec_results.h"
30 #include "nec_structure_currents.h"
31 #include "nec_output.h"
32 #include "nec_ground.h"
33 #include "c_plot_card.h"
37 enum excitation_return
39 FREQ_PRINT_NORMALIZATION = 0,
40 FREQ_LOOP_CONTINUE = 1,
41 FREQ_LOOP_CARD_CONTINUE = 2
82 double get_gain(
int freq_index,
int theta_index,
int phi_index) {
84 if (NULL == rp)
return -999.0;
88 double get_gain_max(
int freq_index = 0) {
90 if (NULL == rp)
return -999.0;
91 return rp->get_gain_max();
94 double get_gain_min(
int freq_index = 0) {
96 if (NULL == rp)
return -999.0;
97 return rp->get_gain_min();
100 double get_gain_mean(
int freq_index = 0) {
102 if (NULL == rp)
return -999.0;
103 return rp->get_gain_mean();
106 double get_gain_sd(
int freq_index = 0) {
108 if (NULL == rp)
return -999.0;
109 return rp->get_gain_sd();
113 double get_gain_rhcp_max(
int freq_index = 0) {
115 if (NULL == rp)
return -999.0;
116 return rp->get_gain_rhcp_max();
119 double get_gain_rhcp_min(
int freq_index = 0) {
121 if (NULL == rp)
return -999.0;
122 return rp->get_gain_rhcp_min();
125 double get_gain_rhcp_mean(
int freq_index = 0) {
127 if (NULL == rp)
return -999.0;
128 return rp->get_gain_rhcp_mean();
131 double get_gain_rhcp_sd(
int freq_index = 0) {
133 if (NULL == rp)
return -999.0;
134 return rp->get_gain_rhcp_sd();
138 double get_gain_lhcp_max(
int freq_index = 0) {
140 if (NULL == rp)
return -999.0;
141 return rp->get_gain_lhcp_max();
144 double get_gain_lhcp_min(
int freq_index = 0) {
146 if (NULL == rp)
return -999.0;
147 return rp->get_gain_lhcp_min();
150 double get_gain_lhcp_mean(
int freq_index = 0) {
152 if (NULL == rp)
return -999.0;
153 return rp->get_gain_lhcp_mean();
156 double get_gain_lhcp_sd(
int freq_index = 0) {
158 if (NULL == rp)
return -999.0;
159 return rp->get_gain_lhcp_sd();
167 if (NULL == ipt)
return -999.0;
168 vector<nec_complex>& imp(ipt->get_impedance());
169 return imp.back().real();
174 if (NULL == ipt)
return -999.0;
175 vector<nec_complex>& imp(ipt->get_impedance());
176 return imp.back().imag();
235 void set_isave(
int in_isave)
265 inline void set_results_format(
enum RESULT_FORMAT result_format)
267 m_results.m_result_format = result_format;
270 inline void set_gain_only(
bool flag)
294 em::constants::permittivity = permittivity;
295 em::constants::permeability = permeability;
315 void wire(
int tag_id,
int segment_count,
316 nec_float xw1, nec_float yw1, nec_float zw1,
317 nec_float xw2, nec_float yw2, nec_float zw2,
318 nec_float rad, nec_float rdel, nec_float rrad);
321 nec_float x1, nec_float y1, nec_float z1,
322 nec_float x2, nec_float y2, nec_float z2);
324 void sc_card(
int i2,
325 nec_float x3, nec_float y3, nec_float z3,
326 nec_float x4, nec_float y4, nec_float z4);
328 void gx_card(
int i1,
int i2);
330 void move( nec_float rox, nec_float roy, nec_float roz, nec_float xs,
331 nec_float ys, nec_float zs,
int its,
int nrpt,
int itgi );
344 void arc(
int tag_id,
int segment_count, nec_float rada,
345 nec_float ang1, nec_float ang2, nec_float rad );
364 void helix(
int tag_id,
int segment_count, nec_float s, nec_float hl, nec_float a1, nec_float b1,
365 nec_float a2, nec_float b2, nec_float rad);
377 void fr_card(
int in_ifrq,
int in_nfrq, nec_float in_freq_mhz, nec_float in_del_freq);
397 void ld_card(
int itmp1,
int itmp2,
int itmp3,
int itmp4, nec_float tmp1, nec_float tmp2, nec_float tmp3);
421 void gn_card(
int ground_type,
int rad_wire_count, nec_float tmp1, nec_float tmp2, nec_float tmp3, nec_float tmp4, nec_float tmp5, nec_float tmp6);
441 void ex_card(
enum excitation_type itmp1,
int itmp2,
int itmp3,
int itmp4, nec_float tmp1, nec_float tmp2, nec_float tmp3, nec_float tmp4, nec_float tmp5, nec_float tmp6);
464 void tl_card(
int itmp1,
int itmp2,
int itmp3,
int itmp4, nec_float tmp1, nec_float tmp2, nec_float tmp3, nec_float tmp4, nec_float tmp5, nec_float tmp6);
481 void nt_card(
int itmp1,
int itmp2,
int itmp3,
int itmp4, nec_float tmp1, nec_float tmp2, nec_float tmp3, nec_float tmp4, nec_float tmp5, nec_float tmp6);
501 void gd_card(nec_float tmp1, nec_float tmp2, nec_float tmp3, nec_float tmp4);
570 int n_theta,
int n_phi,
571 int output_format,
int normalization,
int D,
int A,
572 nec_float theta0, nec_float phi0, nec_float delta_theta, nec_float delta_phi,
573 nec_float radial_distance, nec_float gain_norm);
576 void pt_card(
int itmp1,
int itmp2,
int itmp3,
int itmp4);
580 void pq_card(
int itmp1,
int itmp2,
int itmp3,
int itmp4);
593 void ne_card(
int itmp1,
int itmp2,
int itmp3,
int itmp4, nec_float tmp1, nec_float tmp2, nec_float tmp3, nec_float tmp4, nec_float tmp5, nec_float tmp6);
600 void nh_card(
int itmp1,
int itmp2,
int itmp3,
int itmp4, nec_float tmp1, nec_float tmp2, nec_float tmp3, nec_float tmp4, nec_float tmp5, nec_float tmp6);
607 void cp_card(
int itmp1,
int itmp2,
int itmp3,
int itmp4);
613 void pl_card(
const char* ploutput_filename,
int itmp1,
int itmp2,
int itmp3,
int itmp4);
623 void write_results(ostream& os)
641 void simulate(
bool far_field_flag =
false);
655 int iptaq, iptaqf, iptaqt;
660 int iptag, iptagf, iptagt;
675 nec_float thetis, phiss;
687 nec_float wavelength;
693 int icase, npblk, nlast;
694 int nbbx, npbx, nlbx, nbbl, npbl, nlbl;
718 int_array ivqd, source_segment_array, iqds;
719 int nvqd, voltage_source_count, nqds;
723 int masym, neq, npeq, neq2, network_count, ntsol, nprint;
727 nec_float input_power, network_power_loss;
731 enum excitation_type m_excitation_type;
733 int m_rp_output_format;
734 int m_rp_normalization;
736 int m_near, nfeh, nrx, nry, nrz, nth, nph, ipd, iavp;
737 nec_float thets, phis, dth, dph, rfld, gnor;
738 nec_float xpr6, structure_power_loss, xnr, ynr, znr, dxnr, dynr, dznr;
742 int ind1, indd1, ind2, indd2;
745 nec_float m_s, m_b, xj, yj, zj, cabj, sabj, salpj;
747 nec_float t1xj, t1yj, t1zj, t2xj, t2yj, t2zj;
748 nec_complex exk, eyk, ezk, exs, eys, ezs, exc, eyc, ezc;
756 nec_float xo, yo, zo, sn, xsn, ysn;
763 nec_float zpka, rhks;
769 void gfld(nec_float rho, nec_float phi, nec_float rz,
770 nec_complex *eth, nec_complex *epi,
771 nec_complex *erd,
bool space_only, nec_float _wavelength );
773 void ffld(nec_float thet, nec_float phi,
774 nec_complex *eth, nec_complex *eph, nec_float _wavelength );
781 void ne_nh_card(
int in_nfeh,
int itmp1,
int itmp2,
int itmp3,
int itmp4, nec_float tmp1, nec_float tmp2, nec_float tmp3, nec_float tmp4, nec_float tmp5, nec_float tmp6);
784 void print_freq_int_krnl(
788 bool using_extended_kernel);
790 void antenna_env(
void);
793 void print_structure_currents(
char *pattype,
int iptflg,
int iptflq,
int iptag,
int iptagf,
int iptagt,
int iptaq,
794 int iptaqf,
int iptaqt);
798 void calculate_network_data(
void);
799 void print_network_data(
void);
800 void print_norm_rx_pattern();
801 void print_input_impedance();
802 void print_power_budget(
void);
803 void structure_segment_loading();
806 enum excitation_return
807 excitation_loop(
int in_freq_loop_state,
int mhz);
809 void setup_excitation();
814 int inc, processing_state, isave;
818 nec_float impedance_norm_factor;
820 nec_float xpr1, xpr2, xpr3, xpr4, xpr5, xpr7;
826 void cmset(int64_t nrow,
complex_array& in_cm, nec_float rkhx);
827 void compute_matrix_ss(
int j1,
int j2,
int im1,
int im2,
829 void cmsw(
int j1,
int j2,
int i1,
int i2,
complex_array& in_cm,
834 void cmww(
int j,
int i1,
int i2,
complex_array& in_cm, int64_t nr,
838 void efld(nec_float xi, nec_float yi, nec_float zi, nec_float ai,
bool on_source_segment);
839 void eksc(nec_float s, nec_float z, nec_float rh, nec_float xk,
int ij,
840 nec_complex *ezs, nec_complex *ers, nec_complex *ezc,
841 nec_complex *erc, nec_complex *ezk, nec_complex *erk);
842 void ekscx(nec_float bx, nec_float s, nec_float z, nec_float rhx, nec_float xk,
843 int ij,
int inx1,
int inx2, nec_complex *ezs,
844 nec_complex *ers, nec_complex *ezc, nec_complex *erc,
845 nec_complex *ezk, nec_complex *erk);
846 void etmns(nec_float p1, nec_float p2, nec_float p3, nec_float p4, nec_float p5,
847 nec_float p6, nec_float incident_amplitude,
enum excitation_type excite_type,
complex_array& e);
849 void fblock(
int nrow,
int ncol,
int imax,
int ipsym );
851 void gf(nec_float zk, nec_float *co, nec_float *si);
852 void gh(nec_float zk, nec_float *hr, nec_float *hi);
853 void gx(nec_float zz, nec_float rh, nec_float xk,
854 nec_complex *gz, nec_complex *gzp);
855 void gxx(nec_float zz, nec_float rh, nec_float a, nec_float a2, nec_float xk,
856 int ira, nec_complex *g1, nec_complex *g1p, nec_complex *g2,
857 nec_complex *g2p, nec_complex *g3, nec_complex *gzp);
858 void hfk(nec_float el1, nec_float el2, nec_float rhk,
859 nec_float zpkx, nec_float *sgr, nec_float *sgi);
860 void hintg(nec_float xi, nec_float yi, nec_float zi);
861 void hsfld(nec_float xi, nec_float yi, nec_float zi, nec_float ai);
862 void hsflx(nec_float s, nec_float rh, nec_float zpx, nec_complex *hpk,
863 nec_complex *hps, nec_complex *hpc);
865 void intx(nec_float el1, nec_float el2, nec_float b,
int ij,
866 nec_float *sgr, nec_float *sgi);
868 void nefld(nec_float xob, nec_float yob, nec_float zob, nec_complex *ex,
869 nec_complex *ey, nec_complex *ez);
872 void nhfld(nec_float xob, nec_float yob, nec_float zob, nec_complex *hx,
873 nec_complex *hy, nec_complex *hz);
874 void pcint(nec_float xi, nec_float yi, nec_float zi, nec_float cabi,
876 void impedance_print(
int in1,
int in2,
int in3, nec_float fl1, nec_float fl2,
877 nec_float fl3, nec_float fl4, nec_float fl5, nec_float fl6,
const char *ia);
881 void rom2(nec_float a, nec_float b,
complex_array& sum, nec_float dmin);
883 void solgf(nec_complex *a, nec_complex *b, nec_complex *c,
884 nec_complex *d, nec_complex *xy,
int *ip,
int np,
int n1,
885 int n,
int mp,
int m1,
int m,
int n1c,
int n2c,
int n2cz);
886 void unere(nec_float xob, nec_float yob, nec_float zob,
bool ground_reflection);
887 nec_complex zint(nec_float sigl, nec_float rolam);
889 void init_voltage_sources();
nec_output_file m_output
an object to pipe output through...
Definition: nec_context.h:644
nec_near_field_pattern * get_near_field_pattern(const long index)
Get near field pattern results.
Definition: nec_results.h:900
nec_antenna_input * get_input_parameters(int index)
Get Antenna Input Parameter Results.
Definition: nec_context.h:184
static nec_float benchmark()
Benchmark the libnecpp engine. A score of 100 is roughly an Athlon XP 1800.
Definition: nec_context.cpp:140
nec_radiation_pattern * get_radiation_pattern(const long index)
Get radiation pattern results.
Definition: nec_results.h:870
void simulate(bool far_field_flag=false)
Start a simulation.
Definition: nec_context.cpp:990
void nh_card(int itmp1, int itmp2, int itmp3, int itmp4, nec_float tmp1, nec_float tmp2, nec_float tmp3, nec_float tmp4, nec_float tmp5, nec_float tmp6)
Definition: nec_context.cpp:891
void rp_card(int calc_mode, int n_theta, int n_phi, int output_format, int normalization, int D, int A, nec_float theta0, nec_float phi0, nec_float delta_theta, nec_float delta_phi, nec_float radial_distance, nec_float gain_norm)
Standard radiation pattern parameters.
Definition: nec_context.cpp:805
void xq_card(int itmp1)
Definition: nec_context.cpp:714
void gd_card(nec_float tmp1, nec_float tmp2, nec_float tmp3, nec_float tmp4)
Definition: nec_context.cpp:758
nec_structure_excitation * get_structure_excitation(const long index)
Get structure excitation results.
Definition: nec_results.h:890
void all_jobs_completed()
Definition: nec_context.h:619
void calc_prepare()
After the geometry has been specified, this function prepares for calculations.
Definition: nec_context.cpp:95
void helix(int tag_id, int segment_count, nec_float s, nec_float hl, nec_float a1, nec_float b1, nec_float a2, nec_float b2, nec_float rad)
Add an helix to the geometry,.
Definition: nec_context.cpp:354
nec_norm_rx_pattern * get_norm_rx_pattern(const long index)
Get normalized receiving pattern results.
Definition: nec_results.h:860
void pq_card(int itmp1, int itmp2, int itmp3, int itmp4)
Definition: nec_context.cpp:864
void wire(int tag_id, int segment_count, nec_float xw1, nec_float yw1, nec_float zw1, nec_float xw2, nec_float yw2, nec_float zw2, nec_float rad, nec_float rdel, nec_float rrad)
Definition: nec_context.cpp:284
void gfld(nec_float rho, nec_float phi, nec_float rz, nec_complex *eth, nec_complex *epi, nec_complex *erd, bool space_only, nec_float _wavelength)
gfld computes the radiated field including ground wave.
Definition: nec_context.cpp:6887
real_array cir
coefficients of the sine terms in the current interpolation functions
Definition: nec_context.h:703
double get_impedance_imag(int freq_index=0)
Impedance: Imaginary Part.
Definition: nec_context.h:172
Definition: nec_structure_currents.h:30
nec_float get_power_gain(int theta_index, int phi_index) const
Get a total power gain from the radiation pattern.
Definition: nec_radiation_pattern.h:366
Definition: nec_output.h:56
void gn_card(int ground_type, int rad_wire_count, nec_float tmp1, nec_float tmp2, nec_float tmp3, nec_float tmp4, nec_float tmp5, nec_float tmp6)
Ground parameters under the antenna.
Definition: nec_context.cpp:454
double get_gain(int freq_index, int theta_index, int phi_index)
Get the maximum gain in dB.
Definition: nec_context.h:82
nec_structure_currents * get_structure_currents(const long index)
Get structure currents results.
Definition: nec_results.h:910
void medium_parameters(nec_float permittivity, nec_float permeability)
Definition: nec_context.h:293
nec_structure_excitation * get_structure_excitation(int index)
Get structure excitation results.
Definition: nec_context.h:211
nec_structure_currents * get_structure_currents(int index)
Get structure currents results.
Definition: nec_context.h:229
void pt_card(int itmp1, int itmp2, int itmp3, int itmp4)
Definition: nec_context.cpp:848
void fr_card(int in_ifrq, int in_nfrq, nec_float in_freq_mhz, nec_float in_del_freq)
Definition: nec_context.cpp:369
void ex_card(enum excitation_type itmp1, int itmp2, int itmp3, int itmp4, nec_float tmp1, nec_float tmp2, nec_float tmp3, nec_float tmp4, nec_float tmp5, nec_float tmp6)
Definition: nec_context.cpp:483
void pl_card(const char *ploutput_filename, int itmp1, int itmp2, int itmp3, int itmp4)
Definition: nec_context.cpp:972
void ne_card(int itmp1, int itmp2, int itmp3, int itmp4, nec_float tmp1, nec_float tmp2, nec_float tmp3, nec_float tmp4, nec_float tmp5, nec_float tmp6)
Definition: nec_context.cpp:886
Definition: nec_results.h:797
void tl_card(int itmp1, int itmp2, int itmp3, int itmp4, nec_float tmp1, nec_float tmp2, nec_float tmp3, nec_float tmp4, nec_float tmp5, nec_float tmp6)
Definition: nec_context.cpp:598
nec_antenna_input * get_antenna_input(const long index)
Get antenna input parameter results.
Definition: nec_results.h:880
Definition: nec_results.h:671
void ld_card(int itmp1, int itmp2, int itmp3, int itmp4, nec_float tmp1, nec_float tmp2, nec_float tmp3)
Definition: nec_context.cpp:387
int iptflg
pt card flags...
Definition: nec_context.h:659
Definition: c_plot_card.h:44
complex_array current_vector
coefficients of the cosine terms in the current interpolation functions
Definition: nec_context.h:704
void arc(int tag_id, int segment_count, nec_float rada, nec_float ang1, nec_float ang2, nec_float rad)
Definition: nec_context.cpp:332
void set_extended_thin_wire_kernel(bool ekflag)
Definition: nec_context.cpp:927
Definition: nec_results.h:274
Definition: c_geometry.h:51
Definition: nec_radiation_pattern.h:49
nec_near_field_pattern * get_near_field_pattern(int index)
Get near field pattern results.
Definition: nec_context.h:220
void nt_card(int itmp1, int itmp2, int itmp3, int itmp4, nec_float tmp1, nec_float tmp2, nec_float tmp3, nec_float tmp4, nec_float tmp5, nec_float tmp6)
Definition: nec_context.cpp:661
int nload
input integer flag (from RP card) specifies type of field computation, or type of ground system for f...
Definition: nec_context.h:709
void initialize()
Initialize everything, called after construction so that we can tell the geometry object what nec_con...
Definition: nec_context.cpp:58
Holds structure excitation data at network connection points.
Definition: nec_results.h:474
void kh_card(nec_float tmp1)
Definition: nec_context.cpp:879
real_array bir
coefficients of the constant terms in the current interpolation functions for the current vector ...
Definition: nec_context.h:702
nec_results m_results
The results object that holds all the specific results.
Definition: nec_context.h:680
void cp_card(int itmp1, int itmp2, int itmp3, int itmp4)
Definition: nec_context.cpp:937
int iptflq
pq card flags
Definition: nec_context.h:654
Definition: nec_output.h:26
Container for an nec2++ simulation.
Definition: nec_context.h:60
void geometry_complete(int gpflag)
Signal the end of a geometry description.
Definition: nec_context.cpp:262
double get_impedance_real(int freq_index=0)
Impedance: Real Part.
Definition: nec_context.h:165
nec_radiation_pattern * get_radiation_pattern(int index)
Get Radiation Pattern results.
Definition: nec_context.h:202
nec_output_flags m_output_flags
an object to pipe output through...
Definition: nec_context.h:684
nec_norm_rx_pattern * get_norm_rx_pattern(int index)
Get Normalized Receiving Pattern Results.
Definition: nec_context.h:193
int ifar
the current vector
Definition: nec_context.h:706
Definition: nec_ground.h:59