00001 #ifndef HNBODY_OPTS_H
00002 #define HNBODY_OPTS_H
00003
00013 #include "hnbody/kernel.h"
00014
00015 #ifdef mu_os_mswin
00016 #define getopt mu_getopt
00017 #define optarg mu_optarg
00018 #define optind mu_optind
00019 #define optopt mu_optopt
00020 #endif
00021
00022 #ifdef __cplusplus
00023 extern "C" {
00024 namespace HNBODY {
00025 #endif
00026
00028 #define HNB_ORDER_MAX 32
00029
00030
00032 typedef enum hnb_class_enum {
00033 HNB_SAVE,
00034 HNB_ENERGY,
00035 HNB_OUTPUT,
00036 HNB_STATE,
00037 HNB_BAD_CLASS
00038 } hnb_class_t;
00039
00044 typedef enum hnb_format_enum {
00045 HNB_TEXT=0,
00046 HNB_FLOAT=1,
00047 HNB_DOUBLE=2,
00048 HNB_SMARTFLOAT=3,
00049 HNB_BAD_FORMAT
00050 } hnb_format_t;
00051
00053 typedef enum hnb_coord_enum {
00054 HNB_BARY,
00055 HNB_BODY,
00056 HNB_JACOBI,
00057 HNB_BAD_COORD
00058 } hnb_coord_t;
00059
00060
00062 typedef enum hnb_option_enum {
00063 val_true, val_yes, val_false, val_no,
00064
00065 name_integ, val_symp, val_BS, val_RK,
00066 name_integcoord, name_coordzwp,
00067 val_jac, val_regular, val_baryc, val_bodyc, val_modified,
00068 val_kd, val_dk, val_sd,
00069 name_corr, val_O2, val_O4, val_O6, val_rev,
00070 name_tiptoe, name_enc, name_prune,
00071 name_thread, name_thrtiming,
00072
00073 name_dzH, name_dzZ, name_M, name_dM,
00074 name_N, name_nH, name_nL, name_nZ, val_auto,
00075 name_aunit, val_deg, val_rad,
00076 name_munit, val_g, val_Msun,
00077 name_lunit, val_m, val_AU, val_ua, val_pc,
00078 name_tunit, val_s, val_h, val_d, val_yr,
00079
00080 name_incoord, name_iorder, val_mass, val_rcapt, val_renc,
00081 val_semi, val_peridist, val_ecc, val_incl,
00082 val_longasc, val_longperi, val_argperi,
00083 val_meanlong, val_truelong, val_meanlati, val_truelati,
00084 val_meananom, val_trueanom, val_time, val_epoch, val_timeperi,
00085 val_x1, val_x2, val_x3, val_v1, val_v2, val_v3,
00086 val_idtag, val_jindex,
00087
00088 name_J2, name_J4, name_J6, name_obRadius, name_postn,
00089
00090 name_ptype, name_ltype, val_hwps, val_lwps, val_zwps,
00091 name_hwp, name_lwp, name_zwp, name_fixhwp,
00092
00093 name_tinit, name_tfinal,
00094
00095 name_outfile, name_outhead, name_outint, name_outcoord, name_outdig,
00096 name_outdata, name_outtype, name_outorder,
00097 name_stfile, name_sthead, name_stint, name_stcoord, name_stdig,
00098 name_stdata, name_sttype, name_storder,
00099 name_savfile, name_savint, name_savlimit,
00100 name_ergfile, name_erghead, name_ergint, name_ergdata,
00101 val_steps, val_double, val_float, val_smart, val_text,
00102
00103 name_infile, name_include, NOPTAGS, MULTITAGS, FLOATVAL
00104 } hnb_option_tag;
00105
00106
00108 typedef struct hnb_option_struct {
00109 hnb_option_tag integ, integcoord, coordzwp, corr;
00110 hnb_integ_t hninteg;
00111 hnb_integcoord_t icoord, icoordZ;
00112 int ltype, fixedh, tiptoe, enc, prune, postn;
00113 int nthreads, lcycle, lmax, wcycle, wmax;
00114 double acc, dzH, dzZ;
00115
00116 double M, dm, J2, J4, J6, obRad;
00117
00118 double rad, Msun, AU, d;
00119
00120 hnb_coord_t incoord;
00121 hnb_option_tag iorder[HNB_ORDER_MAX], ptype;
00122 int nitags, icart, imass, N, nH, nL, nZ, nhtot, nltot, nztot, ncap, setM;
00123 int *idtag, kid, *jindex, kindex;
00124 double *icond;
00125
00126 char *infile, *outfile, *stfile, *savfile, *ergfile;
00127 hnb_option_tag outtypes[3], sttypes[3],
00128 outorder[HNB_ORDER_MAX], storder[HNB_ORDER_MAX];
00129 int notags, nstags, outhead, sthead, erghead, outdig, stdig;
00130 int tfsteps, outsteps, ststeps, savsteps, ergsteps;
00131 double tinit, tfinal, outint, stint, savint, savlimit, ergint;
00132 hnb_format_t outdata, stdata, ergdata;
00133 hnb_coord_t outcoord, stcoord;
00134
00135 } hnb_options_t;
00136
00137
00139 typedef struct hnb_cli_struct {
00140 const char *logfile, *recfile, *savefile;
00141 int bench, help, quiet, version;
00142 double tcpu;
00143 FILE* log;
00144 } hnb_cli_t;
00145
00146
00147 DLLSPEC extern void hnb_blank_cli(hnb_cli_t *cli);
00148 DLLSPEC extern void hnb_blank_options(hnb_options_t *opts);
00149 DLLSPEC extern void hnb_fill_options(hnb_options_t *opts);
00150 DLLSPEC extern void hnb_free_options(hnb_options_t *opts);
00151 DLLSPEC extern void hnb_read_option_array(hnb_options_t *opts,
00152 const char *array[],FILE *logfile);
00153 DLLSPEC extern void hnb_read_option_file(hnb_options_t *opts,
00154 const char *file, FILE *logfile);
00155 DLLSPEC extern void hnb_exec(hnb_data_t *sys, const hnb_options_t *opts,
00156 FILE *logfile, const char *save);
00157
00158 DLLSPEC extern int
00159 hnb_interface(hnb_options_t *opts, hnb_cli_t *cli, int argc, char *argv[],
00160 void (*custom)(FILE *f, const char *prefix));
00161 DLLSPEC extern int
00162 hnb_opts_driver(hnb_options_t *opts, const hnb_cli_t *cli,
00163 hnb_extra_t kick, hnb_extra_t shift, hnb_drift_t drift,
00164 hnb_derivs_t derivs, hnb_energy_t energy);
00165
00166 DLLSPEC extern double
00167 hnb_benchmark(const hnb_options_t *opts, hnb_extra_t kick,
00168 hnb_extra_t shift, hnb_drift_t drift, hnb_derivs_t derivs, double maxcpu);
00169
00170 DLLSPEC extern hnb_data_t
00171 *hnb_opts_init(hnb_options_t *opts, hnb_extra_t ekick, hnb_extra_t eshift,
00172 hnb_drift_t edrift, hnb_derivs_t ederivs, hnb_energy_t energy);
00173
00174
00175 #ifdef __cplusplus
00176 }
00177 }
00178 #endif
00179
00180 #endif