#include /* this is the main integrator routine for phase-plane It takes the steps looks at the interrupts, plots and stores the data It also loads the delay stuff if required */ /* New stuff for 9/96 -- cvode added cvode(command,y,t,n,tout,kflag,atol,rtol) command =0 continue, 1 is start 2 finish kflag is error < 0 is bad -- call cvode_err_msg(kflag) call end_cv() to end it normally on return y is new stuff, t is new time kflag is error if any if kflag < 0 thats bad NOTE: except for the structure MyGraph, it is "x-free" so it is completely portable */ #include #include #include #include #include "xpplim.h" #include "struct.h" #include "phsplan.h" extern GRAPH *MyGraph; #include "menudrive.h" #define MSWTCH(u,v) memcpy((void *)(u),(void *)(v),xpv.node*sizeof(double)) #define READEM 1 #define ESCAPE 27 #define FIRSTCOLOR 30 #define MAX_LEN_SBOX 25 #define PARAM 1 #define IC 2 #define BMAXCOL 20 #define MAXFP 400 #define NAR_IC 50 #define VOLTERRA 6 #define BACKEUL 7 #define RKQS 8 #define STIFF 9 #define GEAR 5 #define CVODE 10 #define DP5 11 #define DP83 12 #define RB23 13 extern int animation_on_the_fly; extern double ShootIC[8][MAXODE]; extern int ShootICFlag; extern int ShootIndex; extern int SimulPlotFlag,current_pop,num_pops,ActiveWinList[]; typedef struct { int index0,type; char formula[256]; int n; char var[20]; int j1,j2; } ARRAY_IC; int ar_ic_defined=0; double ndrand48(); ARRAY_IC ar_ic[NAR_IC]; typedef struct { int n,flag; double *x[MAXFP]; double *er[MAXFP]; double *em[MAXFP]; } FIXPTLIST; FIXPTLIST fixptlist; typedef struct { int n; double tol; double xlo[MAXODE],xhi[MAXODE]; } FIXPTGUESS; FIXPTGUESS fixptguess; typedef struct { int nvec,node; double *x; } XPPVEC; XPPVEC xpv; int SuppressBounds=0; extern char *info_message,*ic_hint[],*sing_hint[]; extern int Xup,batch_range; extern char batchout[256]; double atof(); extern int NMarkov,STOCH_FLAG; extern int color_total,SCALEY,DCURY,PSFlag,PointRadius; int DelayErr; float **get_browser_data(); double get_ivar(); double MyData[MAXODE],MyTime; int MyStart; extern int DelayFlag,DCURY,NKernel; int RANGE_FLAG; extern int PAR_FOL,SHOOT; extern char upar_names[MAXPAR][11]; extern double last_ic[MAXODE]; double LastTime; extern double DELAY; extern int R_COL; extern int colorline[11]; extern (*rhs)(); int STOP_FLAG=0; int PSLineStyle; struct { char item[30]; int steps,shoot,col,movie; double plow,phigh; } eq_range; struct { char item[30],item2[30]; int steps,steps2,reset,oldic,index,index2,cycle,type,type2,movie; double plow,phigh,plow2,phigh2; int rtype; } range; #define MAX_INTERN_SET 100 typedef struct { char *name; char *does; } INTERN_SET; extern INTERN_SET intern_set[MAX_INTERN_SET]; extern int Nintern_set; int (*solver)(); init_ar_ic() { int i; for(i=0;i(NEQ+1))eq_range.col=-1; return(1); } return(0); } cont_integ() { double tetemp; double *x; double dif; if(INFLAG==0||FFT!=0||HIST!=0)return; tetemp=TEND; wipe_rep(); data_back(); if(new_float("Continue until:",&tetemp)==-1)return; x=&MyData[0]; tetemp=fabs(tetemp); if(fabs(MyTime)>=tetemp)return; dif=tetemp-fabs(MyTime); /* TEND=tetemp; */ MyStart=1; /* I know it is wasteful to restart, but lets be safe.... */ integrate(&MyTime,x,dif,DELTA_T,1,NJMP,&MyStart); ping(); refresh_browser(storind); } 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; } range_item2() { int i; char bob[256]; i=find_user_name(PARAM,range.item2); if(i>-1){ range.type2=PARAM; range.index2=i; } else { i=find_user_name(IC,range.item2); if(i<=-1){ sprintf(bob," %s is not a parameter or variable !",range.item2); err_msg(bob); return(0); } range.type2=IC; range.index2=i; } return 1; } set_up_range() { static char *n[]={"*3Range over","Steps","Start","End", "Reset storage (Y/N)", "Use old ic's (Y/N)","Cycle color (Y/N)","Movie(Y/N)"}; char values[8][MAX_LEN_SBOX]; int status,i; static char *yn[]={"N","Y"}; if(!Xup){ return(range_item()); } sprintf(values[0],"%s",range.item); sprintf(values[1],"%d",range.steps); sprintf(values[2],"%.16g",range.plow); sprintf(values[3],"%.16g",range.phigh); sprintf(values[4],"%s",yn[range.reset]); sprintf(values[5],"%s",yn[range.oldic]); sprintf(values[6],"%s",yn[range.cycle]); sprintf(values[7],"%s",yn[range.movie]); status=do_string_box(8,8,1,"Range Integrate",n,values,45); if(status!=0){ strcpy(range.item,values[0]); /* 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){ err_msg("No such name!"); return(0); } range.type=IC; range.index=i; } */ if(range_item()==0)return 0; range.steps=atoi(values[1]); if(range.steps<=0)range.steps=10; range.plow=atof(values[2]); range.phigh=atof(values[3]); if(values[4][0]=='Y'||values[4][0]=='y')range.reset=1; else range.reset=0; if(values[5][0]=='Y'||values[5][0]=='y')range.oldic=1; else range.oldic=0; if(values[6][0]=='Y'||values[6][0]=='y')range.cycle=1; else range.cycle=0; if(values[7][0]=='Y'||values[7][0]=='y')range.movie=1; else range.movie=0; /* printf("%s %d %d %d (%d %d) %f %f ", range.item, range.steps, range.reset,range.oldic,range.type,range.index, range.plow,range.phigh);*/ RANGE_FLAG=1; return(1); } return(0); } set_up_range2() { static char *n[]={"*3Vary1","Start1","End1", "*3Vary2","Start2","End2","Steps", "Reset storage (Y/N)", "Use old ic's (Y/N)","Cycle color (Y/N)","Movie(Y/N)", "Crv(1) Array(2)","Steps2"}; char values[13][MAX_LEN_SBOX]; int status,i; static char *yn[]={"N","Y"}; if(!Xup){ return(range_item()); } sprintf(values[0],"%s",range.item); sprintf(values[1],"%.16g",range.plow); sprintf(values[2],"%.16g",range.phigh); sprintf(values[3],"%s",range.item2); sprintf(values[4],"%.16g",range.plow2); sprintf(values[5],"%.16g",range.phigh2); sprintf(values[6],"%d",range.steps); sprintf(values[7],"%s",yn[range.reset]); sprintf(values[8],"%s",yn[range.oldic]); sprintf(values[9],"%s",yn[range.cycle]); sprintf(values[10],"%s",yn[range.movie]); if(range.rtype==2) sprintf(values[11],"2"); else sprintf(values[11],"1"); sprintf(values[12],"%d",range.steps2); status=do_string_box(13,7,2,"Double Range Integrate",n,values,45); if(status!=0){ strcpy(range.item,values[0]); if(range_item()==0)return 0; strcpy(range.item2,values[3]); if(range_item2()==0)return 0; range.steps=atoi(values[6]); range.steps2=atoi(values[12]); if(range.steps<=0)range.steps=10; if(range.steps2<=0)range.steps2=10; range.plow=atof(values[1]); range.phigh=atof(values[2]); range.plow2=atof(values[4]); range.phigh2=atof(values[5]); if(values[7][0]=='Y'||values[7][0]=='y')range.reset=1; else range.reset=0; if(values[8][0]=='Y'||values[8][0]=='y')range.oldic=1; else range.oldic=0; if(values[9][0]=='Y'||values[9][0]=='y')range.cycle=1; else range.cycle=0; if(values[10][0]=='Y'||values[10][0]=='y')range.movie=1; else range.movie=0; range.rtype=atoi(values[11]); RANGE_FLAG=1; return(1); } return(0); } init_monte_carlo() { int i; fixptguess.tol=.001; fixptguess.n=100; for(i=0;i=NODE) break; } do_monte_carlo_search(append, 1); } do_monte_carlo_search(int append, int stuffbrowse) { int i,j,k,m,n=fixptguess.n; int ierr,new=1; double x[MAXODE],sum; double er[MAXODE],em[MAXODE]; if(append==0) fixptlist.n=0; if(fixptlist.flag==0){ for(i=0;i0)storage[stabcol-1][storind]=stabinfo; storind++; if(ENDSING==1)break; } refresh_browser(storind); PAR_FOL=0; } swap_color(col,rorw) int *col,rorw; { if(rorw)MyGraph->color[0]=*col; else *col=MyGraph->color[0]; } set_cycle(flag,icol) int flag,*icol; { if(flag==0)return; MyGraph->color[0]=*icol+1; *icol=*icol+1; if(*icol==10)*icol=0; } do_range(x,flag) double *x; int flag; /* 0 for 1-param 1 for 2 parameter */ { char esc; char bob[50]; int ivar=0,ivar2,res=0,oldic=0; int nit=20,i,j,itype,itype2,cycle=0,icol=0,nit2,iii; int color=MyGraph->color[0]; double t,dpar,plow=0.0,phigh=1.0,p,plow2,phigh2,p2,dpar2; double temp,temp2; int ierr=0; if(flag==0){ range.rtype=0; if(set_up_range()==0)return(-1); } else { if(set_up_range2()==0)return -1; } MyStart=1; itype=range.type; ivar=range.index; res=range.reset; oldic=range.oldic; nit=range.steps; plow=range.plow; phigh=range.phigh; cycle=range.cycle; dpar=(phigh-plow)/(double)nit; get_ic(2,x); storind=0; STORFLAG=1; PAUSER=0; nit2=0; if(range.rtype==2)nit2=range.steps2; if(range.type==PARAM)get_val(range.item,&temp); alloc_liap(nit); /* make space */ if(range.rtype>0){ itype2=range.type2; ivar2=range.index2; plow2=range.plow2; phigh2=range.phigh2; if(range.rtype==2)dpar2=(phigh2-plow2)/(double)nit2; else dpar2=(phigh2-plow2)/(double)nit; if(range.type2==PARAM)get_val(range.item2,&temp2); } if(range.movie)reset_film(); for(j=0;j<=nit2;j++){ for(i=0;i<=nit;i++) { if(range.movie)clear_draw_window(); if(cycle)MyGraph->color[0]=icol+1; icol++; if(icol==10)icol=0; p=plow+dpar*(double)i; if(range.rtype==1) p2=plow2+dpar2*(double)i; if(range.rtype==2) p2=plow2+dpar2*(double)j; if(oldic==1){ get_ic(1,x); if(DelayFlag){ /* restart initial data */ if(do_init_delay(DELAY)==0)break; } } t=T0; MyStart=1; POIEXT=0; if(itype==IC)x[ivar]=p; else { set_val(range.item,p); redo_all_fun_tables(); re_evaluate_kernels(); } if(range.rtype>0){ if(itype2==IC)x[ivar2]=p2; else { set_val(range.item2,p2); redo_all_fun_tables(); re_evaluate_kernels(); } } if(Xup){ if(range.rtype>0) sprintf(bob,"%s=%.16g %s=%.16g",range.item,p,range.item2,p2); else sprintf(bob,"%s=%.16g i=%d",range.item,p,i); bottom_msg(2,bob); } do_start_flags(x,&MyTime); if(fabs(MyTime)>=TRANS&&STORFLAG==1&&POIMAP==0) { storage[0][0]=(float)MyTime; extra(x,MyTime,NODE,NEQ); for(iii=0;iii2)auto_freeze_it(); if(res==1||STOCH_FLAG) { if(batch_range==1) write_this_run(batchout,i); storind=0; } } } if(oldic==1)get_ic(1,x); else get_ic(0,x); if(range.type==PARAM)set_val(range.item,temp); if(range.rtype>0) if(range.type2==PARAM)set_val(range.item2,temp2); evaluate_derived(); MyGraph->color[0]=color; INFLAG=1; /* refresh_browser(storind); */ ping(); if(STOCH_FLAG) do_stats(nit,ierr); return(ierr); } find_equilib_com(int com) { int i,ierr; float xm,ym; int im,jm; int iv,jv; float stabinfo; double *x,oldtrans; x=&MyData[0]; if(FFT||HIST||NKernel>0)return; STORFLAG=0; POIMAP=0; oldtrans=TRANS; TRANS=0.0; evaluate_derived(); switch(com){ case 2: do_eq_range(x); return; case 1: /* Get mouse values */ iv=MyGraph->xv[0]-1; jv=MyGraph->yv[0]-1; if(iv<0||iv>=NODE||jv<0||jv>=NODE||MyGraph->grtype>=5||jv==iv){ err_msg("Not in useable 2D plane..."); return; } /* get mouse click x,y */ get_ic(1,x); MessageBox("Click on guess"); if(GetMouseXY(&im,&jm)){ scale_to_real(im,jm,&xm,&ym); x[iv]=(double)xm; x[jv]=(double)ym; } KillMessageBox(); break; case 3: monte_carlo(); return; case 0: default: get_ic(2,x); break; } if(DelayFlag){ do_delay_sing(x,NEWT_ERR,EVEC_ERR,BOUND,EVEC_ITER,NODE,&ierr,&stabinfo); ping(); } else do_sing(x,NEWT_ERR,EVEC_ERR,BOUND,EVEC_ITER,NODE,&ierr,&stabinfo); TRANS=oldtrans; } batch_integrate() { int i; if(Nintern_set==0){ batch_integrate_once(); return; } for(i=0;i0){ reset_dae(); RANGE_FLAG=1; if(do_range(x,0)!=0) printf(" Errors occured in range integration \n"); } else { get_ic(2,x); if(DelayFlag){ /* restart initial data */ if(do_init_delay(DELAY)==0)return; } do_start_flags(x,&MyTime); if(fabs(MyTime)>=TRANS&&STORFLAG==1&&POIMAP==0) { storage[0][0]=(float)MyTime; extra(x,MyTime,NODE,NEQ); for(i=0;ixv[0]-1; jv=MyGraph->yv[0]-1; if(iv<0||iv>=NODE||jv<0||jv>=NODE||MyGraph->grtype>=5||jv==iv){ err_msg("Not in useable 2D plane..."); return; } /* Get mouse values */ if(com==M_IM){ get_ic(1,x); MessageBox("Click on initial data"); if(GetMouseXY(&im,&jm)){ scale_to_real(im,jm,&xm,&ym); im=MyGraph->xv[0]-1; jm=MyGraph->yv[0]-1; x[iv]=(double)xm; x[jv]=(double)ym; last_ic[im]=x[im]; last_ic[jm]=x[jm]; KillMessageBox(); if(DelayFlag){ /* restart initial data */ if(do_init_delay(DELAY)==0)return; } } else { KillMessageBox(); return; } } else { SuppressBounds=1; MessageBox("Click on initial data -- ESC to quit"); while(1){ get_ic(1,x); badmouse=GetMouseXY(&im,&jm); if(badmouse==0)break; scale_to_real(im,jm,&xm,&ym); im=MyGraph->xv[0]-1; jm=MyGraph->yv[0]-1; x[iv]=(double)xm; x[jv]=(double)ym; last_ic[im]=x[im]; last_ic[jm]=x[jm]; if(DelayFlag){ /* restart initial data */ if(do_init_delay(DELAY)==0)break; } MyStart=1; MyTime=T0; usual_integrate_stuff(x); } KillMessageBox(); SuppressBounds=0; return; } break; case M_IN: man_ic(); get_ic(2,x); set_init_guess(); break; case M_IU: if(form_ic()==0)return; get_ic(2,x); break; case M_IH: if(ShootICFlag==0){ err_msg("No shooting data available"); break; } sprintf(sr,"Which? (1-%d)",ShootIndex); si=1; new_int(sr,&si); si--; if(si=0){ for(i=0;i=TRANS&&STORFLAG==1&&POIMAP==0) { storage[0][0]=(float)MyTime; extra(x,MyTime,NODE,NEQ); for(i=0;i0){ subsk(f,fp,j,1); flag=do_calc(fp,&z); if(flag!=-1) last_ic[i-1]=z; else return; } } } extract_ic_data(char *big) { int i,n,j; int j1,j2,flag2; char front[40],new[50],c; char back[256]; de_space(big); i=0; n=strlen(big); while(1){ c=big[i]; if(c=='(')break; front[i]=c; i++; if(i>=n){ return(-1); } } front[i]=0; /* lets find the back part */ i=i+4; for(j=i;jNODE||in>NODE)return 0; /* out of bounds */ for(i=i1;i TOR_PERIOD) { x[ieqn] -= TOR_PERIOD; torcross[ieqn]=-1; /* for (ip = 0; ip < NPlots; ip++) { if (ieqn == IYPLT[ip]-1) oldypl[ip] -= (float) TOR_PERIOD; if (ieqn == IXPLT[ip]-1) oldxpl[ip] -= (float) TOR_PERIOD; if ((ieqn == IZPLT[ip]-1) && (PLOT_3D == 1)) oldzpl[ip] -= (float) TOR_PERIOD; } */ } if (x[ieqn] < 0) { x[ieqn] += TOR_PERIOD; torcross[ieqn]=1; /* for (ip = 0; ip < NPlots; ip++) { if (ieqn == IYPLT[ip]-1) oldypl[ip] += (float) TOR_PERIOD; if (ieqn == IXPLT[ip]-1) oldxpl[ip] += (float) TOR_PERIOD; if ((ieqn == IZPLT[ip]-1) && (MyGraph->ThreeDFlag == 1)) oldzpl[ip] += (float) TOR_PERIOD; } */ } } } } xvold[0]=xv[0]; for(ieqn=1;ieqn<(NEQ+1);ieqn++) { xvold[ieqn]=xv[ieqn]; xv[ieqn]=(float)x[ieqn-1]; /* trap NaN using isnan() in math.h modified the out of bounds message as well print all the variables on the terminal window, haven't decide should I store them or not. If use with nout=1, can pinpoint the offensive variable(s) */ if(isnan(x[ieqn-1])!=0) { sprintf(error_message," %s is NaN at t = %f ", uvar_names[ieqn-1],*t); /* if((STORFLAG==1)&&(storindBOUND) { if(RANGE_FLAG||SuppressBounds)break; sprintf(error_message," %s out of bounds at t = %f ", uvar_names[ieqn-1],*t); /* if((STORFLAG==1)&&(storindx[POIVAR-1])&&!(POIEXT>0))POIEXT=-1; if( ( !(oldx[POIVAR-1]0) )|| ( !(oldx[POIVAR-1]>x[POIVAR-1]) && (POIEXT<0) ) ) { if(POISGN*POIEXT>=0) { /* We will interpolate to get a good local extremum */ rhs(*t,x,xprime,NEQ); rhs(oldt,oldx,oldxprime,NEQ); dxp=xprime[POIVAR-1]-oldxprime[POIVAR-1]; if(dxp==0.0){ err_msg("Cannot zero RHS for max/min - use a variable"); return(1); } dint=xprime[POIVAR-1]/dxp; tv=(1-dint)**t+dint*oldt; xv[0]=tv; for(i=1;i<=NEQ;i++)xv[i]=dint*oldx[i-1]+(1-dint)*x[i-1]; pflag=1; } POIEXT=-POIEXT; } goto poi; } /* here is code for a formula type map -- F(X,t)=0 */ if(POIMAP==4) { /* pmapf=get_map_value(x,*t); */ } if(POIMAP==1||POIMAP==3) { if(POIVAR==0) { sect1=fmod(fabs(oldt),fabs(POIPLN)); sect=fmod(fabs(*t),fabs(POIPLN)); if(sect0)) { if((oldx[POIVAR-1]>POIPLN)&&!(x[POIVAR-1]>POIPLN)) { dint=(x[POIVAR-1]-POIPLN)/(x[POIVAR-1]-oldx[POIVAR-1]); tv=(1-dint)**t+dint*oldt; xv[0]=tv; for(i=1;i<=NEQ;i++)xv[i]=dint*oldx[i-1]+(1-dint)*x[i-1]; pflag=1; } else pflag=0; } } poi: for(i=0;i=nit&&count!=0)break; /* END POST INTEGRATE ANALYSIS */ } LastTime=*t; #ifdef CVODE_YES if(METHOD==CVODE) end_cv(); #endif return(rval); } send_halt(double *y, double t) { STOP_FLAG=1; } send_output(double *y,double t) { double yy[MAXODE]; int i; for(i=0;invars; for(ip=0;ipColorFlag==0){ set_linestyle(MyGraph->color[ip]); } /* if(MyGraph->line[ip]<0) continue; */ if(MyGraph->line[ip]<=0) { PointRadius=-MyGraph->line[ip]; if(MyGraph->ThreeDFlag==0) point_abs(xpl[ip],ypl[ip]); else point_3d(xpl[ip],ypl[ip],zpl[ip]); } else { if(MyGraph->ThreeDFlag==0){ line_abs(oldxpl[ip],oldypl[ip],xpl[ip],ypl[ip]); } else line_3d(oldxpl[ip],oldypl[ip],oldzpl[ip], xpl[ip],ypl[ip],zpl[ip]); } } } /* old restore is in restore.c */ export_data(fp) FILE *fp; { int ip,np=MyGraph->nvars; int ZSHFT,YSHFT,XSHFT; int i,j,kxoff,kyoff,kzoff; int iiXPLT,iiYPLT,iiZPLT; int strind=get_maxrow_browser(); int i1=0,i2=strind; float **data; data=get_browser_data(); XSHFT=MyGraph->xshft; YSHFT=MyGraph->yshft; ZSHFT=MyGraph->zshft; if(i1xv[0]; iiYPLT=MyGraph->yv[0]; if(MyGraph->ThreeDFlag>0){ iiZPLT=MyGraph->zv[0]; for(j=i1;jyv[ip]; fprintf(fp,"%g ",data[iiYPLT][kyoff]); } fprintf(fp,"\n"); kxoff++; kyoff++; kzoff++; } return; } plot_the_graphs(float *xv,float *xvold,int node,int neq,double ddt,int *tc) { int i; int ic=current_pop; if(SimulPlotFlag==0){ plot_one_graph(xv,xvold,node,neq,ddt,tc); return; } for(i=0;invars; IXPLT=MyGraph->xv; IYPLT=MyGraph->yv; IZPLT=MyGraph->zv; for(ip=0;ipColorFlag) comp_color(xv,xvold,NODE,(float)ddt); do_plot(oldxpl,oldypl,oldzpl,xpl,ypl,zpl); } restore(i1,i2) int i1,i2; { int ip,np=MyGraph->nvars; int ZSHFT,YSHFT,XSHFT; int i,j,kxoff,kyoff,kzoff; int iiXPLT,iiYPLT,iiZPLT; float oldxpl,oldypl,oldzpl,xpl,ypl,zpl; float v1[MAXODE+1],v2[MAXODE+1]; float **data; data=get_browser_data(); XSHFT=MyGraph->xshft; YSHFT=MyGraph->yshft; ZSHFT=MyGraph->zshft; if(i1xv[ip]; iiYPLT=MyGraph->yv[ip]; iiZPLT=MyGraph->zv[ip]; set_linestyle(MyGraph->color[ip]); oldxpl=data[iiXPLT][kxoff]; oldypl=data[iiYPLT][kyoff]; oldzpl=data[iiZPLT][kzoff]; for(i=i1;i(float)(.5*TOR_PERIOD))oldxpl=xpl; if (fabs(oldypl-ypl)>(float)(.5*TOR_PERIOD))oldypl=ypl; if (fabs(oldzpl-zpl)>(float)(.5*TOR_PERIOD))oldzpl=zpl; } if(MyGraph->ColorFlag!=0&&i>i1){ for(j=0;j<=NEQ;j++){ v1[j]=data[j][i]; v2[j]=data[j][i-1]; } comp_color(v1,v2,NODE, (float)fabs(data[0][i]-data[0][i+1])); } /* ignored by postscript */ /* if(MyGraph->line[ip]<0) goto noplot; */ if(MyGraph->line[ip]<=0){ PointRadius=-MyGraph->line[ip]; if(MyGraph->ThreeDFlag==0)point_abs(xpl,ypl); else point_3d(xpl,ypl,zpl); } else { if(MyGraph->ThreeDFlag==0) line_abs(oldxpl,oldypl,xpl,ypl); else line_3d(oldxpl,oldypl,oldzpl,xpl,ypl,zpl); } noplot: oldxpl=xpl; oldypl=ypl; oldzpl=zpl; kxoff++; kyoff++; kzoff++; } } } /* Sets the color according to the velocity or z-value */ comp_color( v1,v2,n, dt) float *v1, *v2; int n; float dt; { int i,cur_color; float sum; float min_scale=(float)(MyGraph->min_scale); float color_scale=(float)(MyGraph->color_scale); if(MyGraph->ColorFlag==2){ sum=v1[MyGraph->ColorValue]; /* printf(" %d:sum=%g \n",MyGraph->zv[0],sum); */ } else { for(i=0,sum=0.0;icolor_total)cur_color=color_total-1; cur_color+=FIRSTCOLOR; set_color(cur_color); ps_do_color(cur_color); } shoot(x,xg,evec,sgn) double *x,*xg,*evec; int sgn; { int i; double t=0.0; for(i=0;i