Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

starbase_io.C

Go to the documentation of this file.
00001 //
00002 // starbase_io.C
00003 //
00004 
00005 #include "starbase.h"
00006 #include "node.h"
00007 #include "util_io.h"
00008 
00009 istream & starbase::scan_star_story(istream& s, int level)
00010 {
00011     char input_line[MAX_INPUT_LINE_LENGTH];
00012 
00013     while (get_line(s,input_line), !matchbracket(END_STAR, input_line)) {
00014 
00015         char keyword[MAX_INPUT_LINE_LENGTH];
00016         const char *val = getequals(input_line, keyword);
00017 
00018         // NOTE: The code below is significantly different from the old
00019         // version, which used is_root() and appears to have been wrong.
00020         // The problem is that, because of the logic of get_node_recursive,
00021         // is_root can't be used because the parent pointers haven't yet
00022         // been set.  Fix is to include level as an additional parameter.
00023 
00024 //      cerr << "node: " << the_node->format_label() << "  "; PRL(level);
00025 
00026         if (level == 0 && !strcmp("mass_scale", keyword)) {
00027             m_conv_star_to_dyn = strtod(val, NULL);
00028 
00029         } else if (level == 0 && !strcmp("size_scale", keyword)) {
00030             r_conv_star_to_dyn = strtod(val, NULL);
00031 
00032         } else if (level == 0 && !strcmp("time_scale", keyword)) {
00033             t_conv_star_to_dyn = strtod(val, NULL);
00034 
00035         } else {
00036 //          cerr << "Adding " << input_line << " to star story for "
00037 //               << get_node()->format_label() << endl;
00038             add_story_line(star_story, input_line);
00039         }
00040     }
00041     return s;
00042 }
00043 
00044 ostream& starbase::print_star_story(ostream& s,
00045                                     int short_output)   // default = 0
00046 {
00047 
00048     put_story_header(s, STAR_ID);
00049 
00050     if (the_node->is_root()) {
00051        put_real_number(s, "  mass_scale     =  ", m_conv_star_to_dyn);
00052        put_real_number(s, "  size_scale     =  ", r_conv_star_to_dyn);
00053        put_real_number(s, "  time_scale     =  ", t_conv_star_to_dyn);
00054     }
00055 
00056     // Note from Steve (5/01): It seems that, if this virtual function
00057     // is actually being used, then we have a starbase without a "star"
00058     // type, and hence no evolving stellar properties.  In that case,
00059     // we probably have no need for short_format output here, since
00060     // that is relevant only to the evolution code, so suppress it.
00061 
00062     if (star_story && !short_output)
00063         put_story_contents(s, *star_story);
00064 
00065     put_story_footer(s, STAR_ID);
00066     
00067     return s;
00068 }
00069 
00070 
00071 //              Function calls for stellar evolution link.
00072 bool starbase::get_use_hdyn()       {return use_hdyn;}
00073 void starbase::set_use_hdyn(bool u) {use_hdyn = u;}
00074 
00075 //seba_counters* starbase::get_seba_counters() {return sbc;} 
00076 //void starbase::set_seba_counters(seba_counters *sb) {sbc = sb;}
00077 
00078  
00079 
00080 void starbase::dump(ostream&, bool) {} 
00081 real starbase::get_total_mass() {return 0;}
00082 real starbase::get_effective_radius() {return 0;}
00083 real starbase::get_current_time() {return 0;}
00084 real starbase::get_relative_age() {return 0;}
00085 real starbase::get_evolve_timestep() {return 0;}
00086 
00087 real starbase::temperature() {return 0;}
00088 real starbase::get_luminosity() {return 0;}
00089 
00090 vector starbase::get_anomal_velocity() {
00091                  vector v; return v;}
00092 void starbase::set_anomal_velocity(const vector v) {}
00093 void starbase::evolve_element(const real) {}
00094 star* starbase::merge_elements(star*) { return NULL; }    // HELP HELP
00095 
00096 real starbase::get_semi() {return 0;}
00097 void starbase::set_semi(real a) {}
00098 real starbase::get_eccentricity()    {return 0;}
00099 void starbase::set_eccentricity(real e)    {}
00100 binary_type starbase::get_bin_type() {return Unknown_Binary_Type;}
00101 
00102 //     -----  Scaling:  -----
00103 
00104 real starbase::conv_m_star_to_dyn(real ms)      // input:  mass (solar)
00105 {return ms*m_conv_star_to_dyn;}                 // return: mass (code)
00106 
00107 real starbase::conv_r_star_to_dyn(real rs)      // input:  length (solar)
00108 {return rs*r_conv_star_to_dyn;}                 // return: length (code)
00109 
00110 real starbase::conv_t_star_to_dyn(real ts)      // input:  time (Myr)
00111 {return ts*t_conv_star_to_dyn;}                 // return: time (code)
00112 
00113 real starbase::conv_m_dyn_to_star(real md)      // input:  mass (code)
00114 {return md/m_conv_star_to_dyn;}                 // return: mass (solar)
00115 
00116 real starbase::conv_r_dyn_to_star(real rd)      // input:  length (code)
00117 {return rd/r_conv_star_to_dyn;}                 // return: length (solar)
00118 
00119 real starbase::conv_t_dyn_to_star(real td)      // input:  time (code)
00120 {return td/t_conv_star_to_dyn;}                 // return: time (Myr)
00121 
00122 // Needed for elegant stellar creation, but makes things less clean...
00123 stellar_type starbase::get_element_type() {return NAS;}
00124 
00125 real starbase::sudden_mass_loss() {return 0;}

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