Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

rdc_SeBa.C

Go to the documentation of this file.
00001 
00006 //-----------------------------------------------------------------------------
00007 //   version 1:  Sept 1998   Simon Portegies Zwart   spz@grape.c.u-tokyo.ac.jp
00008 //                                                   University of Tokyo
00009 //.............................................................................
00010 //   non-local functions: 
00011 //-----------------------------------------------------------------------------
00012 
00013 #include "stdinc.h"
00014 #include "node.h"
00015 #include "double_star.h"
00016 #include "main_sequence.h"
00017 //
00018 // SeBa_hist.h
00019 //
00020 
00021 #ifndef    _SeBa_HIST
00022 #  define  _SeBa_HIST
00023 
00024 
00025 enum binary_parameter {identity=0, bin_type, current_time,
00026                        primary_mass, primary_radius,
00027                        secondary_mass, secondary_radius,
00028                        semi_major_axis, eccentricity
00029                       };
00030 
00031 /*-----------------------------------------------------------------------------
00032  * SeBa_hist  --  a linked list of SeBa histories.
00033  *-----------------------------------------------------------------------------
00034  */
00035 class SeBa_hist {
00036     protected:
00037 
00038     int  number;
00039     real time;
00040 
00041     binary_type bin_tpe;
00042     real semi;
00043     real ecc;
00044 
00045     char label_prim[3];
00046     stellar_type tpe_prim;
00047     real m_prim;
00048     real r_prim;
00049     
00050     char label_sec[3];
00051     stellar_type tpe_sec;
00052     real m_sec;
00053     real r_sec;
00054 
00055     SeBa_hist * past;
00056     SeBa_hist * future;
00057 
00058     public:
00059        SeBa_hist(SeBa_hist* s=NULL) {
00060            if (s) {
00061               past=s;
00062               past->future=this;
00063               future = NULL;
00064            }
00065            else {
00066               past=NULL;
00067               future=NULL;
00068           }
00069 
00070            number = 0;
00071            time   = 0;
00072            bin_tpe = Detached;
00073            // label_prim = "1a";
00074            strcpy(label_prim, "1a");                    // Steve, 20010907
00075            // label_sec = "1b";
00076            strcpy(label_sec, "1b");
00077            tpe_prim = tpe_sec = Main_Sequence;
00078            m_prim=m_sec=r_prim=r_sec=0;
00079        }
00080        ~SeBa_hist(){
00081          if (future!=NULL) {
00082              SeBa_hist *tmp = future;
00083              future = NULL;
00084              delete tmp;
00085          }
00086 
00087          if (past)
00088             past->future = NULL;
00089        }
00090 
00091        SeBa_hist* get_past() {return past;}
00092        void set_past(SeBa_hist *sb) {past = sb;}
00093        SeBa_hist* get_future() {return future;}
00094        SeBa_hist* get_first() {
00095            if (past!=NULL)
00096               return past->get_first();
00097            else
00098               return this;
00099        }
00100        SeBa_hist* get_last() {
00101            if (future!=NULL)
00102               return future->get_last();
00103            else 
00104               return this;
00105        }
00106 
00107        void set_future(SeBa_hist* f) {future = f;}
00108        void set_last(SeBa_hist* f) {
00109             if(future!=NULL) 
00110               future->set_last(f);
00111             else
00112               future=f;
00113        }
00114        int get_number()             {return number;}
00115        int set_number(int n)        {number=n;}
00116 
00117        real get_time()              {return time;}
00118 
00119        real set_stellar_radius(bool);
00120        void move_SeBa_hist_to(SeBa_hist*);
00121        bool read_SeBa_hist(istream&);
00122 
00123        void put_history(ostream&, bool);
00124        void put_single_reverse(ostream&);
00125        void put_first_formed_left(char*, real);
00126 
00127        bool SeBa_hist::binary_contains(char*, char *, binary_type);
00128        bool binary_limits(binary_parameter, real, real);
00129        real get_parameter(binary_parameter);
00130        binary_type get_binary_type() { return bin_tpe;}
00131        stellar_type get_primary_type() { return tpe_prim;}
00132        stellar_type get_secondary_type() { return tpe_sec;}
00133 
00134        SeBa_hist* get_SeBa_hist_at_time(real);
00135                                   
00136        friend ostream& operator<<(ostream& s, SeBa_hist&);
00137 //       friend istream& operator>>(istream& s, cluster_table& table);
00138 };
00139 
00140 #define for_all_SeBa_hist(SeBa_hist, base, SeBa_hist_next)                    \
00141         for (SeBa_hist* SeBa_hist_next = base;                                \
00142              SeBa_hist_next != NULL;                            \
00143              SeBa_hist_next = SeBa_hist_next->get_future())
00144 
00145 ostream& operator<<(ostream& s, SeBa_hist& hi) {
00146 
00147     s << hi.number << " "<< hi.time;
00148     // short dump output is without bin_type
00149     //<< " " << (int)hi.bin_tpe; 
00150     s << "\t" << hi.semi << " " << hi.ecc; 
00151    s << "\t" << hi.label_prim << " " << hi.tpe_prim 
00152 //    s << "\t" << hi.tpe_prim 
00153               << " " << hi.m_prim << " " << hi.r_prim;
00154     s << "\t" << hi.label_sec << " " << hi.tpe_sec 
00155 //    s << "\t" << hi.tpe_sec 
00156               << " " << hi.m_sec << " " << hi.r_sec;
00157     s << endl;
00158 
00159     return s;
00160 
00161 }
00162 
00163 
00164 void SeBa_hist::put_history(ostream& s, bool verbose=false) {
00165 
00166      if (verbose) {
00167          s << "\nnumber= " << number <<"\tTime= "<< time;
00168          s << "\t" <<  type_string(bin_tpe) 
00169            << "\t a= " << semi << " e= " << ecc << endl;
00170          s << "\t"  << type_string(tpe_prim) //<< "(" << label_prim << ")"
00171            << "\tM= " << m_prim << " R= " << r_prim << endl;
00172          s << "\t" << type_string(tpe_sec) //<< "(" << label_sec << ")"
00173            << "\tm= " << m_sec << " r= " << r_sec << endl;
00174      }
00175      else {
00176          s << *this;
00177      }
00178 
00179      if (future!=NULL) 
00180         future->put_history(s, verbose);
00181  }
00182 
00183 
00184 void SeBa_hist::put_single_reverse(ostream& s) {
00185 
00186      s << number << " "<< time;
00187      s << "\t" << semi << " " << ecc; 
00188      s << "\t" << label_sec << " " << tpe_sec << " " 
00189 //     s << "\t" << tpe_sec << " " 
00190                << m_sec << " " << r_sec;
00191      s << "\t" << label_prim << " " <<tpe_prim << " " 
00192 //     s << "\t" <<tpe_prim << " " 
00193                << m_prim << " " << r_prim;
00194      s << endl;
00195  }
00196 
00197 real SeBa_hist::get_parameter(binary_parameter param) {
00198 
00199      switch(param) {
00200      case identity:                          return number;
00201           break;
00202      case bin_type:                          return bin_tpe;
00203           break;
00204      case current_time:                      return time;
00205           break;
00206      case primary_mass:                      return m_prim;
00207           break;
00208      case primary_radius:                    return r_prim;
00209           break;
00210      case secondary_mass:                    return m_sec;
00211           break;
00212      case secondary_radius:                  return r_sec;
00213           break;
00214      case semi_major_axis:                   return semi;
00215           break;
00216      case eccentricity:                      return ecc;
00217           break;
00218      }
00219 }
00220 
00221 
00222 real SeBa_hist::set_stellar_radius(bool primary = true) {
00223 
00224     real r = 1.e6;
00225     real q = m_prim/m_sec;
00226     real rl_r = r_prim;
00227     if (!primary) {
00228        rl_r = r_sec;
00229        q = 1/q;
00230     }
00231     
00232     if (rl_r >= 0) { // detached
00233       real q1_3 = pow(q, cnsts.mathematics(one_third));
00234       real q2_3 = pow(q1_3, 2);   
00235       
00236       r = semi*0.49*q2_3/(0.6*q2_3 + log(1 + q1_3)) - rl_r;
00237     }
00238     
00239     return r;
00240 }
00241 
00242 bool SeBa_hist::read_SeBa_hist(istream& s) {
00243     
00244     int tpe_1, tpe_2;
00245 
00246     s >> number >> time 
00247       >> semi >> ecc 
00248 //      >> tpe_1 >> m_prim >> r_prim
00249 //      >> tpe_2 >> m_sec >> r_sec;
00250       >> label_prim >> tpe_1 >> m_prim >> r_prim
00251       >> label_sec >> tpe_2 >> m_sec >> r_sec;
00252 
00253     if(s.eof()) return false;
00254 
00255 
00256     tpe_prim = (stellar_type)tpe_1;
00257     tpe_sec = (stellar_type)tpe_2;
00258 
00259     // The safety factor semi<100000 for semi-detached and contact binaries
00260     // is a precision problem. If the orbital separation is very large and
00261     // the size fo the star is small, 
00262     // the size of the Roche-lobe - stellar radius =~ Roche-lobe.
00263     // This results in semi-detached binaries at very large separations. 
00264     if (ecc>=1) {
00265       bin_tpe = Disrupted;
00266     }
00267     else if (semi<=0) {
00268       bin_tpe = Merged;
00269     }
00270     else if (r_prim<=0 && r_sec<=0 && semi<100000) 
00271       bin_tpe = Contact;
00272     else if(r_prim<=0 || r_sec<=0 && semi<100000)  
00273       bin_tpe = Semi_Detached;
00274     
00275     if (bin_tpe != Merged && bin_tpe != Disrupted) {
00276       r_prim = set_stellar_radius(true);
00277       r_sec  = set_stellar_radius(false);
00278     } else {
00279       r_prim = -r_prim;
00280       r_sec  = -r_sec;
00281     }
00282     
00283     return true;
00284 
00285 }
00286 
00287 void SeBa_hist::move_SeBa_hist_to(SeBa_hist *next_hi) {
00288     
00289     next_hi = this;
00290     next_hi->future = NULL;
00291     next_hi->past   = NULL;
00292 }
00293 
00294 bool SeBa_hist::binary_contains(char *prim_string,
00295                                 char *sec_string,
00296                                 binary_type bt = Detached) {
00297 
00298 
00299   if (bin_tpe== bt && 
00300       (!strcmp(prim_string, type_string(tpe_prim))      ||
00301        !strcmp(prim_string, type_short_string(tpe_prim)) ||
00302        !strcmp(prim_string, type_string(summarize_stellar_type(tpe_prim))) ||
00303        !strcmp(prim_string, "any"))
00304                            && 
00305       (!strcmp(sec_string, type_string(tpe_sec))      ||
00306        !strcmp(sec_string, type_short_string(tpe_sec)) ||
00307        !strcmp(sec_string, type_string(summarize_stellar_type(tpe_sec))) ||
00308        !strcmp(sec_string, "any"))) {
00309 
00310     return true;
00311   }
00312 
00313 #if 0
00314   PRC(number);
00315   PRC(prim_string);PRL(type_string(tpe_prim));
00316   PRC(!strcmp(prim_string, type_string(tpe_prim)));
00317   PRC(!strcmp(prim_string, type_short_string(tpe_prim)));
00318   PRL(!strcmp(prim_string, type_string(summarize_stellar_type(tpe_prim))));
00319 
00320   PRC(sec_string);PRL(type_string(tpe_sec));
00321   PRC(!strcmp(sec_string, type_string(tpe_sec)));
00322   PRC(!strcmp(sec_string, type_short_string(tpe_sec)));
00323   PRL(!strcmp(sec_string, type_string(summarize_stellar_type(tpe_sec))));
00324 #endif
00325   
00326   return false;
00327        
00328 }
00329 
00330 void SeBa_hist::put_first_formed_left(char *string_type, real dt) {
00331 
00332 // (GN Apr  6 1999)
00333 //  for_all_SeBa_hist(SeBa_hist, this, hi) {
00334   for_all_SeBa_hist(SeBa_hist, get_first(), hi) {
00335 //    cerr << get_time() << " " << hi->get_time() << endl;
00336 //    cerr << string_type << " " 
00337 //       << type_string(summarize_stellar_type(hi->tpe_prim)) << endl;
00338 
00339     if (!strcmp(string_type, type_string(hi->tpe_prim))      ||
00340         !strcmp(string_type, type_short_string(hi->tpe_prim)) ||
00341         !strcmp(string_type,
00342                type_string(summarize_stellar_type(hi->tpe_prim))))  {
00343 
00344       if ((get_time() - hi->get_time()) < dt) {
00345         cout << *get_first();
00346         cout << *this;
00347       }
00348       break;
00349     }
00350     else if (!strcmp(string_type, type_string(hi->tpe_sec))      ||
00351              !strcmp(string_type, type_short_string(hi->tpe_sec)) ||
00352              !strcmp(string_type,
00353                     type_string(summarize_stellar_type(hi->tpe_sec))) &&
00354         ((get_time() - hi->get_time()) < dt)) {
00355 
00356       if ((get_time() - hi->get_time()) < dt) {
00357         get_first()->put_single_reverse(cout);
00358         put_single_reverse(cout);
00359       }
00360       break;
00361     }
00362   }
00363 
00364 }
00365 
00366 bool SeBa_hist::binary_limits(binary_parameter param,
00367                               real lower, real upper) {
00368 
00369 
00370      if (get_parameter(param) >= lower &&
00371          get_parameter(param) < upper)
00372        return true;
00373 
00374      return false;
00375 
00376 }
00377 
00378 SeBa_hist* SeBa_hist::get_SeBa_hist_at_time(real snap_time) {
00379 
00380   if (snap_time>get_last()->get_time())
00381     return NULL;
00382 
00383   for_all_SeBa_hist(SeBa_hist, get_future(), hi) {
00384     if (hi->get_past()->get_time()<= snap_time && 
00385              snap_time<hi->get_time()) {
00386       return hi->get_past();
00387     }
00388   }
00389 
00390   err_exit("SeBa_hist::SeBa_hist_at_time(real time): time not found");
00391 }
00392 
00393 #endif //   _SeBa_HIST
00394 
00395 #ifndef TOOLBOX
00396 #else
00397 
00398 local SeBa_hist* get_history(SeBa_hist *hi, istream& is) {
00399 
00400     while (hi->get_number()==hi->get_last()->get_number()) {
00401 
00402         if (is.eof())
00403            return NULL;
00404 
00405         new SeBa_hist(hi->get_last());
00406         
00407         hi->get_last()->read_SeBa_hist(is);
00408 
00409     };
00410 
00411     SeBa_hist *next_hi;
00412     
00413     next_hi = hi->get_last();
00414     next_hi->get_past()->set_future(NULL);
00415     next_hi->set_past(NULL);
00416 
00417     return next_hi;
00418 
00419            
00420 }
00421 
00422 local void extract_binary_on_stellar_types(SeBa_hist *ha,
00423                                            char* prim_string,
00424                                            char* sec_string,
00425                                            binary_type bt,
00426                                            real a_min, real a_max,
00427                                            real m_min, real m_max,
00428                                            real e_min, real e_max,
00429                                            real dt,
00430                                            bool first_occasion) {
00431 
00432   if (!strcmp(prim_string, sec_string)) {
00433     for_all_SeBa_hist(SeBa_hist, ha, hi) {
00434        if (hi->binary_contains(prim_string, sec_string, bt) &&
00435            hi->binary_limits(semi_major_axis, a_min, a_max) &&
00436            hi->binary_limits(primary_mass, m_min, m_max) &&
00437            hi->binary_limits(eccentricity, e_min, e_max)) {
00438 
00439            hi->put_first_formed_left(prim_string, dt);
00440            if (first_occasion) 
00441              return;
00442          }
00443      }
00444   }
00445   else {
00446     for_all_SeBa_hist(SeBa_hist, ha, hi) {
00447       if (((hi->binary_contains(prim_string, sec_string, bt) &&
00448             hi->binary_limits(primary_mass, m_min, m_max)) ||
00449            (hi->binary_contains(sec_string, prim_string, bt) &&
00450             hi->binary_limits(secondary_mass, m_min, m_max))) &&
00451            (hi->binary_limits(semi_major_axis, a_min, a_max) &&
00452             hi->binary_limits(eccentricity, e_min, e_max))) {
00453 
00454         cout << *hi->get_first();
00455         cout << *hi;
00456         if (first_occasion) 
00457           return;
00458 
00459       }
00460     }
00461   }
00462 }
00463 
00464 
00465 int **mkarray(int rows, int cols) {
00466     int ** ret = new int *[rows];
00467     for (int i=0; i<cols; i++)
00468         ret[i] = new int[cols];
00469 
00470     for (int i=0; i<rows; i++)
00471         for (int j=0; j<cols; j++)
00472         ret[i][j] = 0;
00473 
00474     return ret;
00475 }
00476 
00477 void print_binary_matric(int **population) {
00478 
00479     int N_row = 0; 
00480     cerr << "    ";
00481     for (int j=0; j<no_of_stellar_type-1; j++) {
00482       cerr << " " << type_short_string((stellar_type)j);
00483       if(j==(int)Main_Sequence || 
00484          j==(int)Super_Giant   || 
00485          j==(int)Thorn_Zytkow)
00486         cerr << "  "; 
00487     }
00488     cerr << endl;
00489       
00490     for (int k = 0; k < no_of_stellar_type-1; k++) {
00491       N_row = 0;
00492       for (int i = 0; i < no_of_stellar_type-1; i++)
00493         N_row += population[i][k];
00494       
00495       if(N_row>0) {
00496         cerr << "   " << type_short_string((stellar_type)k);
00497           
00498         for (int i = 0; i < no_of_stellar_type-1; i++) {
00499           cerr << " " << population[i][k];
00500           if(i==(int)Main_Sequence || 
00501              i==(int)Super_Giant   || 
00502              i==(int)Thorn_Zytkow)
00503             cerr << "  "; 
00504         }
00505         cerr << endl;
00506       }
00507     }
00508   }
00509 
00510 //#else
00511 
00512 //-----------------------------------------------------------------------------
00513 //  main  --  driver to reduce SeBa short dump data
00514 //-----------------------------------------------------------------------------
00515 
00516 main(int argc, char ** argv) {
00517 
00518     bool  c_flag = false;
00519     bool  v_flag = false;
00520     bool  R_flag = false;
00521     bool  first_occasion = false;
00522     
00523     char * primary_type_string = "bla";
00524     char * secondary_type_string = "bla";
00525 
00526     binary_type bt = Detached;
00527 
00528     real a_max = VERY_LARGE_NUMBER;
00529     real a_min = 0;
00530     real m_max = VERY_LARGE_NUMBER;
00531     real m_min = 0;
00532     real e_max = 1;
00533     real e_min = 0;
00534     real dt = 1.e4;
00535 
00536     real snap_time = -1;
00537     bool T_flag = false;
00538 
00539     int binaries_read = 0;
00540 
00541     char  *comment;
00542     check_help();
00543 
00544     extern char *poptarg;
00545     int c;
00546     char* param_string = "P:p:S:s:B:A:a:M:m:E:e:fc:t:vRT:";
00547 
00548     while ((c = pgetopt(argc, argv, param_string)) != -1)
00549         switch(c)
00550             {
00551             case 'A': a_max = atof(poptarg);
00552                       break;
00553             case 'a': a_min = atof(poptarg);
00554                       break;
00555             case 'M': m_max = atof(poptarg);
00556                       break;
00557             case 'm': m_min = atof(poptarg);
00558                       break;
00559             case 'E': e_max = atof(poptarg);
00560                       break;
00561             case 'e': e_min = atof(poptarg);
00562                       break;
00563             case 'f': first_occasion = true;
00564                       break;
00565             case 'c': c_flag = true;
00566                       comment = poptarg;
00567                       break;
00568             case 'p':
00569             case 'P': primary_type_string = poptarg;
00570                       break;
00571             case 's':
00572             case 'S': secondary_type_string = poptarg;
00573                       break;
00574             case 'B': bt = extract_binary_type_string(poptarg);
00575                       break;
00576             case 't': dt = atof(poptarg);
00577                       break;
00578             case 'T': T_flag = true;
00579                       snap_time = atof(poptarg);
00580                       break;
00581             case 'R': R_flag = true;
00582                       break;
00583             case 'v': v_flag = true;
00584                       break;
00585             case '?': params_to_usage(cerr, argv[0], param_string);
00586                       get_help();
00587                       exit(1);
00588             }            
00589 
00590 #if 0
00591     stellar_type ptype = extract_stellar_type_string(primary_type_string);
00592     if (P_flag) 
00593       goto P;
00594     else
00595       goto p;
00596 
00597 P:  stellar_type prim_type = ptype;
00598     goto do_S;
00599 p:  stellar_type_summary prim_type = summarize_stellar_type(ptype);
00600     goto do_S;
00601 
00602 do_S: stellar_type stype = extract_stellar_type_string(secondary_type_string);
00603     if (S_flag) 
00604       goto S;
00605     else
00606       goto s;
00607 
00608 S:  stellar_type sec_type = stype;
00609     goto start;
00610 s:  stellar_type_summary sec_type= summarize_stellar_type(stype);
00611     goto start;
00612 
00613 start:    
00614 
00615 #endif    
00616 
00617     SeBa_hist* hi = new SeBa_hist;
00618     if (!hi->read_SeBa_hist(cin))
00619            exit(-1);
00620 
00621     int** detached_population;
00622     int** contact_population;
00623     int* single_population;
00624     int* blue_straggler_population;
00625     bool p_bss, s_bss, tb;
00626     int N_detached=0, N_contact=0, N_single=0;
00627     binary_type tpe_bin;
00628     stellar_type prim_type, sec_type, ts;
00629     real prim_mass, sec_mass;
00630     real m_to;
00631     if(T_flag) {
00632       m_to = turn_off_mass(snap_time);
00633 
00634       detached_population = mkarray((int)no_of_stellar_type, 
00635                                     (int)no_of_stellar_type);
00636       contact_population = mkarray((int)no_of_stellar_type, 
00637                                    (int)no_of_stellar_type);
00638       single_population = new int[(int)no_of_stellar_type];
00639       blue_straggler_population = new int[(int)no_of_stellar_type];
00640       for(int i=0; i<(int)no_of_stellar_type; i++) {
00641         single_population[i]=0;
00642         blue_straggler_population[i] = 0;
00643       }
00644 
00645     }
00646 
00647     int mergers = 0;    
00648     SeBa_hist* next_hi = get_history(hi, cin);
00649     do {
00650 
00651       binaries_read++;
00652 
00653       if (hi->get_last()->get_binary_type() == Merged) 
00654         mergers++;
00655 //      cerr << hi->get_parameter(identity) << endl;
00656 
00657       if(!T_flag) {
00658         extract_binary_on_stellar_types(hi, primary_type_string,
00659                                         secondary_type_string,
00660                                         bt,
00661                                         a_min, a_max, m_min, m_max,
00662                                         e_min, e_max, dt, first_occasion);
00663       }
00664       else {
00665         SeBa_hist *hj = hi->get_SeBa_hist_at_time(snap_time);
00666 
00667 //      tpe_bin     = hi->binary_type_at_time(snap_time);
00668 //      prim_type   = hi->primary_type_at_time(snap_time, p_bss);
00669 //      sec_type    = hi->secondary_type_at_time(snap_time, s_bss);
00670         if(hj) {
00671           tpe_bin     = hj->get_binary_type();
00672           prim_type   = hj->get_primary_type();
00673           prim_mass   = hj->get_parameter(primary_mass);
00674           sec_type    = hj->get_secondary_type();
00675           sec_mass    = hj->get_parameter(secondary_mass);
00676           if(prim_type==Main_Sequence && prim_mass>m_to)
00677             p_bss = true;
00678           else
00679             p_bss = false;
00680           if(sec_type==Main_Sequence && sec_mass>m_to)
00681             s_bss = true;
00682           else
00683             s_bss = false;
00684           if (prim_mass<sec_mass) {
00685             ts = prim_type;
00686             prim_type = sec_type;
00687             sec_type = ts;
00688             tb = p_bss;
00689             p_bss=s_bss;
00690             s_bss=tb;
00691           }
00692 
00693           if(prim_type>=0 && sec_type>=0) {
00694             if(tpe_bin==Detached) {
00695               N_detached++;
00696               if (p_bss)
00697                 blue_straggler_population[(int)sec_type]++; 
00698               else if (s_bss)
00699                 blue_straggler_population[(int)prim_type]++; 
00700               else
00701                 detached_population[(int)prim_type][(int)sec_type]++; 
00702             }
00703             else if(tpe_bin==Semi_Detached ||
00704                     tpe_bin==Contact) {
00705               N_contact++;
00706               if (p_bss)
00707                 blue_straggler_population[(int)sec_type]++; 
00708               else if (s_bss)
00709                 blue_straggler_population[(int)prim_type]++; 
00710               else
00711                 contact_population[(int)prim_type][(int)sec_type]++; 
00712             }
00713             else {
00714               N_single++;
00715               single_population[(int)prim_type]++; 
00716               if (p_bss)
00717                 blue_straggler_population[Proto_Star]++; 
00718               
00719               if(tpe_bin==Disrupted) {
00720                 N_single++;
00721                 single_population[(int)sec_type]++; 
00722                 if (p_bss)
00723                   blue_straggler_population[Disintegrated]++; 
00724               }
00725             }
00726           }
00727         }
00728       }
00729 
00730       if (v_flag)
00731         hi->put_history(cout, v_flag);
00732       
00733       if (R_flag) 
00734         for_all_SeBa_hist(SeBa_hist, hi, ho) cerr << *ho;
00735 
00736       delete hi;
00737       
00738       hi = next_hi;
00739       next_hi = get_history(hi, cin);
00740     }
00741     while (next_hi);
00742 
00743      extract_binary_on_stellar_types(hi->get_last(), primary_type_string,
00744                                      secondary_type_string,
00745                                      bt,
00746                                      a_min, a_max, m_min, m_max,
00747                                      e_min, e_max, dt, first_occasion);
00748 
00749      if (v_flag) {
00750        hi->put_history(cout, v_flag);
00751        cerr <<"Number of Mergers: " << mergers << endl;
00752      }
00753 
00754 
00755     if(T_flag) {
00756 
00757       if (N_detached>0) {
00758         cerr << "     Detached population"<<endl;
00759         print_binary_matric(detached_population);
00760       }
00761       else
00762         cerr << "     ---No detached binaries---" <<endl;
00763       if (N_contact>0) {
00764         cerr << "     Semi-detached/contact population"<<endl;
00765         print_binary_matric(contact_population);
00766       }
00767       else
00768         cerr << "     ---No contact Binaries---" <<endl;
00769 
00770       cerr << "     Single population"<<endl;
00771       cerr << "    ";
00772       for (int j=0; j<no_of_stellar_type-1; j++) {
00773         cerr << " " << type_short_string((stellar_type)j);
00774         if(j==(int)Main_Sequence || 
00775            j==(int)Super_Giant   || 
00776            j==(int)Thorn_Zytkow)
00777           cerr << "  "; 
00778       }
00779 
00780       cerr << endl << "     ";
00781       for (int j = 0; j<no_of_stellar_type-1; j++) {
00782         cerr << " " << single_population[j];
00783         if(j==(int)Main_Sequence || 
00784            j==(int)Super_Giant   || 
00785            j==(int)Thorn_Zytkow)
00786           cerr << "  "; 
00787       }
00788       cerr << "\n     Blue straggler population (pl=merged, di=dissrupted)"
00789            << endl;
00790       cerr << endl << "     ";
00791       for (int j = 0; j<no_of_stellar_type-1; j++) {
00792         cerr << " " << blue_straggler_population[j];
00793         if(j==(int)Main_Sequence || 
00794            j==(int)Super_Giant   || 
00795            j==(int)Thorn_Zytkow)
00796           cerr << "  "; 
00797       }
00798       cerr << endl;
00799 
00800     }
00801 //     if (R_flag) 
00802 //       for_all_SeBa_hist(SeBa_hist, hi, ho) cerr << *ho;
00803 
00804     cerr << "Total number of binaries read: " << binaries_read << endl;
00805 }
00806 
00807 #endif // endof: TOOLBOX
00808 
00809 
00810 

Generated at Sun Feb 24 09:57:13 2002 for STARLAB by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001