From 987952e57e7d03b05a98449a4a6f2f7aff192dfb Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 5 Mar 2017 17:02:12 +0100 Subject: [PATCH] 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". --- .../adms/admst/ngspiceMODULEinit.c.xml | 2 +- .../adms/admst/ngspiceMODULEsetup.c.xml | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/spicelib/devices/adms/admst/ngspiceMODULEinit.c.xml b/src/spicelib/devices/adms/admst/ngspiceMODULEinit.c.xml index 12e0ce30f..d0dd05d96 100644 --- a/src/spicelib/devices/adms/admst/ngspiceMODULEinit.c.xml +++ b/src/spicelib/devices/adms/admst/ngspiceMODULEinit.c.xml @@ -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 */ diff --git a/src/spicelib/devices/adms/admst/ngspiceMODULEsetup.c.xml b/src/spicelib/devices/adms/admst/ngspiceMODULEsetup.c.xml index b05d4a48e..1dca4ada5 100644 --- a/src/spicelib/devices/adms/admst/ngspiceMODULEsetup.c.xml +++ b/src/spicelib/devices/adms/admst/ngspiceMODULEsetup.c.xml @@ -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 ) + { + + + + + if (here->%sNode > 0) { + CKTdltNNum(ckt, here->%sNode); + here->%sNode = -1; + } + + } + } + return OK; +} +