Ejemplo n.º 1
0
void get_intern_set()
{
  char *n[MAX_INTERN_SET],key[MAX_INTERN_SET],ch;
  int i,j;
  int count=Nintern_set;
  Window temp=main_win;
  if(count==0)return;
  for(i=0;i<Nintern_set;i++){
    n[i]=(char *)malloc(256);
    key[i]='a'+i;
    sprintf(n[i],"%c: %s",key[i],intern_set[i].name);
  }
  key[count]=0;
  ch=(char)pop_up_list(&temp,"Param set",n,key,count,12,0,10,0,
		       no_hint,info_pop,info_message);
   for(i=0;i<count;i++)free(n[i]);
  j=(int)(ch-'a');
  if(j<0||j>=Nintern_set){
    err_msg("Not a valid set");
    return;
  }
  /* plintf(" Got set %d \n",j); */
  get_graph();
  extract_internset(j);
  chk_delay();
  redraw_params();
  redraw_ics();
  reset_graph();
}
Ejemplo n.º 2
0
Archivo: calc.c Proyecto: tommie/xppaut
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);
}
Ejemplo n.º 3
0
void find_bvp_com(int com) {
  int ishow = 0, iret;
  int iper = 0, ivar = 0, ipar = 0, pflag;
  double sect = 0.0;
  double oldpar;
  double ystart[MAXODE], oldtrans;
  double yend[MAXODE];
  /*  Window temp=main_win; */
  if (NMarkov > 0 || NKernel > 0) {
    err_msg("Can't do BVP with integral or markov eqns");
    return;
  }
  wipe_rep();
  data_back();
  compile_bvp();
  if (FFT || HIST || DelayFlag || BVP_FLAG == 0)
    return;
  STORFLAG = 0;
  RANGE_FLAG = 1;
  POIMAP = 0;
  oldtrans = TRANS;
  TRANS = 0.0;
  get_ic(1, ystart);
  switch (com) {
  case 0:
    do_sh_range(ystart, yend);
    return;
  case 4:
    set_up_homoclinic();
    return;
  case 3:
    if (NUPAR == 0)
      goto bye;
    pflag = set_up_periodic(&ipar, &ivar, &sect, &ishow);
    if (pflag == 0)
      goto bye;
    iper = 1;
    get_val(upar_names[ipar], &oldpar);
    break;

  case 2:
    ishow = 1;
    iper = 0;
    break;
  case 1:
  default:
    iper = 0;
    break;
  }
  if (iper)
    bvshoot(ystart, yend, BVP_TOL, BVP_EPS, BVP_MAXIT, &iret, NODE, ishow, iper,
            ipar, ivar, sect);
  else
    bvshoot(ystart, yend, BVP_TOL, BVP_EPS, BVP_MAXIT, &iret, NODE, ishow, 0, 0,
            0, 0.0);
  bad_shoot(iret);
  if (iret == GOODSHOT || iret == NOCHANGE) {
    get_ic(0, ystart);
    redraw_ics();
    if (ishow) {
      reset_graphics();
    }
    last_shot(1);
    INFLAG = 1;
    set_browser_data(storage, storind, NEQ + 1);
    auto_freeze_it();
    ping();
  } else if (iper)
    set_val(upar_names[ipar], oldpar);

bye:
  TRANS = oldtrans;
}