00001
00002
00003
00004
00005 #include "chydro.h"
00006 #include "util_io.h"
00007
00008 istream & chydro::scan_hydro_story(istream& s)
00009 {
00010 char input_line[MAX_INPUT_LINE_LENGTH];
00011
00012 while(get_line(s,input_line), strcmp(END_HYDRO, input_line)){
00013 char keyword[MAX_INPUT_LINE_LENGTH];
00014 char *val = getequals(input_line, keyword);
00015
00016 if(0){
00017 }else if(!strcmp("R_eff",keyword)){
00018 effective_radius = strtod(val, &val);
00019 }else if(!strcmp("M_core",keyword)){
00020 core_mass = strtod(val, &val);
00021 }else if(!strcmp("R_core",keyword)){
00022 core_radius = strtod(val, &val);
00023 }else if(!strcmp("mf",keyword)){
00024 m_conv_hydro_to_dyn = strtod(val, &val);
00025 }else if(!strcmp("rf",keyword)){
00026 r_conv_hydro_to_dyn = strtod(val, &val);
00027 }else if(!strcmp("tf",keyword)){
00028 t_conv_hydro_to_dyn = strtod(val, &val);
00029 }else{
00030 add_story_line(hydro_story, input_line);
00031 }
00032 }
00033 return s;
00034 }
00035
00036 ostream& chydro::print_hydro_story(ostream& s)
00037 {
00038 put_story_header(s, HYDRO_ID);
00039
00040 put_real_number(s, " R_eff = ", effective_radius);
00041 put_real_number(s, " M_core = ", core_mass);
00042 put_real_number(s, " R_core = ", core_radius);
00043
00044 put_real_number(s, " mf = ", m_conv_hydro_to_dyn);
00045 put_real_number(s, " rf = ", r_conv_hydro_to_dyn);
00046 put_real_number(s, " tf = ", t_conv_hydro_to_dyn);
00047
00048 if (hydro_story)
00049 put_story_contents(s, *hydro_story);
00050 put_story_footer(s, HYDRO_ID);
00051
00052 return s;
00053 }
00054