|
|
|
@ -2,13 +2,6 @@ |
|
|
|
Copyright 1990 Regents of the University of California. All rights reserved. |
|
|
|
Author: 1985 Thomas L. Quarles |
|
|
|
**********/ |
|
|
|
/* |
|
|
|
*/ |
|
|
|
|
|
|
|
/* CKTinst2Node |
|
|
|
* get the name and node pointer for a node given a device it is |
|
|
|
* bound to and the terminal of the device. |
|
|
|
*/ |
|
|
|
|
|
|
|
#include "ngspice/ngspice.h" |
|
|
|
#include "ngspice/ifsim.h" |
|
|
|
@ -18,30 +11,32 @@ Author: 1985 Thomas L. Quarles |
|
|
|
#include "ngspice/devdefs.h" |
|
|
|
|
|
|
|
|
|
|
|
/* CKTinst2Node |
|
|
|
* get the name and node pointer for a node given a device it is |
|
|
|
* bound to and the terminal of the device. |
|
|
|
*/ |
|
|
|
|
|
|
|
int |
|
|
|
CKTinst2Node(CKTcircuit *ckt, void *instPtr, int terminal, CKTnode **node, IFuid *nodeName) |
|
|
|
{ |
|
|
|
int nodenum; |
|
|
|
int type; |
|
|
|
CKTnode *here; |
|
|
|
GENinstance *inst = (GENinstance *) instPtr; |
|
|
|
int type = inst->GENmodPtr->GENmodType; |
|
|
|
|
|
|
|
type = ((GENinstance *)instPtr)->GENmodPtr->GENmodType; |
|
|
|
CKTnode *here; |
|
|
|
|
|
|
|
if(*(DEVices[type]->DEVpublic.terms) >= terminal && terminal > 0) { |
|
|
|
if (*(DEVices[type]->DEVpublic.terms) >= terminal && terminal > 0) { |
|
|
|
/* argh, terminals are counted from 1 */ |
|
|
|
nodenum = ((GENinstance *)instPtr)->GENnode[terminal - 1]; |
|
|
|
/* ok, now we know its number, so we just have to find it.*/ |
|
|
|
for(here = ckt->CKTnodes;here;here = here->next) { |
|
|
|
if(here->number == nodenum) { |
|
|
|
/* found it */ |
|
|
|
int nodenum = inst->GENnode[terminal - 1]; |
|
|
|
|
|
|
|
for (here = ckt->CKTnodes; here; here = here->next) |
|
|
|
if (here->number == nodenum) { |
|
|
|
*node = here; |
|
|
|
*nodeName = here->name; |
|
|
|
return(OK); |
|
|
|
return OK; |
|
|
|
} |
|
|
|
} |
|
|
|
return(E_NOTFOUND); |
|
|
|
|
|
|
|
return E_NOTFOUND; |
|
|
|
} else { |
|
|
|
return(E_NOTERM); |
|
|
|
return E_NOTERM; |
|
|
|
} |
|
|
|
} |