00001
00002
00003
00004
00005
00006
00007
00008 #define C_ONLY
00009 #include "scatter3.h"
00010 #include "c_interface.h"
00011
00012 void main(int argc, char **argv)
00013 {
00014 int seed = 0;
00015 int n_rand = 0;
00016
00017 int n_experiments = 1;
00018 real dt_out =
00019 VERY_LARGE_NUMBER;
00020 real dt_snap =
00021 VERY_LARGE_NUMBER;
00022
00023 real cpu_time_check = 3600;
00024 real snap_cube_size = 10;
00025
00026 int planar_flag = 0;
00027 bool psi_flag = FALSE;
00028 real psi = 0;
00029
00030 bool b_flag = FALSE;
00031 bool q_flag = FALSE;
00032 bool Q_flag = FALSE;
00033
00034 extern char *poptarg;
00035 int c;
00036 char* param_string = "A:bc:C:d:D:e:g:L:m:M:n:N:o:pPqQr:R:s:S:U:v:x:y:z:";
00037
00038 int random_seed;
00039 real cpu;
00040 int i;
00041
00042 initial_state3 init;
00043 intermediate_state3 inter;
00044 final_state3 final;
00045
00046
00047
00048 c_make_standard_init(&init);
00049
00050 while ((c = c_pgetopt(argc, argv, param_string)) != -1)
00051 switch(c) {
00052
00053 case 'A': init.eta = atof(poptarg);
00054 break;
00055 case 'b': b_flag = 1 - b_flag;
00056 break;
00057 case 'c': cpu_time_check = 3600*atof(poptarg);
00058 break;
00059 case 'C': snap_cube_size = atof(poptarg);
00060 break;
00061 case 'd': dt_out = atof(poptarg);
00062 break;
00063 case 'D': dt_snap = atof(poptarg);
00064 break;
00065 case 'e': init.ecc = atof(poptarg);
00066 break;
00067 case 'g': init.tidal_tol_factor = atof(poptarg);
00068 break;
00069 case 'L': init.r_init_min = atof(poptarg);
00070 break;
00071 case 'm': init.m2 = atof(poptarg);
00072 break;
00073 case 'M': init.m3 = atof(poptarg);
00074 break;
00075 case 'n': n_experiments = atoi(poptarg);
00076 break;
00077 case 'N': n_rand = atoi(poptarg);
00078 break;
00079 case 'o': psi = atof(poptarg);
00080 psi_flag = TRUE;
00081 break;
00082 case 'p': planar_flag = 1;
00083 break;
00084 case 'P': planar_flag = -1;
00085 break;
00086 case 'q': q_flag = 1 - q_flag;
00087 break;
00088 case 'Q': Q_flag = 1 - Q_flag;
00089 break;
00090 case 'r': init.rho = atof(poptarg);
00091 break;
00092 case 'R': init.r_stop = atof(poptarg);
00093 init.r_init_min = init.r_init_max = abs(init.r_stop);
00094 break;
00095 case 's': seed = atoi(poptarg);
00096 break;
00097 case 'S': init.r_stop = atof(poptarg);
00098 break;
00099 case 'U': init.r_init_max = atof(poptarg);
00100 break;
00101 case 'v': init.v_inf = atof(poptarg);
00102 break;
00103 case 'x': init.r1 = atof(poptarg);
00104 break;
00105 case 'y': init.r2 = atof(poptarg);
00106 break;
00107 case 'z': init.r3 = atof(poptarg);
00108 break;
00109 case '?':
00110 exit(1);
00111 }
00112
00113 if (Q_flag) q_flag = TRUE;
00114
00115 if (init.m2 > 1) {
00116
00117 exit(1);
00118 }
00119
00120 c_cpu_init();
00121 random_seed = c_srandinter(seed, n_rand);
00122
00123 for (i = 0; i < n_experiments; i++) {
00124
00125 if (n_experiments > 1) fprintf(stderr, "%d: ", i+1);
00126 c_print_initial_random_parameters();
00127
00128 c_initialize_angles(&init, planar_flag, psi_flag, psi);
00129
00130 cpu = c_cpu_time();
00131 c_scatter3(&init, &inter, &final, cpu_time_check,
00132 dt_out, dt_snap, snap_cube_size);
00133 cpu = c_cpu_time() - cpu;
00134
00135 c_print_scatter3_info(&init, &inter, &final,
00136 Q_flag, q_flag, b_flag, cpu);
00137 }
00138 }
00139