-
Notifications
You must be signed in to change notification settings - Fork 13
/
autpp.c
executable file
·168 lines (129 loc) · 2.89 KB
/
autpp.c
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
#include <stdlib.h>
#include "auto_f2c.h"
#include "auto_nox.h"
#include "autlim.h"
#include "derived.h"
#include "pp_shoot.h"
#include "xAuto.h"
void getjactrans(double *x,double *y,double *yp,double *xp, double eps, double *d, int n);
extern XAUTO xAuto;
/* Hooks to xpp RHS */
extern int (*rhs)();
extern double constants[],last_ic[];
extern int Auto_index_to_array[8];
extern int NewPeriodFlag;
extern int AutoTwoParam,NAutoPar;
extern int HomoFlag;
extern double homo_l[100],homo_r[100];
extern int METHOD,NJMP;
extern double outperiod[];
extern int UzrPar[],NAutoUzr;
extern double NEWT_ERR;
int func(ndim, u, icp, par, ijac, f, dfdu, dfdp)
integer ndim,*icp,ijac;
double *u,*par,*f,*dfdu,*dfdp;
{
int i,j;
double zz[NAUTO];
double y[NAUTO],yp[NAUTO],xp[NAUTO];
for(i=0;i<NAutoPar;i++){
constants[Auto_index_to_array[i]]=par[i];
}
evaluate_derived();
rhs(0.0,u,f,ndim);
if(ijac==1){
getjactrans(u,y,yp,xp,NEWT_ERR,dfdu,ndim);
}
if(METHOD>0||NJMP==1)return 0;
for(i=1;i<NJMP;i++){
for(j=0;j<ndim;j++)
zz[j]=f[j];
rhs(0.0,zz,f,ndim);
}
return 0;
} /* func_ */
int stpnt(ndim,t,u,par)
integer ndim;
doublereal *u, *par,t;
{
int i;
double p;
for(i=0;i<NAutoPar;i++)
par[i] = constants[Auto_index_to_array[i]];
if(NewPeriodFlag==0){
for(i=0;i<ndim;i++)
u[i]=last_ic[i];
return 0;
}
get_start_period(&p);
par[10]=p;
if(HomoFlag!=1)get_start_orbit(u,t,p,ndim);
/* printf("%d %d %g %g %g %g \n",ndim,HomoFlag,t,u[0],u[1],p); */
if(HomoFlag==1){
get_shifted_orbit(u,t,p,ndim);
for(i=0;i<ndim;i++){
par[11+i]=homo_l[i];
}
}
if(HomoFlag==2){ /* heteroclinic */
for(i=0;i<ndim;i++){
par[11+i]=homo_l[i];
par[11+i+ndim]=homo_r[i];
}
}
return 0;
} /* stpnt_ */
/* Subroutine */ int bcnd(ndim, par, icp, nbc, u0, u1, ijac, fb, dbc)
integer ndim;
double *par;
integer *icp, nbc;
double *u0, *u1, *fb;
integer ijac;
double *dbc;
{
int i;
/* Hooks to the XPP bc parser!! */
for(i=0;i<NAutoPar;i++){
constants[Auto_index_to_array[i]]=par[i];
}
evaluate_derived();
do_bc(u0,0.0,u1,1.0,fb,nbc);
return 0;
} /* bcnd_ */
/* Subroutine */ int icnd(ndim, par, icp, nint, u, uold, udot, upold, fi,
ijac, dint)
integer *ndim;
double *par;
integer *icp, *nint;
double *u, *uold, *udot, *upold, *fi;
integer *ijac;
double *dint;
{
int i;
double dum=0.0;
/*
for(i=0;i<Homo_n;i++)
dum+=upold[i]*(u[i]-uold[i]);
fi[0]=dum;
*/
return 0;
} /* icnd_ */
/* Subroutine */ int fopt(ndim, u, icp, par, ijac, fs, dfdu, dfdp)
integer *ndim;
double *u;
integer *icp;
double *par;
integer *ijac;
double *fs, *dfdu, *dfdp;
{
/* ---------- ---- */
return 0;
} /* fopt_ */
/* Not sure what to do here; I think do nothing since IEQUIB is always
-2
*/
int pvls (integer ndim, const doublereal *u,
doublereal *par)
{
return 0;
}