HNBody Version 1.0.10

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

opts.h
Go to the documentation of this file.
1 #ifndef HNBODY_OPTS_H
2 #define HNBODY_OPTS_H
3
13 #include "hnbody/kernel.h"
14
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
21
22 #ifdef __cplusplus
23 extern "C" {
24 namespace HNBODY {
25 #endif
26
28 #define HNB_ORDER_MAX 32
29
30
32 typedef enum hnb_class_enum {
33 HNB_SAVE,
34 HNB_ENERGY,
35 HNB_OUTPUT,
36 HNB_STATE,
37 HNB_BAD_CLASS
38 } hnb_class_t;
39
44 typedef enum hnb_format_enum {
45 HNB_TEXT=0,
46 HNB_FLOAT=1,
47 HNB_DOUBLE=2,
48 HNB_SMARTFLOAT=3,
49 HNB_BAD_FORMAT
50 } hnb_format_t;
51
53 typedef enum hnb_coord_enum {
54 HNB_BARY,
55 HNB_BODY,
56 HNB_JACOBI,
57 HNB_BAD_COORD
58 } hnb_coord_t;
59
60
62 typedef enum hnb_option_enum {
63 val_true, val_yes, val_false, val_no,
64
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,
72
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,
79
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,
87
88 name_J2, name_J4, name_J6, name_obRadius, name_postn,
89
90 name_ptype, name_ltype, val_hwps, val_lwps, val_zwps,
91 name_hwp, name_lwp, name_zwp, name_fixhwp,
92
93 name_tinit, name_tfinal,
94
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,
102
103 name_infile, name_include, NOPTAGS, MULTITAGS, FLOATVAL
104 } hnb_option_tag;
105
106
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;
115
116 double M, dm, J2, J4, J6, obRad;
117
118 double rad, Msun, AU, d;
119
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;
125
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;
134
135 } hnb_options_t;
136
137
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;
145
146
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);
157
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);
165
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);
169
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);
173
174
175 #ifdef __cplusplus
176 } // namespace HNBODY
177 } // extern "C"
178 #endif
179
180 #endif /* HNBODY_OPTS_H */
hnb_option_tag
enum hnb_option_enum hnb_option_tag
Input (a.k.a. option) file tags.
HNB_BARY
Definition: opts.h:54
hnb_read_option_file
DLLSPEC void hnb_read_option_file(hnb_options_t *opts, const char *file, FILE *logfile)
Parses an HNBody input file.
Definition: parse.c:1940
HNB_ENERGY
Definition: opts.h:34
hnb_exec
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
hnb_drift_t
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
HNB_DOUBLE
Definition: opts.h:47
hnb_coord_t
enum hnb_coord_enum hnb_coord_t
Output file coordinate systems.
hnb_energy_t
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
HNB_JACOBI
Definition: opts.h:56
kernel.h
Core user-visible package declarations for the HNBody library.
HNB_TEXT
Definition: opts.h:45
HNB_OUTPUT
Definition: opts.h:35
hnb_cli_struct::log
FILE * log
-l LOGFILE file pointer.
Definition: opts.h:143
hnb_option_struct
Option values data structure.
Definition: opts.h:108
hnb_class_t
enum hnb_class_enum hnb_class_t
Output file classes.
hnb_integcoord_t
enum hnb_integcoord_enum hnb_integcoord_t
Symplectic integration scheme variations (bit-mask layout).
HNB_FLOAT
Definition: opts.h:46
hnb_read_option_array
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
HNB_SAVE
Definition: opts.h:33
HNB_ORDER_MAX
#define HNB_ORDER_MAX
Maximum number of columns allowed in InputOrder, OutputOrder, etc.
Definition: opts.h:28
HNB_BAD_FORMAT
Definition: opts.h:49
hnb_options_t
struct hnb_option_struct hnb_options_t
Option values data structure.
HNB_BAD_CLASS
Definition: opts.h:37
hnb_opts_driver
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
hnb_cli_struct
HNBody Command Line Interface options.
Definition: opts.h:139
HNB_SMARTFLOAT
Definition: opts.h:48
HNB_BAD_COORD
Definition: opts.h:57
hnb_benchmark
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
HNB_BODY
Definition: opts.h:55
hnb_derivs_t
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
hnb_blank_cli
DLLSPEC void hnb_blank_cli(hnb_cli_t *cli)
Clears command line interface options.
Definition: driver.c:177
hnb_extra_t
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
hnb_coord_enum
hnb_coord_enum
Output file coordinate systems.
Definition: opts.h:53
hnb_format_enum
hnb_format_enum
Output file formats.
Definition: opts.h:44
hnb_data_struct
Main HNBody system data structure.
Definition: kernel.h:115
hnb_cli_struct::savefile
const char * savefile
-s SAVEFILE File name for restarting integration.
Definition: opts.h:140
hnb_format_t
enum hnb_format_enum hnb_format_t
Output file formats.
hnb_cli_struct::tcpu
double tcpu
-t TCPU Max effort to estimate CPU time per step.
Definition: opts.h:142
hnb_option_enum
hnb_option_enum
Input (a.k.a. option) file tags.
Definition: opts.h:62
hnb_opts_init
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
hnb_cli_struct::version
int version
-v Display version information only.
Definition: opts.h:141
hnb_cli_t
struct hnb_cli_struct hnb_cli_t
HNBody Command Line Interface options.
hnb_integ_t
enum hnb_integ_enum hnb_integ_t
Integration scheme choices.
hnb_interface
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
hnb_class_enum
hnb_class_enum
Output file classes.
Definition: opts.h:32
HNB_STATE
Definition: opts.h:36
hnb_free_options
DLLSPEC void hnb_free_options(hnb_options_t *opts)
Frees allocated options memory.
Definition: parse.c:2234