/* intgr8.f -- translated by f2c (version of 3 February 1990  3:36:42).
   You must link the resulting object file with the libraries:
	-lF77 -lI77 -lm -lc   (in that order)
*/

#include "f2c.h"

/* Common Block Declarations */

struct {
    integer ielmnt, isbckt, nsbckt, iunsat, nunsat, itemps, numtem, isens, 
	    nsens, ifour, nfour, ifield, icode, idelim, icolum, insize, 
	    junode, lsbkpt, numbkp, iorder, jmnode, iur, iuc, ilc, ilr, 
	    numoff, isr, nmoffc, iseq, iseq1, neqn, nodevs, ndiag, iswap, 
	    iequa, macins, lvnim1, lx0, lvn, lynl, lyu, lyl, lx1, lx2, lx3, 
	    lx4, lx5, lx6, lx7, ld0, ld1, ltd, imynl, imvn, lcvn, nsnod, 
	    nsmat, nsval, icnod, icmat, icval, loutpt, lpol, lzer, irswpf, 
	    irswpr, icswpf, icswpr, irpt, jcpt, irowno, jcolno, nttbr, nttar, 
	    lvntmp;
} tabinf_;

#define tabinf_1 tabinf_

struct {
    doublereal omega, time, delta, delold[7], ag[7], vt, xni, egfet, xmu, 
	    sfactr;
    integer mode, modedc, icalc, initf, method, iord, maxord, noncon, iterno, 
	    itemno, nosolv, modac, ipiv, ivmflg, ipostp, iscrch, iofile;
} status_;

#define status_1 status_

struct {
    doublereal value[200000];
} blank_;

#define blank_1 blank_

/*<       subroutine intgr8(geq,ceq,capval,loct) >*/
/* Subroutine */ int intgr8_(geq, ceq, capval, loct)
doublereal *geq, *ceq, *capval;
integer *loct;
{
    /* Local variables */
#define ccap ((doublereal *)&blank_1 + 1)
#define qcap ((doublereal *)&blank_1)
#define nodplc ((integer *)&blank_1)
#define cvalue ((complex *)&blank_1)

/*<       implicit double precision (a-h,o-z) >*/

/*     this routine performs the actual numerical integration for each */
/* circuit element. */

/* spice version 2g.6  sccsid=tabinf 3/15/83 */
/*<       common /tabinf/ ielmnt,isbckt,nsbckt,iunsat,nunsat,itemps,numtem, >*/
/*<      1   isens,nsens,ifour,nfour,ifield,icode,idelim,icolum,insize, >*/
/*<      2   junode,lsbkpt,numbkp,iorder,jmnode,iur,iuc,ilc,ilr,numoff,isr, >*/
/*<      3   nmoffc,iseq,iseq1,neqn,nodevs,ndiag,iswap,iequa,macins,lvnim1, >*/
/*<      4   lx0,lvn,lynl,lyu,lyl,lx1,lx2,lx3,lx4,lx5,lx6,lx7,ld0,ld1,ltd, >*/
/*<      5   imynl,imvn,lcvn,nsnod,nsmat,nsval,icnod,icmat,icval, >*/
/*<      6   loutpt,lpol,lzer,irswpf,irswpr,icswpf,icswpr,irpt,jcpt, >*/
/*<      7   irowno,jcolno,nttbr,nttar,lvntmp >*/
/* spice version 2g.6  sccsid=status 3/15/83 */
/*<       common /status/ omega,time,delta,delold(7),ag(7),vt,xni,egfet, >*/
/*<      1   xmu,sfactr,mode,modedc,icalc,initf,method,iord,maxord,noncon, >*/
/*<      2   iterno,itemno,nosolv,modac,ipiv,ivmflg,ipostp,iscrch,iofile >*/
/* spice version 2g.6  sccsid=blank 3/15/83 */
/*<       common /blank/ value(200000) >*/
/*<       integer nodplc(64) >*/
/*<       complex cvalue(32) >*/
/*<       equivalence (value(1),nodplc(1),cvalue(1)) >*/


/*<       dimension qcap(1),ccap(1) >*/
/*<       equivalence (qcap(1),value(1)),(ccap(1),value(2)) >*/


/*<       if (method.eq.2) go to 100 >*/
    if (status_1.method == 2) {
	goto L100;
    }

/*  trapezoidal algorithm */

/*<       if (iord.eq.1) go to 100 >*/
    if (status_1.iord == 1) {
	goto L100;
    }
/*<       ccap(lx0+loct)=-ccap(lx1+loct)*ag(2) >*/
/*<      1   +ag(1)*(qcap(lx0+loct)-qcap(lx1+loct)) >*/
    ccap[tabinf_1.lx0 + *loct - 1] = -ccap[tabinf_1.lx1 + *loct - 1] * 
	    status_1.ag[1] + status_1.ag[0] * (qcap[tabinf_1.lx0 + *loct - 1] 
	    - qcap[tabinf_1.lx1 + *loct - 1]);
/*<       go to 190 >*/
    goto L190;

/*  gears algorithm */

/*<   100 go to (110,120,130,140,150,160), iord >*/
L100:
    switch (status_1.iord) {
	case 1:  goto L110;
	case 2:  goto L120;
	case 3:  goto L130;
	case 4:  goto L140;
	case 5:  goto L150;
	case 6:  goto L160;
    }
/*<   110 ccap(lx0+loct)=ag(1)*qcap(lx0+loct)+ag(2)*qcap(lx1+loct) >*/
L110:
    ccap[tabinf_1.lx0 + *loct - 1] = status_1.ag[0] * qcap[tabinf_1.lx0 + *
	    loct - 1] + status_1.ag[1] * qcap[tabinf_1.lx1 + *loct - 1];
/*<       go to 190 >*/
    goto L190;
/*<   120 ccap(lx0+loct)=ag(1)*qcap(lx0+loct)+ag(2)*qcap(lx1+loct) >*/
/*<      1              +ag(3)*qcap(lx2+loct) >*/
L120:
    ccap[tabinf_1.lx0 + *loct - 1] = status_1.ag[0] * qcap[tabinf_1.lx0 + *
	    loct - 1] + status_1.ag[1] * qcap[tabinf_1.lx1 + *loct - 1] + 
	    status_1.ag[2] * qcap[tabinf_1.lx2 + *loct - 1];
/*<       go to 190 >*/
    goto L190;
/*<   130 ccap(lx0+loct)=ag(1)*qcap(lx0+loct)+ag(2)*qcap(lx1+loct) >*/
/*<      1              +ag(3)*qcap(lx2+loct)+ag(4)*qcap(lx3+loct) >*/
L130:
    ccap[tabinf_1.lx0 + *loct - 1] = status_1.ag[0] * qcap[tabinf_1.lx0 + *
	    loct - 1] + status_1.ag[1] * qcap[tabinf_1.lx1 + *loct - 1] + 
	    status_1.ag[2] * qcap[tabinf_1.lx2 + *loct - 1] + status_1.ag[3] *
	     qcap[tabinf_1.lx3 + *loct - 1];
/*<       go to 190 >*/
    goto L190;
/*<   140 ccap(lx0+loct)=ag(1)*qcap(lx0+loct)+ag(2)*qcap(lx1+loct) >*/
/*<      1              +ag(3)*qcap(lx2+loct)+ag(4)*qcap(lx3+loct) >*/
/*<      2              +ag(5)*qcap(lx4+loct) >*/
L140:
    ccap[tabinf_1.lx0 + *loct - 1] = status_1.ag[0] * qcap[tabinf_1.lx0 + *
	    loct - 1] + status_1.ag[1] * qcap[tabinf_1.lx1 + *loct - 1] + 
	    status_1.ag[2] * qcap[tabinf_1.lx2 + *loct - 1] + status_1.ag[3] *
	     qcap[tabinf_1.lx3 + *loct - 1] + status_1.ag[4] * qcap[
	    tabinf_1.lx4 + *loct - 1];
/*<       go to 190 >*/
    goto L190;
/*<   150 ccap(lx0+loct)=ag(1)*qcap(lx0+loct)+ag(2)*qcap(lx1+loct) >*/
/*<      1              +ag(3)*qcap(lx2+loct)+ag(4)*qcap(lx3+loct) >*/
/*<      2              +ag(5)*qcap(lx4+loct)+ag(6)*qcap(lx5+loct) >*/
L150:
    ccap[tabinf_1.lx0 + *loct - 1] = status_1.ag[0] * qcap[tabinf_1.lx0 + *
	    loct - 1] + status_1.ag[1] * qcap[tabinf_1.lx1 + *loct - 1] + 
	    status_1.ag[2] * qcap[tabinf_1.lx2 + *loct - 1] + status_1.ag[3] *
	     qcap[tabinf_1.lx3 + *loct - 1] + status_1.ag[4] * qcap[
	    tabinf_1.lx4 + *loct - 1] + status_1.ag[5] * qcap[tabinf_1.lx5 + *
	    loct - 1];
/*<       go to 190 >*/
    goto L190;
/*<   160 ccap(lx0+loct)=ag(1)*qcap(lx0+loct)+ag(2)*qcap(lx1+loct) >*/
/*<      1              +ag(3)*qcap(lx2+loct)+ag(4)*qcap(lx3+loct) >*/
/*<      2              +ag(5)*qcap(lx4+loct)+ag(6)*qcap(lx5+loct) >*/
/*<      3              +ag(7)*qcap(lx6+loct) >*/
L160:
    ccap[tabinf_1.lx0 + *loct - 1] = status_1.ag[0] * qcap[tabinf_1.lx0 + *
	    loct - 1] + status_1.ag[1] * qcap[tabinf_1.lx1 + *loct - 1] + 
	    status_1.ag[2] * qcap[tabinf_1.lx2 + *loct - 1] + status_1.ag[3] *
	     qcap[tabinf_1.lx3 + *loct - 1] + status_1.ag[4] * qcap[
	    tabinf_1.lx4 + *loct - 1] + status_1.ag[5] * qcap[tabinf_1.lx5 + *
	    loct - 1] + status_1.ag[6] * qcap[tabinf_1.lx6 + *loct - 1];
/* ... ceq is the equivalent current applicable to linear capacitance */
/*    (inductance) only, i.e. q=c*v */
/*<   190 ceq=ccap(lx0+loct)-ag(1)*qcap(lx0+loct) >*/
L190:
    *ceq = ccap[tabinf_1.lx0 + *loct - 1] - status_1.ag[0] * qcap[
	    tabinf_1.lx0 + *loct - 1];
/*<       geq=ag(1)*capval >*/
    *geq = status_1.ag[0] * *capval;
/*<       return >*/
    return 0;
/*<       end >*/
} /* intgr8_ */

#undef cvalue
#undef nodplc
#undef qcap
#undef ccap


