00001
00002
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
00019
00020
00021
00022
00023
00024
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
00037
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)
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
00057
00058
00059
00060
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
00072 bool starbase::get_use_hdyn() {return use_hdyn;}
00073 void starbase::set_use_hdyn(bool u) {use_hdyn = u;}
00074
00075
00076
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; }
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
00103
00104 real starbase::conv_m_star_to_dyn(real ms)
00105 {return ms*m_conv_star_to_dyn;}
00106
00107 real starbase::conv_r_star_to_dyn(real rs)
00108 {return rs*r_conv_star_to_dyn;}
00109
00110 real starbase::conv_t_star_to_dyn(real ts)
00111 {return ts*t_conv_star_to_dyn;}
00112
00113 real starbase::conv_m_dyn_to_star(real md)
00114 {return md/m_conv_star_to_dyn;}
00115
00116 real starbase::conv_r_dyn_to_star(real rd)
00117 {return rd/r_conv_star_to_dyn;}
00118
00119 real starbase::conv_t_dyn_to_star(real td)
00120 {return td/t_conv_star_to_dyn;}
00121
00122
00123 stellar_type starbase::get_element_type() {return NAS;}
00124
00125 real starbase::sudden_mass_loss() {return 0;}