1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
|
#include "autevd.h"
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include "auto_nox.h"
#include "diagram.h"
#include "diagram.h"
#include "gear.h"
#include "auto_c.h"
#include "auto_def2.h"
#include "autlim.h"
#include "xAuto.h"
#define SPECIAL 5
#define SPER 3
#define UPER 4
#define SEQ 1
#define UEQ 2
#define ESCAPE 27
#define MAXDIMHET 12
#define MAXDIMHOM 24
extern double outperiod[20];
extern integer UzrPar[20];
extern int NAutoUzr;
extern ADVAUTO aauto;
XAUTO xAuto;
extern int AutoTwoParam;
int DiagFlag=0;
/*typedef struct {double r,i;} ddoublecomplex;
typedef struct {
int pt,br;
double evr[NAUTO],evi[NAUTO];
} EIGVAL;
*/
EIGVAL my_ev;
double sign();
int imin();
void init_auto(ndim,nicp,nbc,ips,irs,ilp,ntst,isp,isw,nmx,npr,
ds,dsmin,dsmax,rl0,rl1,a0,a1,
ip1,ip2,ip3,ip4,ip5,nuzr,epsl,epsu,epss,ncol)
int ndim,nicp,nbc,ips,irs,ilp,ntst,isp,isw,nmx,npr,ip1,ip2;
int nuzr,ncol,ip3,ip4,ip5;
double ds,dsmin,dsmax,rl0,rl1,a0,a1,epsl,epsu,epss;
{
/* here are the constants that we do not allow the user to change */
int nnbc;
int i;
xAuto.iad=aauto.iad;
xAuto.iplt=0;
xAuto.mxbf=aauto.mxbf;
xAuto.iid=aauto.iid;
xAuto.itmx=aauto.itmx;
xAuto.itnw=aauto.itnw;
xAuto.nwtn=aauto.nwtn;
xAuto.jac=0;
xAuto.iads=aauto.iads;
xAuto.nthl=1;
xAuto.ithl[0]=10;
xAuto.thl[0]=0.0;
xAuto.nint=0;
if(ips==4)
nnbc=ndim;
else
nnbc=0;
xAuto.ndim=ndim;
xAuto.nbc=nnbc;
xAuto.ips=ips;
xAuto.irs=irs;
xAuto.ilp=ilp;
xAuto.nicp=nicp;
xAuto.icp[0]=ip1;
xAuto.icp[1]=ip2;
xAuto.icp[2]=ip3;
xAuto.icp[3]=ip4;
xAuto.icp[4]=ip5;
xAuto.ntst=ntst;
xAuto.ncol=ncol;
xAuto.isp=isp;
xAuto.isw=isw;
xAuto.nmx=nmx;
xAuto.rl0=rl0;
xAuto.rl1=rl1;
xAuto.a0=a0;
xAuto.a1=a1;
xAuto.npr=npr;
xAuto.epsl=epsl;
xAuto.epss=epss;
xAuto.epsu=epsu;
xAuto.ds=ds;
xAuto.dsmax=dsmax;
xAuto.dsmin=dsmin;
xAuto.nuzr=NAutoUzr;
for(i=0;i<NAutoUzr;i++){
xAuto.iuz[i]=UzrPar[i];
xAuto.vuz[i]=outperiod[i];
}
}
void send_eigen(ibr,ntot,n,ev)
int ibr,ntot,n;
doublecomplex *ev;
{
int i;
double er,cs,sn;
my_ev.pt=abs(ntot);
my_ev.br=abs(ibr);
for(i=0;i<n;i++){
er=exp((ev+i)->r);
cs=cos((ev+i)->i);
sn=sin((ev+i)->i);
my_ev.evr[i]=er*cs;
my_ev.evi[i]=er*sn;
}
}
void send_mult(ibr,ntot,n,ev)
int ibr,ntot,n;
doublecomplex *ev;
{
int i;
my_ev.pt=abs(ntot);
my_ev.br=abs(ibr);
for(i=0;i<n;i++){
my_ev.evr[i]=(ev+i)->r;
my_ev.evi[i]=(ev+i)->i;
}
}
/* Only unit 8,3 or q.prb is important; all others are unnecesary */
int get_bif_type(ibr,ntot,lab)
int ibr,ntot,lab;
{
int type=SEQ;
if(ibr<0&&ntot<0)type=SPER;
if(ibr<0&&ntot>0)type=UPER;
if(ibr>0&&ntot>0)type=UEQ;
if(ibr>0&&ntot<0)type=SEQ;
/* if(lab>0)type=SPECIAL; */
return(type);
}
void addbif(iap_type *iap, rap_type *rap, integer ntots, integer ibrs, double *par,integer *icp,int lab, double *a, double *uhigh, double *ulow, double *u0, double *ubar)
{
int type;
/*int evflag=0; Not used*/
int icp1=icp[0],icp2=icp[1],icp3=icp[2],icp4=icp[3];
double per=par[10];
/* printf("In add bif \n"); */
type=get_bif_type(ibrs,ntots,lab);
/*if(my_ev.br==abs(*ibr)&&my_ev.pt==abs(*ntot)){evflag=1;}*/
if(iap->ntot==1)
{
add_point(par,per,uhigh,ulow,ubar,*a,type,0,lab,
iap->nfpr,icp1,icp2,icp3,icp4,AutoTwoParam,my_ev.evr,my_ev.evi);
}
else
{
add_point(par,per,uhigh,ulow,ubar,*a,type,1,lab,
iap->nfpr,icp1,icp2,icp3,icp4,AutoTwoParam,my_ev.evr,my_ev.evi);
}
if(DiagFlag==0){
/* start_diagram(*ndim); */
edit_start(ibrs,ntots,iap->itp,lab,iap->nfpr,*a,uhigh,ulow,u0,ubar,
par,per,iap->ndim,icp1,icp2,icp3,icp4,my_ev.evr,my_ev.evi);
DiagFlag=1;
return;
}
add_diagram(ibrs,ntots,iap->itp,lab,iap->nfpr,*a,uhigh,ulow,u0,ubar,
par,per,iap->ndim,icp1,icp2,icp3,icp4,AutoTwoParam,my_ev.evr,
my_ev.evi);
}
double etime_(z)
double *z;
{
return(0.0);
}
int eigrf_(a,n,m,ecv,work,ier)
double *a,*work;
int *n,*m,*ier;
doublecomplex *ecv;
{
double ev[400];
int i;
eigen(*n,a,ev,work,ier);
for(i=0;i<*n;i++){
(ecv+i)->r=ev[2*i];
(ecv+i)->i=ev[2*i+1];
}
return 0;
}
|