C### DAEPACK v0.02 - Copyright (C) M.I.T. C### - SPARSITY PATTERN GENERATOR - subroutine resim(neq,t,w,wdot,delta,ires,ichvar,rpar,ipar, $ zzzne,zzzirn,zzzjcn,zzziw) implicit none integer neq,ires,ichvar,ipar(1) double precision t,w(neq),wdot(neq),delta(neq),rpar(1) double precision x1,x2,x3,x1dot,x2dot,v1,v2,v3,z3,z4 double precision a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12 parameter(a1=12.0d0,a2=0.24d0,a3=12.0d0,a4=0.24d0) parameter(a5=13.64d0,a6=-11.64d0,a7=-50.0d0,a8=0.0d0) parameter(a9=-11.64d0,a10=13.64d0,a11=0.0d0,a12=-50.0d0) double precision r3,l3 parameter(r3=10.0d0,l3=0.2d0) double precision cos,atan intrinsic cos,atan C### Additional arguments for occurrence information construction C### zzzne - number of entries in incidence matrix C### zzzirn - row numbers C### zzzjcn - column numbers C### zzziw - integer workspace integer zzzne,zzzirn(zzzne),zzzjcn(zzzne),zzziw(*) external CREATEOI,SETIVOI,RSTOIW,MERGEOI,ADJOIW,COMPROI C### Active variable offsets and loop control variables integer deltaoft integer woft integer wdotoft integer x1dotoft integer x2dotoft integer x1oft integer x2oft integer x3oft integer v1oft integer v2oft integer v3oft integer z3oft integer z4oft integer zzzn integer zzzm integer zzzi integer zzzindx C### Variable offsets for independent, dependent, and C### non-common block local active variables. deltaoft=0 woft=deltaoft+neq wdotoft=woft+neq x1dotoft=wdotoft+neq x2dotoft=x1dotoft+1 x1oft=x2dotoft+1 x2oft=x1oft+1 x3oft=x2oft+1 v1oft=x3oft+1 v2oft=v1oft+1 v3oft=v2oft+1 z3oft=v3oft+1 z4oft=z3oft+1 C### Number of independent and dependent variables. zzzn=neq+neq zzzm=neq C### Create OIM for functions/subroutines. call CREATEOI(1,zzzn) C### Construct mapping between independent variable offsets and indices zzzindx=0 do zzzi=1,neq zzzindx=zzzindx+1 zzziw(zzzindx)=woft+zzzi end do do zzzi=1,neq zzzindx=zzzindx+1 zzziw(zzzindx)=wdotoft+zzzi end do C### Set independent variable numbers call SETIVOI(1,zzzn,zzziw) x1dot=wdot(1) call RSTOIW() call MERGEOI(wdotoft+1,1) call ADJOIW(x1dotoft+1,1) x2dot=wdot(2) call RSTOIW() call MERGEOI(wdotoft+2,1) call ADJOIW(x2dotoft+1,1) x1=w(1) call RSTOIW() call MERGEOI(woft+1,1) call ADJOIW(x1oft+1,1) x2=w(2) call RSTOIW() call MERGEOI(woft+2,1) call ADJOIW(x2oft+1,1) x3=w(3) call RSTOIW() call MERGEOI(woft+3,1) call ADJOIW(x3oft+1,1) v1=w(4) call RSTOIW() call MERGEOI(woft+4,1) call ADJOIW(v1oft+1,1) v2=w(5) call RSTOIW() call MERGEOI(woft+5,1) call ADJOIW(v2oft+1,1) v3=w(6) call RSTOIW() call MERGEOI(woft+6,1) call ADJOIW(v3oft+1,1) z3=w(7) call RSTOIW() call MERGEOI(woft+7,1) call ADJOIW(z3oft+1,1) z4=w(8) call RSTOIW() call MERGEOI(woft+8,1) call ADJOIW(z4oft+1,1) delta(1)=x1+x2-x3 call RSTOIW() call MERGEOI(x1oft+1,1) call MERGEOI(x2oft+1,1) call MERGEOI(x3oft+1,1) call ADJOIW(deltaoft+1,1) delta(2)=r3*(x1+x2)+l3*(x1dot+x2dot)-v3 call RSTOIW() call MERGEOI(x1oft+1,1) call MERGEOI(x2oft+1,1) call MERGEOI(x1dotoft+1,1) call MERGEOI(x2dotoft+1,1) call MERGEOI(v3oft+1,1) call ADJOIW(deltaoft+2,1) delta(3)=100.0d0*cos(100.0d0*atan(1.0d0)*4.0d0*t)-v1 call RSTOIW() call MERGEOI(v1oft+1,1) call ADJOIW(deltaoft+3,1) delta(4)=-v1-v2 call RSTOIW() call MERGEOI(v1oft+1,1) call MERGEOI(v2oft+1,1) call ADJOIW(deltaoft+4,1) delta(5)=v1-v3-z3 call RSTOIW() call MERGEOI(v1oft+1,1) call MERGEOI(v3oft+1,1) call MERGEOI(z3oft+1,1) call ADJOIW(deltaoft+5,1) delta(6)=v2-v3-z4 call RSTOIW() call MERGEOI(v2oft+1,1) call MERGEOI(v3oft+1,1) call MERGEOI(z4oft+1,1) call ADJOIW(deltaoft+6,1) if((x1.gt.0.0d0.or.v1.gt.v3).and.(x2.le.0.0d0.and.v2.lt.v3)) $ then delta(7)=(v1-a1*x1)/a2-x1dot call RSTOIW() call MERGEOI(v1oft+1,1) call MERGEOI(x1oft+1,1) call MERGEOI(x1dotoft+1,1) call ADJOIW(deltaoft+7,1) delta(8)=0.0d0-x2dot call RSTOIW() call MERGEOI(x2dotoft+1,1) call ADJOIW(deltaoft+8,1) else if((x2.gt.0.0d0.or.v2.gt.v3).and.(x1.lt.0.0d0.and.v1.lt. $ v3))then delta(7)=0.0d0-x1dot call RSTOIW() call MERGEOI(x1dotoft+1,1) call ADJOIW(deltaoft+7,1) delta(8)=(v2-a3*x2)/a4-x2dot call RSTOIW() call MERGEOI(v2oft+1,1) call MERGEOI(x2oft+1,1) call MERGEOI(x2dotoft+1,1) call ADJOIW(deltaoft+8,1) else delta(7)=a5*v1+a6*v2+a7*x1+a8*x2-x1dot call RSTOIW() call MERGEOI(v1oft+1,1) call MERGEOI(v2oft+1,1) call MERGEOI(x1oft+1,1) call MERGEOI(x2oft+1,1) call MERGEOI(x1dotoft+1,1) call ADJOIW(deltaoft+7,1) delta(8)=a9*v1+a10*v2+a11*x1+a12*x2-x2dot call RSTOIW() call MERGEOI(v1oft+1,1) call MERGEOI(v2oft+1,1) call MERGEOI(x1oft+1,1) call MERGEOI(x2oft+1,1) call MERGEOI(x2dotoft+1,1) call ADJOIW(deltaoft+8,1) end if end if goto 11111 C### Compress occurrence information before returning 11111 continue C### Construct mapping between dependent variable offsets and indices zzzindx=0 do zzzi=1,neq zzzindx=zzzindx+1 zzziw(zzzindx)=deltaoft+zzzi end do call COMPROI(1,zzzm,zzziw,zzzne,zzzirn,zzzjcn) C### Delete OIM for functions/subroutines. call DELETEOI(1) C### Done return end