Added the KLU support to Noise Analysis

This commit is contained in:
Francesco Lannutti 2020-10-17 21:49:38 +02:00 committed by Holger Vogt
parent 4639e936a3
commit 7048a24b74
1 changed files with 36 additions and 3 deletions

View File

@ -31,8 +31,13 @@ Modified: 2001 AlansFixes
/* gtri - end - wbk */
#endif
// fixme
// ugly hack to work around missing api to specify the "type" of signals
#ifdef KLU
#include "ngspice/devdefs.h"
#endif
// fixme
// ugly hack to work around missing api to specify the "type" of signals
extern int fixme_onoise_type;
extern int fixme_inoise_type;
@ -162,6 +167,7 @@ NOISEan(CKTcircuit* ckt, int restart)
return(E_BADPARM);
}
#ifdef XSPICE
/* gtri - begin - wbk - Call EVTop if event-driven instances exist */
@ -176,6 +182,19 @@ NOISEan(CKTcircuit* ckt, int restart)
}
else
#endif
#ifdef KLU
if (ckt->CKTmatrix->CKTkluMODE)
{
/* Conversion from Complex Matrix to Real Matrix */
for (i = 0 ; i < DEVmaxnum ; i++)
if (DEVices [i] && DEVices [i]->DEVbindCSCComplexToReal && ckt->CKThead [i])
DEVices [i]->DEVbindCSCComplexToReal (ckt->CKThead [i], ckt) ;
ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
}
#endif
/* If no event-driven instances, do what SPICE normally does */
if (!ckt->CKTnoopac) { /* skip OP if option NOOPAC is set and circuit is linear */
error = CKTop(ckt,
@ -226,7 +245,6 @@ NOISEan(CKTcircuit* ckt, int restart)
/* gtri - end - wbk */
#endif
/* Patch to noisean.c by Richard D. McRoberts. */
ckt->CKTmode = (ckt->CKTmode & MODEUIC) | MODEDCOP | MODEINITSMSIG;
error = CKTload(ckt);
@ -357,6 +375,21 @@ NOISEan(CKTcircuit* ckt, int restart)
/* gtri - end - wbk */
#endif
#ifdef KLU
if (ckt->CKTmatrix->CKTkluMODE)
{
/* Conversion from Real Matrix to Complex Matrix */
if (!ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex)
{
for (i = 0 ; i < DEVmaxnum ; i++)
if (DEVices [i] && DEVices [i]->DEVbindCSCComplex && ckt->CKThead [i])
DEVices [i]->DEVbindCSCComplex (ckt->CKThead [i], ckt) ;
ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
}
}
#endif
/* do the noise analysis over all frequencies */
while (data->freq <= job->NstopFreq + freqTol) {