adms/admst/ngspiceMODULEsetup.c.xml, adms, implement DEVunsetup()

Which is needed to release the allocated circuit nodes in
  the corresponding adms generated DEVsetup() routine.
This is required when invoking CKTsetup() more than once
  without an intervening "reset".
This commit is contained in:
rlar 2017-03-05 17:02:12 +01:00
parent 6ccccbe7c4
commit 987952e57e
2 changed files with 27 additions and 1 deletions

View File

@ -65,7 +65,7 @@ SPICEdev $(module)info = {
$(module)mParam, /* DEVmodParam */
$(module)load, /* DEVload */
$(module)setup, /* DEVsetup */
NULL, /* DEVunsetup */
$(module)unsetup, /* DEVunsetup */
$(module)setup, /* DEVpzSetup */
$(module)temp, /* DEVtemperature */
$(module)trunc, /* DEVtrunc */

View File

@ -166,6 +166,32 @@ int $(module)setup (SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *
return(OK);
}
int
$(module)unsetup(GENmodel *inModel, CKTcircuit *ckt)
{
$(module)model *model = ($(module)model*)inModel;
$(module)instance *here;
/* loop through all the $(module) device models */
for ( ;model != NULL ;model = model->$(module)nextModel )
{
for ( here = model->$(module)instances ;here != NULL ; here = here->$(module)nextInstance )
{
<admst:for-each select="reverse(node[location='internal'])">
<admst:value-of select="name"/>
<admst:value-of select="name"/>
<admst:value-of select="name"/>
if (here->%sNode > 0) {
CKTdltNNum(ckt, here->%sNode);
here->%sNode = -1;
}
</admst:for-each>
}
}
return OK;
}
</admst:template>
<admst:for-each select="/module">