Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

star.C

Go to the documentation of this file.
00001 //
00002 // star.C
00003 //
00004 // derived class from starbase
00005 
00006 #include "star.h"
00007 
00008 
00009 //#include "seba.h"
00010 //seba_counters star::get_seba_counters() {return sbc;}
00011 //void star::set_seba_counters(seba_counters sb) {sbc=sb;}
00012 
00013 // MEMO (JM, 17-Aug-1996)
00014 //
00015 // In stellar evolution package, each node should tell
00016 // if it is a binary component or not, by checking
00017 // the star part of its parent, and not by checking
00018 // if it has kepler or not... I changed this part, which
00019 // might cause some other troubles...
00020 //
00021 
00022 star::star(node* n) : starbase(n) { }
00023 
00024 star::star(star& st) : starbase(st) { }
00025 
00026 bool star::is_binary() {
00027     return (the_node->is_parent() && !the_node->is_root());
00028 }
00029 
00030 bool star::is_binary_component() {
00031 
00032   if (the_node->is_low_level_leaf()){
00033         if(the_node->get_parent()->
00034            get_starbase()->get_element_type()==Double) {
00035             return true;
00036         }
00037     }
00038     return false;
00039 }
00040 
00041 bool star::is_star_in_binary() {
00042   
00043     return (!the_node->is_parent() &&
00044             is_binary_component());
00045 }
00046 
00047 star* star::get_binary()
00048 {
00049 
00050   if (is_binary_component())
00051     return (star*)the_node->get_parent()->get_starbase();
00052   else
00053     err_exit("star* get_binary_node: no binary node.");
00054 }
00055 
00056 star* star::get_companion()
00057 {
00058 
00059   if (is_binary_component())
00060     return (star*)the_node->get_binary_sister()
00061                           ->get_starbase();
00062   else
00063     err_exit("star* get_companion: no companion.");
00064 }
00065 
00066 star* star::get_companion(star* str)
00067 {
00068   
00069   if (str->is_binary_component())
00070     return str->get_companion();
00071   else
00072     err_exit("star* get_companion(star*): no companion.");
00073 }
00074 
00075 star* star::get_primary()
00076 {
00077 
00078   if (is_binary_component())
00079     if (get_total_mass()>get_companion()->get_total_mass())
00080       return this;
00081     else
00082       return get_companion();
00083   else
00084     if (the_node->get_oldest_daughter()->get_binary_sister()
00085                 ->get_starbase()
00086                 ->get_total_mass()
00087         >=
00088         the_node->get_oldest_daughter()
00089                 ->get_starbase()
00090                 ->get_total_mass())
00091       
00092       return (star*)the_node->get_oldest_daughter()
00093                             ->get_binary_sister()
00094                             ->get_starbase();
00095   
00096     else
00097       return (star*)the_node->get_oldest_daughter()
00098                             ->get_starbase();
00099 }
00100 
00101 star* star::get_secondary() {
00102 
00103     if (is_binary_component())
00104         if (get_total_mass() < get_companion()->get_total_mass())
00105             return this;
00106         else
00107             return get_companion();
00108     else
00109         if (the_node->get_oldest_daughter()->get_binary_sister()
00110                     ->get_starbase()
00111                     ->get_total_mass() <
00112             the_node->get_oldest_daughter()
00113                     ->get_starbase()
00114                     ->get_total_mass())
00115             return (star*)the_node->get_oldest_daughter()
00116                                   ->get_binary_sister()->get_starbase();
00117         else
00118             return (star*)the_node->get_oldest_daughter()->get_starbase();
00119 }
00120 
00121 star* star::get_initial_primary() {
00122 
00123   if (get_primary()->get_identity() < get_secondary()->get_identity())
00124     return get_primary();
00125   else
00126     return get_secondary();
00127 }
00128 
00129 star* star::get_initial_secondary() {
00130   
00131   return get_companion(get_initial_primary());
00132 
00133 }
00134   
00135 

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