int set_up_periodic(int *ipar, int *ivar, double *sect, int *ishow) { static char *n[] = {"Freq. Par.", "*1Sect. Var", "Section", "Show(Y/N)"}; char values[4][MAX_LEN_SBOX]; int status, i; static char *yn[] = {"N", "Y"}; sprintf(values[0], "%s", upar_names[*ipar]); sprintf(values[1], "%s", uvar_names[*ivar]); sprintf(values[2], "%g", *sect); sprintf(values[3], "%s", yn[*ishow]); status = do_string_box(4, 4, 1, "Periodic BCs", n, values, 45); if (status != 0) { i = find_user_name(PARAMBOX, values[0]); if (i > -1) *ipar = i; else { err_msg("No such parameter"); return (0); } i = find_user_name(ICBOX, values[1]); if (i > -1) *ivar = i; else { err_msg("No such variable"); return (0); } *sect = atof(values[2]); if (values[3][0] == 'Y' || values[3][0] == 'y') *ishow = 1; else *ishow = 0; return (1); } return (0); }
int set_up_homoclinic(void) { static char *n[] = {"*1Left Eq.", "*1Right Eq.", "NUnstable", "NStable"}; char values[4][MAX_LEN_SBOX]; int status, i; sprintf(values[0], "%s", uvar_names[my_hom.eleft]); sprintf(values[1], "%s", uvar_names[my_hom.eright]); sprintf(values[2], "%d", my_hom.nunstab); sprintf(values[3], "%d", my_hom.nstab); status = do_string_box(4, 4, 1, "Homoclinic info", n, values, 45); HOMOCLINIC_FLAG = 0; if (status != 0) { i = find_user_name(ICBOX, values[0]); if (i > -1) my_hom.eleft = i; else { err_msg("No such variable"); return 0; } i = find_user_name(ICBOX, values[1]); if (i > -1) my_hom.eright = i; else { err_msg("No such variable"); return 0; } my_hom.nunstab = atoi(values[2]); my_hom.nstab = atoi(values[3]); my_hom.n = my_hom.nstab + my_hom.nunstab; Homo_n = my_hom.n; HOMOCLINIC_FLAG = 1; for (i = 0; i < 4; i++) my_hom.iflag[i] = 0; } return 1; }
int do_calc(char *temp, double *z) { char val[15]; int ok; int i; double newz; if (strlen(temp) == 0) { *z = 0.0; return (1); } if (has_eq(temp, val, &i)) { newz = calculate(&temp[i], &ok); /* calculate quantity */ if (ok == 0) return (-1); i = find_user_name(PARAMBOX, val); if (i > -1) { set_val(val, newz); /* a parameter set to value */ *z = newz; redraw_params(); } else { i = find_user_name(ICBOX, val); if (i < 0) { err_msg("No such name!"); return (-1); } set_val(val, newz); last_ic[i] = newz; *z = newz; redraw_ics(); } return (0); } newz = calculate(temp, &ok); if (ok == 0) return (-1); *z = newz; return (1); }
range_item() { int i; char bob[256]; i=find_user_name(PARAM,range.item); if(i>-1){ range.type=PARAM; range.index=i; } else { i=find_user_name(IC,range.item); if(i<=-1){ sprintf(bob," %s is not a parameter or variable !",range.item); err_msg(bob); return(0); } range.type=IC; range.index=i; } return 1; }
int set_up_sh_range(void) { static char *n[] = {"*2Range over", "Steps", "Start", "End", "Cycle color(Y/N)", "Side(0/1)", "Movie(Y/N)"}; char values[7][MAX_LEN_SBOX]; int status, i; static char *yn[] = {"N", "Y"}; sprintf(values[0], "%s", shoot_range.item); sprintf(values[1], "%d", shoot_range.steps); sprintf(values[2], "%g", shoot_range.plow); sprintf(values[3], "%g", shoot_range.phigh); sprintf(values[4], "%s", yn[shoot_range.cycle]); sprintf(values[5], "%d", shoot_range.side); sprintf(values[6], "%s", yn[shoot_range.movie]); status = do_string_box(7, 7, 1, "Range Shoot", n, values, 45); if (status != 0) { strcpy(shoot_range.item, values[0]); i = find_user_name(PARAMBOX, shoot_range.item); if (i < 0) { err_msg("No such parameter"); return (0); } shoot_range.steps = atoi(values[1]); if (shoot_range.steps <= 0) shoot_range.steps = 10; shoot_range.plow = atof(values[2]); shoot_range.phigh = atof(values[3]); if (values[4][0] == 'Y' || values[4][0] == 'y') shoot_range.cycle = 1; else shoot_range.cycle = 0; if (values[6][0] == 'Y' || values[6][0] == 'y') shoot_range.movie = 1; else shoot_range.movie = 0; shoot_range.side = atoi(values[5]); return (1); } return (0); }
set_up_eq_range() { static char *n[]={"Range over","Steps","Start","End", "Shoot (Y/N)", "Stability col","Movie (Y/N)"}; char values[7][MAX_LEN_SBOX]; int status,i; static char *yn[]={"N","Y"}; sprintf(values[0],"%s",eq_range.item); sprintf(values[1],"%d",eq_range.steps); sprintf(values[2],"%g",eq_range.plow); sprintf(values[3],"%g",eq_range.phigh); sprintf(values[4],"%s",yn[eq_range.shoot]); sprintf(values[5],"%d",eq_range.col); sprintf(values[6],"%s",yn[eq_range.movie]); status=do_string_box(7,7,1,"Range Equilibria",n,values,45); if(status!=0){ strcpy(eq_range.item,values[0]); i=find_user_name(PARAM,eq_range.item); if(i<0){ err_msg("No such parameter"); return(0); } eq_range.steps=atoi(values[1]); if(eq_range.steps<=0)eq_range.steps=10; eq_range.plow=atof(values[2]); eq_range.phigh=atof(values[3]); if(values[4][0]=='Y'||values[4][0]=='y')eq_range.shoot=1; else eq_range.shoot=0; if(values[6][0]=='Y'||values[6][0]=='y')eq_range.movie=1; else eq_range.movie=0; eq_range.col=atoi(values[5]); if(eq_range.col<=1||eq_range.col>(NEQ+1))eq_range.col=-1; return(1); } return(0); }