HNBody  Version 1.0.10
Go to the documentation of this file.
1 #ifndef HNBODY_OPTS_H
2 #define HNBODY_OPTS_H
13 #include "hnbody/kernel.h"
15 #ifdef mu_os_mswin
16 #define getopt mu_getopt
17 #define optarg mu_optarg
18 #define optind mu_optind
19 #define optopt mu_optopt
20 #endif
22 #ifdef __cplusplus
23 extern "C" {
24 namespace HNBODY {
25 #endif
28 #define HNB_ORDER_MAX 32
32 typedef enum hnb_class_enum {
38 } hnb_class_t;
44 typedef enum hnb_format_enum {
50 } hnb_format_t;
53 typedef enum hnb_coord_enum {
58 } hnb_coord_t;
62 typedef enum hnb_option_enum {
63  val_true, val_yes, val_false, val_no,
65  name_integ, val_symp, val_BS, val_RK,
66  name_integcoord, name_coordzwp,
67  val_jac, val_regular, val_baryc, val_bodyc, val_modified,
68  val_kd, val_dk, val_sd,
69  name_corr, val_O2, val_O4, val_O6, val_rev,
70  name_tiptoe, name_enc, name_prune,
71  name_thread, name_thrtiming,
73  name_dzH, name_dzZ, name_M, name_dM,
74  name_N, name_nH, name_nL, name_nZ, val_auto,
75  name_aunit, val_deg, val_rad,
76  name_munit, val_g, val_Msun,
77  name_lunit, val_m, val_AU, val_ua, val_pc,
78  name_tunit, val_s, val_h, val_d, val_yr,
80  name_incoord, name_iorder, val_mass, val_rcapt, val_renc,
81  val_semi, val_peridist, val_ecc, val_incl,
82  val_longasc, val_longperi, val_argperi,
83  val_meanlong, val_truelong, val_meanlati, val_truelati,
84  val_meananom, val_trueanom, val_time, val_epoch, val_timeperi,
85  val_x1, val_x2, val_x3, val_v1, val_v2, val_v3,
86  val_idtag, val_jindex,
88  name_J2, name_J4, name_J6, name_obRadius, name_postn,
90  name_ptype, name_ltype, val_hwps, val_lwps, val_zwps,
91  name_hwp, name_lwp, name_zwp, name_fixhwp,
93  name_tinit, name_tfinal,
95  name_outfile, name_outhead, name_outint, name_outcoord, name_outdig,
96  name_outdata, name_outtype, name_outorder,
97  name_stfile, name_sthead, name_stint, name_stcoord, name_stdig,
98  name_stdata, name_sttype, name_storder,
99  name_savfile, name_savint, name_savlimit,
100  name_ergfile, name_erghead, name_ergint, name_ergdata,
101  val_steps, val_double, val_float, val_smart, val_text,
103  name_infile, name_include, NOPTAGS, MULTITAGS, FLOATVAL
108 typedef struct hnb_option_struct {
109  hnb_option_tag integ, integcoord, coordzwp, corr;
110  hnb_integ_t hninteg;
111  hnb_integcoord_t icoord, icoordZ;
112  int ltype, fixedh, tiptoe, enc, prune, postn;
113  int nthreads, lcycle, lmax, wcycle, wmax;
114  double acc, dzH, dzZ;
116  double M, dm, J2, J4, J6, obRad;
118  double rad, Msun, AU, d;
120  hnb_coord_t incoord;
121  hnb_option_tag iorder[HNB_ORDER_MAX], ptype;
122  int nitags, icart, imass, N, nH, nL, nZ, nhtot, nltot, nztot, ncap, setM;
123  int *idtag, kid, *jindex, kindex;
124  double *icond;
126  char *infile, *outfile, *stfile, *savfile, *ergfile;
127  hnb_option_tag outtypes[3], sttypes[3],
128  outorder[HNB_ORDER_MAX], storder[HNB_ORDER_MAX];
129  int notags, nstags, outhead, sthead, erghead, outdig, stdig;
130  int tfsteps, outsteps, ststeps, savsteps, ergsteps;
131  double tinit, tfinal, outint, stint, savint, savlimit, ergint;
132  hnb_format_t outdata, stdata, ergdata;
133  hnb_coord_t outcoord, stcoord;
135 } hnb_options_t;
139 typedef struct hnb_cli_struct {
140  const char *logfile, *recfile, *savefile;
141  int bench, help, quiet, version;
142  double tcpu;
143  FILE* log;
144 } hnb_cli_t;
147 DLLSPEC extern void hnb_blank_cli(hnb_cli_t *cli);
148 DLLSPEC extern void hnb_blank_options(hnb_options_t *opts);
149 DLLSPEC extern void hnb_fill_options(hnb_options_t *opts);
150 DLLSPEC extern void hnb_free_options(hnb_options_t *opts);
151 DLLSPEC extern void hnb_read_option_array(hnb_options_t *opts,
152  const char *array[],FILE *logfile);
153 DLLSPEC extern void hnb_read_option_file(hnb_options_t *opts,
154  const char *file, FILE *logfile);
155 DLLSPEC extern void hnb_exec(hnb_data_t *sys, const hnb_options_t *opts,
156  FILE *logfile, const char *save);
158 DLLSPEC extern int
159  hnb_interface(hnb_options_t *opts, hnb_cli_t *cli, int argc, char *argv[],
160  void (*custom)(FILE *f, const char *prefix));
161 DLLSPEC extern int
162  hnb_opts_driver(hnb_options_t *opts, const hnb_cli_t *cli,
163  hnb_extra_t kick, hnb_extra_t shift, hnb_drift_t drift,
164  hnb_derivs_t derivs, hnb_energy_t energy);
166 DLLSPEC extern double
167  hnb_benchmark(const hnb_options_t *opts, hnb_extra_t kick,
168  hnb_extra_t shift, hnb_drift_t drift, hnb_derivs_t derivs, double maxcpu);
170 DLLSPEC extern hnb_data_t
171  *hnb_opts_init(hnb_options_t *opts, hnb_extra_t ekick, hnb_extra_t eshift,
172  hnb_drift_t edrift, hnb_derivs_t ederivs, hnb_energy_t energy);
175 #ifdef __cplusplus
176 } // namespace HNBODY
177 } // extern "C"
178 #endif
180 #endif /* HNBODY_OPTS_H */
enum hnb_option_enum hnb_option_tag
Input (a.k.a. option) file tags.
Definition: opts.h:54
DLLSPEC void hnb_read_option_file(hnb_options_t *opts, const char *file, FILE *logfile)
Parses an HNBody input file.
Definition: parse.c:1940
Definition: opts.h:34
DLLSPEC void hnb_exec(hnb_data_t *sys, const hnb_options_t *opts, FILE *logfile, const char *save)
Executes a pre-initialized integration.
Definition: output.c:1080
void(* hnb_drift_t)(hnb_vector_t dx, hnb_vector_t dv, double t, hnb_vector_t x, hnb_vector_t v, const double m[], int nHL, int n, double dt, const struct hnb_data_struct *sys)
Prototype for extra_drift() functions.
Definition: kernel.h:100
Definition: opts.h:47
enum hnb_coord_enum hnb_coord_t
Output file coordinate systems.
double(* hnb_energy_t)(double t, hnb_vector_t x, hnb_vector_t v, const double m[], int nHL, const struct hnb_data_struct *sys)
Prototype for extra_energy() functions.
Definition: kernel.h:105
Definition: opts.h:56
Core user-visible package declarations for the HNBody library.
Definition: opts.h:45
Definition: opts.h:35
FILE * log
-l LOGFILE file pointer.
Definition: opts.h:143
Option values data structure.
Definition: opts.h:108
enum hnb_class_enum hnb_class_t
Output file classes.
enum hnb_integcoord_enum hnb_integcoord_t
Symplectic integration scheme variations (bit-mask layout).
Definition: opts.h:46
DLLSPEC void hnb_read_option_array(hnb_options_t *opts, const char *array[], FILE *logfile)
Parses an HNBody option string array.
Definition: parse.c:1968
Definition: opts.h:33
Maximum number of columns allowed in InputOrder, OutputOrder, etc.
Definition: opts.h:28
Definition: opts.h:49
struct hnb_option_struct hnb_options_t
Option values data structure.
Definition: opts.h:37
DLLSPEC int hnb_opts_driver(hnb_options_t *opts, const hnb_cli_t *cli, hnb_extra_t kick, hnb_extra_t shift, hnb_drift_t drift, hnb_derivs_t derivs, hnb_energy_t energy)
Performs an integration given a complete set of defining options.
Definition: driver.c:416
HNBody Command Line Interface options.
Definition: opts.h:139
Definition: opts.h:48
Definition: opts.h:57
DLLSPEC double hnb_benchmark(const hnb_options_t *opts, hnb_extra_t kick, hnb_extra_t shift, hnb_drift_t drift, hnb_derivs_t derivs, double maxcpu)
Estimates CPU time per step of an integration.
Definition: driver.c:89
Definition: opts.h:55
int(* hnb_derivs_t)(hnb_vector_t dxdt, hnb_vector_t dvdt, double t, hnb_vector_t x, hnb_vector_t v, const double m[], int nHL, int n, const struct hnb_data_struct *sys)
Prototype for extra_derivs() functions.
Definition: kernel.h:109
DLLSPEC void hnb_blank_cli(hnb_cli_t *cli)
Clears command line interface options.
Definition: driver.c:177
void(* hnb_extra_t)(hnb_vector_t, double t, hnb_vector_t, const double m[], int nHL, int n, double dt, const struct hnb_data_struct *sys)
Prototype for extra_kick() and extra_shift() functions.
Definition: kernel.h:96
Output file coordinate systems.
Definition: opts.h:53
Output file formats.
Definition: opts.h:44
Main HNBody system data structure.
Definition: kernel.h:115
const char * savefile
-s SAVEFILE File name for restarting integration.
Definition: opts.h:140
enum hnb_format_enum hnb_format_t
Output file formats.
double tcpu
-t TCPU Max effort to estimate CPU time per step.
Definition: opts.h:142
Input (a.k.a. option) file tags.
Definition: opts.h:62
DLLSPEC hnb_data_t * hnb_opts_init(hnb_options_t *opts, hnb_extra_t ekick, hnb_extra_t eshift, hnb_drift_t edrift, hnb_derivs_t ederivs, hnb_energy_t energy)
Initializes an HNBody integration.
Definition: parse.c:2051
int version
-v Display version information only.
Definition: opts.h:141
struct hnb_cli_struct hnb_cli_t
HNBody Command Line Interface options.
enum hnb_integ_enum hnb_integ_t
Integration scheme choices.
DLLSPEC int hnb_interface(hnb_options_t *opts, hnb_cli_t *cli, int argc, char *argv[], void(*custom)(FILE *f, const char *prefix))
Parses the standard HNBody driver command line interface.
Definition: driver.c:211
Output file classes.
Definition: opts.h:32
Definition: opts.h:36
DLLSPEC void hnb_free_options(hnb_options_t *opts)
Frees allocated options memory.
Definition: parse.c:2234