Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

starbase.h

Go to the documentation of this file.
00001 
00002        //=======================================================//    _\|/_
00003       //  __  _____           ___                    ___       //      /|\ ~
00004      //  /      |      ^     |   \  |         ^     |   \     //          _\|/_
00005     //   \__    |     / \    |___/  |        / \    |___/    //            /|\ ~
00006    //       \   |    /___\   |  \   |       /___\   |   \   // _\|/_
00007   //     ___/   |   /     \  |   \  |____  /     \  |___/  //   /|\ ~
00008  //                                                       //            _\|/_
00009 //=======================================================//              /|\ ~
00010 
00012 //
00013 //  version 1:  Apr 1993   Piet Hut & Steve McMillan
00014 //  version 2:
00015 //
00016 //  This file includes:
00017 //  1) definition of class starbase
00018 
00019 #ifndef  STARLAB_STARBASE_H
00020 #  define  STARLAB_STARBASE_H
00021 
00022 #include  "starlab_vector.h"
00023 
00024                         // node.h is commented out deliberately,
00025                         // because node.h includes starbase.h.
00026 
00027                         // #include  "node.h"
00028 
00029 #include  "story.h"
00030 #include  "star/star_support.h"
00031 #include  "star/double_support.h"
00032 
00033 //#include  "star/seba.h"
00034 
00035 
00036 class node;             // not included but defined as being some class
00037 class star;
00038 
00040 
00041 class  starbase
00042 {
00043     protected:
00044 
00045         node  * the_node;
00046         story * star_story;
00047 
00048                                                         
00049         static real  m_conv_star_to_dyn;   
00050         static real  r_conv_star_to_dyn;   
00051         static real  t_conv_star_to_dyn;   
00052 
00053         static bool  use_hdyn;             
00054 
00055         // static seba_counters* sbc;
00056 
00057     public:
00058 
00059         starbase(node* n=0);
00060         starbase(starbase& sb); 
00061 
00062         virtual ~starbase() {delete star_story;}
00063 
00064         //seba_counters* get_seba_counters() {return sbc;} 
00065         //void set_seba_counters(seba_counters *sb) {sbc=sb;} 
00066             
00067         node  *get_node()                      {return the_node;}
00068         story *get_star_story()                {return star_story;}
00069 
00070         void  set_node(node* n)                {the_node = n;}
00071         void  set_star_story(story * ss)       {star_story = ss;}
00072 
00073         virtual ostream & print_star_story(ostream&,
00074                                            int short_output = 0);
00075         virtual istream & scan_star_story(istream&, int level = 0);
00076 
00077         bool get_use_hdyn();
00078         void set_use_hdyn(bool);
00079 
00080         virtual void dump(ostream&, bool);
00081         
00082         //              Stellar functions
00083         //              REMOVE for standard STAREV
00084         virtual stellar_type get_element_type();
00085         virtual real get_total_mass();
00086         virtual real get_effective_radius();
00087         virtual real get_current_time();
00088         virtual real get_relative_age();
00089         
00090         virtual real temperature();
00091         virtual real get_luminosity();
00092 
00093         virtual vec get_anomal_velocity();
00094         virtual void set_anomal_velocity(const vec);
00095         virtual void evolve_element(const real);
00096         virtual real get_evolve_timestep();
00097         virtual star* merge_elements(star*);
00098         
00099         virtual real sudden_mass_loss();
00100 
00101         virtual binary_type get_bin_type();
00102         virtual real get_semi();
00103         virtual void set_semi(real);
00104         virtual real get_eccentricity();
00105         virtual void set_eccentricity(real);
00106 
00107 //      Scaling:
00108 
00109         void set_stellar_evolution_scaling(real, real, real);
00110         bool get_stellar_evolution_scaling();
00111         void print_stellar_evolution_scaling(ostream&);
00112 
00113         real conv_m_star_to_dyn(real);
00114         real conv_r_star_to_dyn(real);
00115         real conv_t_star_to_dyn(real);
00116 
00117         real conv_m_dyn_to_star(real);
00118         real conv_r_dyn_to_star(real);
00119         real conv_t_dyn_to_star(real);
00120 
00121 };
00122 
00123 typedef  starbase *(*sbpfp)();
00124 
00125 inline  starbase * new_starbase()    {return  new starbase;}
00126 
00127 // Initialization functions for mass function, 
00128 //                              mass ratio distribution,
00129 //                              eccentricity distribution,
00130 //                              semi-major axis distribution.
00131 
00132 // Mass function.
00133 enum mass_function {Unknown_MF=-1, 
00134                     Equal_Mass, mf_Power_Law, Miller_Scalo, Scalo, Kroupa,
00135                     GdeMarchi};
00136 
00137 real get_random_stellar_mass(real m_lower, real m_upper, 
00138                              mass_function mf, real exponent);
00139 char* type_string(mass_function mf);
00140 mass_function extract_mass_function_type_string(char* type_string);
00141 real general_power_law(real lowerl, real upperl, real exponent);
00142 
00143 // Mass ratio distribution
00144 enum mass_ratio_distribution {Unknown_qf=-1,
00145                               Equal_q, Flat_q, qf_Power_Law, Hogeveen};
00146 char* type_string(mass_ratio_distribution qf);
00147 mass_ratio_distribution 
00148     extract_mass_ratio_distribution_type_string(char* type_string);
00149 real get_random_mass_ratio(real q_lower, real q_upper, 
00150                            mass_ratio_distribution qf, 
00151                            real exponent);
00152                               
00153 enum sma_distribution {Unknown_smaf=-1, 
00154                        Equal_sma, sma_Power_Law, Duquennoy_Mayor, Eggleton};
00155 char* type_string(sma_distribution smaf);
00156 sma_distribution 
00157     extract_semimajor_axis_distribution_type_string(char* type_string);
00158 real get_random_semimajor_axis(real a_lower, real a_upper, 
00159                                sma_distribution smaf, 
00160                                real exponent, real m_prim, real m_sec);
00161 
00162 enum ecc_distribution {Unknown_eccf, 
00163                        Equal_ecc, ecc_Power_Law, Thermal_Distribution};
00164 char* type_string(ecc_distribution eccf);
00165 ecc_distribution 
00166     extract_eccentricity_distribution_type_string(char* type_string);
00167 real get_random_eccentricity(real e_lower, real e_upper, 
00168                              ecc_distribution eccf, 
00169                                real exponent);
00170 
00171 void mkrandom_binary(real m_min,  real m_max,
00172                      mass_function mf,  real m_exp,
00173                      real q_min,  real q_max,
00174                      mass_ratio_distribution qf,  real q_exp,
00175                      real a_min,  real a_max,
00176                      sma_distribution af,  real a_exp,
00177                      real e_min,  real e_max,
00178                      ecc_distribution ef,  real e_exp,
00179                      real &m_prim, real &m_sec, real &semi,
00180                      real &ecc);
00181 
00182 void print_initial_binary_distributions(real m_min,  real m_max,
00183                                         mass_function mf,  real m_exp,
00184                                         real q_min,  real q_max,
00185                                         mass_ratio_distribution qf,  
00186                                         real q_exp,
00187                                         real a_min,  real a_max,
00188                                         sma_distribution af,  real a_exp,
00189                                         real e_min,  real e_max,
00190                                         ecc_distribution ef,  real e_exp);
00191 
00192 
00193 #endif
00194  

Generated on Wed Jul 20 12:43:37 2005 for Starlab by  doxygen 1.4.3