00001
00002
00003
00004
00005
00006
00007 #include "stdinc.h"
00008 #include "double_star.h"
00009 #include "single_star.h"
00010 #include "main_sequence.h"
00011 #include <stdlib.h>
00012 #include <fstream.h>
00013
00014 #define FULL_OUTPUT
00015
00016 # define FALSE 0
00017 # define TRUE 1
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 local void binev(double_star * b, real start_time, real end_time,
00042 int n_steps) {
00043
00044
00045 real ageint = (end_time - start_time)/n_steps;
00046
00047 real time_done, until_time, dt;
00048 for(int j = 0; j<n_steps; j++) {
00049 b->evolve_element(start_time+ageint*(j+1));
00050 cout << b->get_binary_age() <<":";
00051 b->put_appeal();
00052 #ifdef FULL_OUTPUT
00053 b->print_status();
00054 #endif
00055 }
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 }
00070
00071
00072
00073 void main(int argc, char ** argv)
00074 {
00075
00076
00077
00078
00079
00080
00081
00082
00083 star_appeal primary, secondary;
00084
00085 double_init inner;
00086 double_init outer;
00087 int c;
00088 bool M_flag = FALSE;
00089 bool Q_flag = FALSE;
00090 bool c_flag = FALSE;
00091 bool f_flag = FALSE;
00092 inner.start_time = outer.start_time = 0;
00093 inner.end_time = outer.end_time = 23;
00094 inner.n_steps = outer.n_steps = 1;
00095 inner.mass_prim = 12;
00096 inner.q = 0.75;
00097 outer.mass_prim = (1+inner.q) * inner.mass_prim;
00098 outer.q = 0.2;
00099 inner.semi = 250;
00100 outer.semi = 1000;
00101 inner.eccentricity = 0.2;
00102 outer.eccentricity = 0.1;
00103 int id = 1;
00104 char *comment;
00105 int seed = 0;
00106 int srandinter(int);
00107 extern char *poptarg;
00108 int pgetopt(int, char **, char *);
00109
00110
00111 if (argc <= 1)
00112 cerr <<"Default: binev -t 0 -T 23 -a 250 -e 0.25 -M 12 -m 10 -n 1 \n";
00113
00114 while ((c = pgetopt(argc, argv, "t:n:M:Q:q:A:a:E:e:T:fs:c:")) != -1)
00115 switch(c)
00116 {
00117 case 't': inner.start_time =
00118 outer.start_time = atof(poptarg);
00119 break;
00120 case 'n': inner.n_steps =
00121 outer.n_steps = atoi(poptarg);
00122 break;
00123 case 'M': M_flag = TRUE;
00124 inner.mass_prim =
00125 outer.mass_prim = atof(poptarg);
00126 break;
00127 case 'Q': Q_flag = TRUE;
00128 inner.q = atof(poptarg);
00129 break;
00130 case 'q': outer.q = atof(poptarg);
00131 break;
00132 case 'A': inner.semi = atof(poptarg);
00133 break;
00134 case 'a': outer.semi = atof(poptarg);
00135 break;
00136 case 'E': inner.eccentricity = atof(poptarg);
00137 break;
00138 case 'e': outer.eccentricity = atof(poptarg);
00139 break;
00140 case 'T': inner.end_time =
00141 outer.end_time = atof(poptarg);
00142 break;
00143 case 'f': f_flag = TRUE;
00144 break;
00145 case 's': seed = atoi(poptarg);
00146 break;
00147 case 'c': c_flag = TRUE;
00148 comment = poptarg;
00149 break;
00150 case '?': cerr <<"usage: binev [-t #] [-T #] "
00151 << "[-M #] [-n #] "
00152 << "[-Q #] [-q #] "
00153 << "[-A #] [-a #] "
00154 << "[-E #] [-e #] "
00155 << "[-s #] [-c \"..\"] "
00156 << "[-f < filename] \n";
00157 exit(1);
00158 }
00159
00160 if (inner.end_time<=inner.start_time) {
00161 cerr << "time of final stage should exceed initial stage time"
00162 << " (" << inner.start_time << ">" << inner.end_time << ")" << endl;
00163 exit(1);
00164 }
00165
00166 if (M_flag || Q_flag)
00167 outer.mass_prim = (1+inner.q) * inner.mass_prim;
00168
00169 double_star * t = triple_star(inner, outer);
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197 #ifdef FULL_OUTPUT
00198 t->put_element();
00199 t->print_status();
00200 #endif
00201
00202 binev(t, inner.start_time, inner.end_time, inner.n_steps);
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221 }