Model Based Infrastructure and some model released for the separated Linear and Non-Linear Model Evaluation

This commit is contained in:
Francesco Lannutti 2013-05-04 22:19:06 +02:00 committed by Francesco Lannutti
parent 01dce85696
commit 9facab260b
31 changed files with 338 additions and 103 deletions

View File

@ -306,7 +306,12 @@ struct CKTcircuit {
};
/* Now function prottypes */
/* Now function prototypes */
/* Francesco Lannutti */
extern int CKTloadLinearStatic (CKTcircuit *) ;
extern int CKTloadLinearDynamic (CKTcircuit *) ;
extern int CKTloadAssemble (CKTcircuit *) ;
extern int ACan(CKTcircuit *, int);
extern int ACaskQuest(CKTcircuit *, JOB *, int , IFvalue *);

View File

@ -121,6 +121,10 @@ typedef struct SPICEdev {
/* routine to convert Real CSC array to Complex CSC array */
int (*DEVbindCSCComplexToReal)(GENmodel *, CKTcircuit *);
/* routine to convert Complex CSC array to Real CSC array */
int *DEVisLinear ;
/* flag to indicate if device is linear or non-linear */
int *DEVisLinearStatic ;
/* flag to indicate if device is linear static or linear dynamic */
#endif
} SPICEdev; /* instance of structure for each possible type of device */

View File

@ -1,20 +1,52 @@
#ifndef _KLU_BINDING_H
#define _KLU_BINDING_H
#define CREATE_KLU_BINDING_TABLE(ptr, binding, a, b) \
if ((here->a != 0) && (here->b != 0)) { \
i = here->ptr ; \
#define CREATE_KLU_BINDING_TABLE(ptr, binding, a, b) \
if ((here->a != 0) && (here->b != 0)) { \
i = here->ptr ; \
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; \
here->binding = matched ; \
here->ptr = matched->CSC ; \
here->binding = matched ; \
here->ptr = matched->CSC ; \
}
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(ptr, binding, a, b) \
if ((here->a != 0) && (here->b != 0)) \
#define CREATE_KLU_BINDING_TABLE_DYNAMIC(ptr, binding, a, b) \
if ((here->a != 0) && (here->b != 0)) { \
i = here->ptr ; \
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; \
here->binding = matched ; \
here->ptr = matched->CSC_LinearDynamic ; \
}
#define CREATE_KLU_BINDING_TABLE_STATIC(ptr, binding, a, b) \
if ((here->a != 0) && (here->b != 0)) { \
i = here->ptr ; \
matched = (BindElement *) bsearch (&i, BindStruct, nz, sizeof(BindElement), BindCompare) ; \
here->binding = matched ; \
here->ptr = matched->CSC_LinearStatic ; \
}
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(ptr, binding, a, b) \
if ((here->a != 0) && (here->b != 0)) \
here->ptr = here->binding->CSC_Complex ;
#define CONVERT_KLU_BINDING_TABLE_TO_REAL(ptr, binding, a, b) \
if ((here->a != 0) && (here->b != 0)) \
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(ptr, binding, a, b) \
if ((here->a != 0) && (here->b != 0)) \
here->ptr = here->binding->CSC_Complex_LinearDynamic ;
#define CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_STATIC(ptr, binding, a, b) \
if ((here->a != 0) && (here->b != 0)) \
here->ptr = here->binding->CSC_Complex_LinearStatic ;
#define CONVERT_KLU_BINDING_TABLE_TO_REAL(ptr, binding, a, b) \
if ((here->a != 0) && (here->b != 0)) \
here->ptr = here->binding->CSC ;
#define CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(ptr, binding, a, b) \
if ((here->a != 0) && (here->b != 0)) \
here->ptr = here->binding->CSC_LinearDynamic ;
#define CONVERT_KLU_BINDING_TABLE_TO_REAL_STATIC(ptr, binding, a, b) \
if ((here->a != 0) && (here->b != 0)) \
here->ptr = here->binding->CSC_LinearStatic ;
#endif

View File

@ -25,28 +25,32 @@ Modified: 2000 AlansFixes
/* SMPmatrix structure - Francesco Lannutti (2012-02) */
typedef struct sSMPmatrix {
MatrixFrame *SPmatrix ; /* pointer to sparse matrix */
MatrixFrame *SPmatrix ; /* pointer to sparse matrix */
#ifdef KLU
klu_common *CKTkluCommon ; /* KLU common object */
klu_symbolic *CKTkluSymbolic ; /* KLU symbolic object */
klu_numeric *CKTkluNumeric ; /* KLU numeric object */
int *CKTkluAp ; /* KLU column pointer */
int *CKTkluAi ; /* KLU row pointer */
double *CKTkluAx ; /* KLU Real Elements */
double *CKTkluAx_Complex ; /* KLU Complex Elements */
unsigned int CKTkluMatrixIsComplex:1 ; /* KLU Matrix Is Complex Flag */
#define CKTkluMatrixReal 0 /* KLU Matrix Real definition */
#define CKTkluMatrixComplex 1 /* KLU Matrix Complex definition */
double *CKTkluIntermediate ; /* KLU RHS Intermediate for Solve Real Step */
double *CKTkluIntermediate_Complex ; /* KLU iRHS Intermediate for Solve Complex Step */
BindElement *CKTbindStruct ; /* KLU - Sparse Binding Structure */
double **CKTdiag_CSC ; /* KLU pointer to diagonal element to perform Gmin */
int CKTkluN ; /* KLU N, copied */
int CKTklunz ; /* KLU nz, copied for AC Analysis */
unsigned int CKTkluMODE:1 ; /* KLU MODE parameter to enable KLU or not from the heuristic */
#define CKTkluON 1 /* KLU MODE ON definition */
#define CKTkluOFF 0 /* KLU MODE OFF definition */
klu_common *CKTkluCommon ; /* KLU common object */
klu_symbolic *CKTkluSymbolic ; /* KLU symbolic object */
klu_numeric *CKTkluNumeric ; /* KLU numeric object */
int *CKTkluAp ; /* KLU column pointer */
int *CKTkluAi ; /* KLU row pointer */
double *CKTkluAx ; /* KLU Real Elements */
double *CKTkluAx_LinearStatic ; /* KLU Real Elements - Linear Static */
double *CKTkluAx_LinearDynamic ; /* KLU Real Elements - Linear Dynamic */
double *CKTkluAx_Complex ; /* KLU Complex Elements */
double *CKTkluAx_Complex_LinearStatic ; /* KLU Complex Elements - Linear Static */
double *CKTkluAx_Complex_LinearDynamic ; /* KLU Complex Elements - Linear Dynamic */
unsigned int CKTkluMatrixIsComplex:1 ; /* KLU Matrix Is Complex Flag */
#define CKTkluMatrixReal 0 /* KLU Matrix Real definition */
#define CKTkluMatrixComplex 1 /* KLU Matrix Complex definition */
double *CKTkluIntermediate ; /* KLU RHS Intermediate for Solve Real Step */
double *CKTkluIntermediate_Complex ; /* KLU iRHS Intermediate for Solve Complex Step */
BindElement *CKTbindStruct ; /* KLU - Sparse Binding Structure */
double **CKTdiag_CSC ; /* KLU pointer to diagonal element to perform Gmin */
int CKTkluN ; /* KLU N, copied */
int CKTklunz ; /* KLU nz, copied for AC Analysis */
unsigned int CKTkluMODE:1 ; /* KLU MODE parameter to enable KLU or not from the heuristic */
#define CKTkluON 1 /* KLU MODE ON definition */
#define CKTkluOFF 0 /* KLU MODE OFF definition */
#endif
} SMPmatrix ;

View File

@ -301,15 +301,19 @@ extern void spSolveTransposed(MatrixPtr,spREAL*,spREAL*,spREAL*,spREAL*);
typedef struct sBindElement {
double *Sparse ;
double *CSC ;
double *CSC_LinearStatic ;
double *CSC_LinearDynamic ;
double *CSC_Complex ;
double *CSC_Complex_LinearStatic ;
double *CSC_Complex_LinearDynamic ;
} BindElement ;
extern int WriteCol_original (MatrixPtr, int, spREAL *, spREAL *, int *, BindElement *, spREAL **) ;
extern int WriteCol_original (MatrixPtr, int, spREAL *, spREAL *, spREAL *, spREAL *, spREAL *, spREAL *, int *, BindElement *, spREAL **) ;
extern int WriteCol_original_dump (MatrixPtr, int, spREAL *, int *, unsigned int) ;
extern void spMatrix_CSC (MatrixPtr, int *, int *, double *, double *, int, BindElement *, double **) ;
extern void spMatrix_CSC (MatrixPtr, int *, int *, double *, double *, double *, double *, double *, double *, int, BindElement *, double **) ;
extern void spMatrix_CSC_dump (MatrixPtr, unsigned int, char *) ;
extern void spRHS_CSC_dump (spREAL *, char *, MatrixPtr) ;
#endif
/* ------------------------------------------------------ */
/* -------------------------------------------------- */
#endif /* spOKAY */

View File

@ -115,7 +115,9 @@ void
SMPmatrix_CSC (SMPmatrix *Matrix)
{
spMatrix_CSC (Matrix->SPmatrix, Matrix->CKTkluAp, Matrix->CKTkluAi, Matrix->CKTkluAx,
Matrix->CKTkluAx_Complex, Matrix->CKTkluN, Matrix->CKTbindStruct, Matrix->CKTdiag_CSC) ;
Matrix->CKTkluAx_LinearStatic, Matrix->CKTkluAx_LinearDynamic, Matrix->CKTkluAx_Complex,
Matrix->CKTkluAx_Complex_LinearStatic, Matrix->CKTkluAx_Complex_LinearDynamic,
Matrix->CKTkluN, Matrix->CKTbindStruct, Matrix->CKTdiag_CSC) ;
// spMatrix_CSC_dump (Matrix->SPmatrix, 1, NULL) ;

View File

@ -38,6 +38,11 @@ NIinit(CKTcircuit *ckt)
ckt->CKTmatrix->CKTkluAp = NULL ;
ckt->CKTmatrix->CKTkluAi = NULL ;
ckt->CKTmatrix->CKTkluAx = NULL ;
ckt->CKTmatrix->CKTkluAx_LinearStatic = NULL ;
ckt->CKTmatrix->CKTkluAx_LinearDynamic = NULL ;
ckt->CKTmatrix->CKTkluAx_Complex = NULL ;
ckt->CKTmatrix->CKTkluAx_Complex_LinearStatic = NULL ;
ckt->CKTmatrix->CKTkluAx_Complex_LinearDynamic = NULL ;
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixReal ;
ckt->CKTmatrix->CKTkluIntermediate = NULL ;
ckt->CKTmatrix->CKTkluIntermediate_Complex = NULL ;

View File

@ -63,6 +63,12 @@ NIiter(CKTcircuit *ckt, int maxIter)
/* OldCKTstate0 = TMALLOC(double, ckt->CKTnumStates + 1); */
#ifdef KLU
/* Francesco Lannutti */
/* Loading the Linear Dynamic Part */
error = CKTloadLinearDynamic (ckt) ;
#endif
for (;;) {
ckt->CKTnoncon = 0;
@ -71,7 +77,7 @@ NIiter(CKTcircuit *ckt, int maxIter)
if (!(ckt->CKTmode & MODEINITPRED))
#endif
{
/* Loading the Non-Linear Part */
error = CKTload(ckt);
/* printf("loaded, noncon is %d\n", ckt->CKTnoncon); */
/* fflush(stdout); */
@ -85,6 +91,12 @@ NIiter(CKTcircuit *ckt, int maxIter)
return (error);
}
#ifdef KLU
/* Francesco Lannutti */
/* Assembling the Linear and Non-Linear Part */
error = CKTloadAssemble (ckt) ;
#endif
/* printf("after loading, before solving\n"); */
/* CKTdump(ckt); */

View File

@ -1,18 +1,18 @@
/* Sparse Matrix to CSC Matrix Conversion Routines
* Including Dump Routines
/** Sparse Matrix to CSC Matrix Conversion Routines
* Including Dump Routines
*
* Author: Francesco Lannutti 2011-2012
* Author: Francesco Lannutti 2011-2012
*
* Instructions:
* spMatrix_CSC_dump and spRHS_CSC_dump are the dump routines;
* insert them in a point in your code after that the Sparse Matrix
* is filled in to dump the whole matrix in the CSC format.
* To solve correctly the resulting CSC linear system, it's crucial
* to perform another inversion of the Solution Vector following this code:
* Instructions:
* spMatrix_CSC_dump and spRHS_CSC_dump are the dump routines;
* insert them in a point in your code after that the Sparse Matrix
* is filled in to dump the whole matrix in the CSC format.
* To solve correctly the resulting CSC linear system, it's crucial
* to perform another inversion of the Solution Vector following this code:
*
* pExtOrder = IntToExtColMap [n] ;
* for (i = n - 1 ; i >= 0 ; i--)
* RHS [*(pExtOrder--)] = Intermediate [i] ;
* pExtOrder = IntToExtColMap [n] ;
* for (i = n - 1 ; i >= 0 ; i--)
* RHS [*(pExtOrder--)] = Intermediate [i] ;
*/
/* Includes */
@ -21,7 +21,9 @@
/* Body */
int
WriteCol_original (MatrixPtr Matrix, int Col, spREAL *CSC_Element, spREAL *CSC_Element_Complex, int *CSC_Row, BindElement *BindSparseCSC, spREAL **diag)
WriteCol_original (MatrixPtr Matrix, int Col, spREAL *CSC_Element, spREAL *CSC_LinearStatic_Element, spREAL *CSC_LinearDynamic_Element,
spREAL *CSC_Complex_Element, spREAL *CSC_Complex_LinearStatic_Element, spREAL *CSC_Complex_LinearDynamic_Element,
int *CSC_Row, BindElement *BindSparseCSC, spREAL **diag)
{
int i ;
ElementPtr current ;
@ -32,7 +34,11 @@ WriteCol_original (MatrixPtr Matrix, int Col, spREAL *CSC_Element, spREAL *CSC_E
while (current != NULL) {
BindSparseCSC [i].Sparse = (double *)current ;
BindSparseCSC [i].CSC = &(CSC_Element [i]) ;
BindSparseCSC [i].CSC_Complex = &(CSC_Element_Complex [2 * i]) ;
BindSparseCSC [i].CSC_LinearStatic = &(CSC_LinearStatic_Element [i]) ;
BindSparseCSC [i].CSC_LinearDynamic = &(CSC_LinearDynamic_Element [i]) ;
BindSparseCSC [i].CSC_Complex = &(CSC_Complex_Element [2 * i]) ;
BindSparseCSC [i].CSC_Complex_LinearStatic = &(CSC_Complex_LinearStatic_Element [2 * i]) ;
BindSparseCSC [i].CSC_Complex_LinearDynamic = &(CSC_Complex_LinearDynamic_Element [2 * i]) ;
CSC_Row [i] = (current->Row) - 1 ;
if (CSC_Row [i] == Col - 1)
diag [0] = &(CSC_Element [i]) ;
@ -69,17 +75,22 @@ WriteCol_original_dump (MatrixPtr Matrix, int Col, spREAL *CSC_Element, int *CSC
}
void
spMatrix_CSC (MatrixPtr Matrix, int *Ap, int *Ai, double *Ax, double *Ax_Complex, int n, BindElement *BindSparseCSC, double **diag)
spMatrix_CSC (MatrixPtr Matrix, int *Ap, int *Ai, double *Ax, double *Ax_LinearStatic, double *Ax_LinearDynamic,
double *Ax_Complex, double *Ax_Complex_LinearStatic, double *Ax_Complex_LinearDynamic, int n,
BindElement *BindSparseCSC, double **diag)
{
int offset, i ;
offset = 0 ;
Ap[0] = offset ;
Ap [0] = offset ;
for (i = 1 ; i <= n ; i++) {
offset += WriteCol_original (Matrix, i, (spREAL *)(Ax + offset), (spREAL *)(Ax_Complex + 2 * offset),
offset += WriteCol_original (Matrix, i, (spREAL *)(Ax + offset), (spREAL *)(Ax_LinearStatic + offset),
(spREAL *)(Ax_LinearDynamic + offset), (spREAL *)(Ax_Complex + 2 * offset),
(spREAL *)(Ax_Complex_LinearStatic + 2 * offset),
(spREAL *)(Ax_Complex_LinearDynamic + 2 * offset),
(int *)(Ai + offset), BindSparseCSC + offset, (spREAL **)(diag + (i - 1))) ;
Ap[i] = offset ;
Ap [i] = offset ;
}
}

View File

@ -27,6 +27,66 @@ Modified: 2000 AlansFixes
static int ZeroNoncurRow(SMPmatrix *matrix, CKTnode *nodes, int rownum);
/* Francesco Lannutti */
#ifdef KLU
int
CKTloadLinearStatic (CKTcircuit *ckt)
{
int error, i, size ;
size = SMPmatSize (ckt->CKTmatrix) ;
for (i = 0 ; i <= size ; i++)
ckt->CKTmatrix->CKTkluAx_LinearStatic [i] = 0 ;
for (i = 0; i < DEVmaxnum; i++)
{
if (DEVices[i] && DEVices[i]->DEVload && ckt->CKThead [i] && (*DEVices[i]->DEVisLinear) && (*DEVices[i]->DEVisLinearStatic))
{
error = DEVices[i]->DEVload (ckt->CKThead [i], ckt) ;
if (error)
return (error) ;
}
}
return 0 ;
}
int
CKTloadLinearDynamic (CKTcircuit *ckt)
{
int error, i, size ;
size = SMPmatSize (ckt->CKTmatrix) ;
for (i = 0 ; i <= size ; i++)
ckt->CKTmatrix->CKTkluAx_LinearDynamic [i] = 0 ;
for (i = 0; i < DEVmaxnum; i++)
{
if (DEVices[i] && DEVices[i]->DEVload && ckt->CKThead [i] && *DEVices[i]->DEVisLinear && !(*DEVices[i]->DEVisLinearStatic))
{
error = DEVices[i]->DEVload (ckt->CKThead [i], ckt) ;
if (error)
return (error) ;
}
}
return 0 ;
}
int
CKTloadAssemble (CKTcircuit *ckt)
{
int i ;
for (i = 0 ; i < ckt->CKTmatrix->CKTklunz ; i++)
ckt->CKTmatrix->CKTkluAx [i] += (ckt->CKTmatrix->CKTkluAx_LinearStatic [i] + ckt->CKTmatrix->CKTkluAx_LinearDynamic [i]) ;
return 0 ;
}
#endif
int
CKTload(CKTcircuit *ckt)
{
@ -60,7 +120,14 @@ CKTload(CKTcircuit *ckt)
#endif /* STEPDEBUG */
for (i = 0; i < DEVmaxnum; i++) {
/* Francesco Lannutti */
#ifdef KLU
if (DEVices[i] && DEVices[i]->DEVload && ckt->CKThead[i] && !(*DEVices[i]->DEVisLinear)) {
#else
if (DEVices[i] && DEVices[i]->DEVload && ckt->CKThead[i]) {
#endif
error = DEVices[i]->DEVload (ckt->CKThead[i], ckt);
if (ckt->CKTnoncon)
ckt->CKTtroubleNode = 0;

View File

@ -39,10 +39,26 @@ CKTop (CKTcircuit *ckt, long int firstmode, long int continuemode,
ckt->enh->conv_debug.last_NIiter_call =
(ckt->CKTnumGminSteps <= 0) && (ckt->CKTnumSrcSteps <= 0);
#endif
#ifdef KLU
/* Francesco Lannutti */
/* Loading the Linear Static Part */
int error ;
error = CKTloadLinearStatic (ckt) ;
#endif
converged = NIiter (ckt, iterlim);
if (converged == 0)
return converged; /* successfull */
} else {
#ifdef KLU
/* Francesco Lannutti */
/* Loading the Linear Static Part */
int error ;
error = CKTloadLinearStatic (ckt) ;
#endif
converged = 1; /* the 'go directly to gmin stepping' option */
}

View File

@ -118,17 +118,21 @@ CKTsetup(CKTcircuit *ckt)
SMPnnz (ckt->CKTmatrix) ;
int nz = ckt->CKTmatrix->CKTklunz ;
ckt->CKTmatrix->CKTkluAp = TMALLOC (int, n + 1) ;
ckt->CKTmatrix->CKTkluAi = TMALLOC (int, nz) ;
ckt->CKTmatrix->CKTkluAx = TMALLOC (double, nz) ;
ckt->CKTmatrix->CKTkluAp = TMALLOC (int, n + 1) ;
ckt->CKTmatrix->CKTkluAi = TMALLOC (int, nz) ;
ckt->CKTmatrix->CKTkluAx = TMALLOC (double, nz) ;
ckt->CKTmatrix->CKTkluAx_LinearStatic = TMALLOC (double, nz) ;
ckt->CKTmatrix->CKTkluAx_LinearDynamic = TMALLOC (double, nz) ;
ckt->CKTmatrix->CKTkluIntermediate = TMALLOC (double, n) ;
ckt->CKTmatrix->CKTbindStruct = TMALLOC (BindElement, nz) ;
ckt->CKTmatrix->CKTbindStruct = TMALLOC (BindElement, nz) ;
ckt->CKTmatrix->CKTdiag_CSC = TMALLOC (double *, n) ;
ckt->CKTmatrix->CKTdiag_CSC = TMALLOC (double *, n) ;
/* Complex Stuff needed for AC Analysis */
ckt->CKTmatrix->CKTkluAx_Complex = TMALLOC (double, 2 * nz) ;
ckt->CKTmatrix->CKTkluAx_Complex_LinearStatic = TMALLOC (double, 2 * nz) ;
ckt->CKTmatrix->CKTkluAx_Complex_LinearDynamic = TMALLOC (double, 2 * nz) ;
ckt->CKTmatrix->CKTkluIntermediate_Complex = TMALLOC (double, 2 * n) ;
/* Binding Table from Sparse to CSC Format Creation */

View File

@ -1099,3 +1099,8 @@ int BSIM4pTSize = NUMELEMS(BSIM4pTable);
int BSIM4mPTSize = NUMELEMS(BSIM4mPTable);
int BSIM4iSize = sizeof(BSIM4instance);
int BSIM4mSize = sizeof(BSIM4model);
#ifdef KLU
int BSIM4isLinear = 0 ;
int BSIM4isLinearStatic = 0 ;
#endif

View File

@ -71,6 +71,8 @@ SPICEdev BSIM4info = {
.DEVbindCSC = BSIM4bindCSC,
.DEVbindCSCComplex = BSIM4bindCSCComplex,
.DEVbindCSCComplexToReal = BSIM4bindCSCComplexToReal,
.DEVisLinear = &BSIM4isLinear,
.DEVisLinearStatic = &BSIM4isLinearStatic,
#endif
};

View File

@ -10,4 +10,9 @@ extern int BSIM4nSize;
extern int BSIM4iSize;
extern int BSIM4mSize;
#ifdef KLU
extern int BSIM4isLinear ;
extern int BSIM4isLinearStatic ;
#endif
#endif

View File

@ -69,3 +69,8 @@ int CAPpTSize = NUMELEMS(CAPpTable);
int CAPmPTSize = NUMELEMS(CAPmPTable);
int CAPiSize = sizeof(CAPinstance);
int CAPmSize = sizeof(CAPmodel);
#ifdef KLU
int CAPisLinear = 1 ;
int CAPisLinearStatic = 0 ;
#endif

View File

@ -39,10 +39,10 @@ CAPbindCSC (GENmodel *inModel, CKTcircuit *ckt)
/* loop through all the instances of the model */
for (here = CAPinstances(model); here != NULL ; here = CAPnextInstance(here))
{
CREATE_KLU_BINDING_TABLE(CAPposPosPtr, CAPposPosBinding, CAPposNode, CAPposNode);
CREATE_KLU_BINDING_TABLE(CAPnegNegPtr, CAPnegNegBinding, CAPnegNode, CAPnegNode);
CREATE_KLU_BINDING_TABLE(CAPposNegPtr, CAPposNegBinding, CAPposNode, CAPnegNode);
CREATE_KLU_BINDING_TABLE(CAPnegPosPtr, CAPnegPosBinding, CAPnegNode, CAPposNode);
CREATE_KLU_BINDING_TABLE_DYNAMIC(CAPposPosPtr, CAPposPosBinding, CAPposNode, CAPposNode);
CREATE_KLU_BINDING_TABLE_DYNAMIC(CAPnegNegPtr, CAPnegNegBinding, CAPnegNode, CAPnegNode);
CREATE_KLU_BINDING_TABLE_DYNAMIC(CAPposNegPtr, CAPposNegBinding, CAPposNode, CAPnegNode);
CREATE_KLU_BINDING_TABLE_DYNAMIC(CAPnegPosPtr, CAPnegPosBinding, CAPnegNode, CAPposNode);
}
}
@ -63,10 +63,10 @@ CAPbindCSCComplex (GENmodel *inModel, CKTcircuit *ckt)
/* loop through all the instances of the model */
for (here = CAPinstances(model); here != NULL ; here = CAPnextInstance(here))
{
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(CAPposPosPtr, CAPposPosBinding, CAPposNode, CAPposNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(CAPnegNegPtr, CAPnegNegBinding, CAPnegNode, CAPnegNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(CAPposNegPtr, CAPposNegBinding, CAPposNode, CAPnegNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(CAPnegPosPtr, CAPnegPosBinding, CAPnegNode, CAPposNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(CAPposPosPtr, CAPposPosBinding, CAPposNode, CAPposNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(CAPnegNegPtr, CAPnegNegBinding, CAPnegNode, CAPnegNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(CAPposNegPtr, CAPposNegBinding, CAPposNode, CAPnegNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(CAPnegPosPtr, CAPnegPosBinding, CAPnegNode, CAPposNode);
}
}
@ -87,10 +87,10 @@ CAPbindCSCComplexToReal (GENmodel *inModel, CKTcircuit *ckt)
/* loop through all the instances of the model */
for (here = CAPinstances(model); here != NULL ; here = CAPnextInstance(here))
{
CONVERT_KLU_BINDING_TABLE_TO_REAL(CAPposPosPtr, CAPposPosBinding, CAPposNode, CAPposNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL(CAPnegNegPtr, CAPnegNegBinding, CAPnegNode, CAPnegNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL(CAPposNegPtr, CAPposNegBinding, CAPposNode, CAPnegNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL(CAPnegPosPtr, CAPnegPosBinding, CAPnegNode, CAPposNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(CAPposPosPtr, CAPposPosBinding, CAPposNode, CAPposNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(CAPnegNegPtr, CAPnegNegBinding, CAPnegNode, CAPnegNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(CAPposNegPtr, CAPposNegBinding, CAPposNode, CAPnegNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(CAPnegPosPtr, CAPnegPosBinding, CAPnegNode, CAPposNode);
}
}

View File

@ -71,6 +71,8 @@ SPICEdev CAPinfo = {
.DEVbindCSC = CAPbindCSC,
.DEVbindCSCComplex = CAPbindCSCComplex,
.DEVbindCSCComplexToReal = CAPbindCSCComplexToReal,
.DEVisLinear = &CAPisLinear,
.DEVisLinearStatic = &CAPisLinearStatic,
#endif
};

View File

@ -10,4 +10,9 @@ extern int CAPnSize;
extern int CAPiSize;
extern int CAPmSize;
#ifdef KLU
extern int CAPisLinear ;
extern int CAPisLinearStatic ;
#endif
#endif

View File

@ -63,6 +63,11 @@ int INDmPTSize = NUMELEMS(INDmPTable);
int INDiSize = sizeof(INDinstance);
int INDmSize = sizeof(INDmodel);
#ifdef KLU
int INDisLinear = 1 ;
int INDisLinearStatic = 0 ;
#endif
#ifdef MUTUAL
IFparm MUTpTable[] = { /* parameters */
@ -87,4 +92,9 @@ int MUTmPTSize = 0;
int MUTiSize = sizeof(INDinstance);
int MUTmSize = sizeof(INDmodel);
#ifdef KLU
int MUTisLinear = 1 ;
int MUTisLinearStatic = 0 ;
#endif
#endif /*MUTUAL*/

View File

@ -39,11 +39,11 @@ INDbindCSC (GENmodel *inModel, CKTcircuit *ckt)
/* loop through all the instances of the model */
for (here = INDinstances(model); here != NULL ; here = INDnextInstance(here))
{
CREATE_KLU_BINDING_TABLE(INDposIbrPtr, INDposIbrBinding, INDposNode, INDbrEq);
CREATE_KLU_BINDING_TABLE(INDnegIbrPtr, INDnegIbrBinding, INDnegNode, INDbrEq);
CREATE_KLU_BINDING_TABLE(INDibrNegPtr, INDibrNegBinding, INDbrEq, INDnegNode);
CREATE_KLU_BINDING_TABLE(INDibrPosPtr, INDibrPosBinding, INDbrEq, INDposNode);
CREATE_KLU_BINDING_TABLE(INDibrIbrPtr, INDibrIbrBinding, INDbrEq, INDbrEq);
CREATE_KLU_BINDING_TABLE_DYNAMIC(INDposIbrPtr, INDposIbrBinding, INDposNode, INDbrEq);
CREATE_KLU_BINDING_TABLE_DYNAMIC(INDnegIbrPtr, INDnegIbrBinding, INDnegNode, INDbrEq);
CREATE_KLU_BINDING_TABLE_DYNAMIC(INDibrNegPtr, INDibrNegBinding, INDbrEq, INDnegNode);
CREATE_KLU_BINDING_TABLE_DYNAMIC(INDibrPosPtr, INDibrPosBinding, INDbrEq, INDposNode);
CREATE_KLU_BINDING_TABLE_DYNAMIC(INDibrIbrPtr, INDibrIbrBinding, INDbrEq, INDbrEq);
}
}
@ -64,11 +64,11 @@ INDbindCSCComplex (GENmodel *inModel, CKTcircuit *ckt)
/* loop through all the instances of the model */
for (here = INDinstances(model); here != NULL ; here = INDnextInstance(here))
{
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(INDposIbrPtr, INDposIbrBinding, INDposNode, INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(INDnegIbrPtr, INDnegIbrBinding, INDnegNode, INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(INDibrNegPtr, INDibrNegBinding, INDbrEq, INDnegNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(INDibrPosPtr, INDibrPosBinding, INDbrEq, INDposNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(INDibrIbrPtr, INDibrIbrBinding, INDbrEq, INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(INDposIbrPtr, INDposIbrBinding, INDposNode, INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(INDnegIbrPtr, INDnegIbrBinding, INDnegNode, INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(INDibrNegPtr, INDibrNegBinding, INDbrEq, INDnegNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(INDibrPosPtr, INDibrPosBinding, INDbrEq, INDposNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(INDibrIbrPtr, INDibrIbrBinding, INDbrEq, INDbrEq);
}
}
@ -89,11 +89,11 @@ INDbindCSCComplexToReal (GENmodel *inModel, CKTcircuit *ckt)
/* loop through all the instances of the model */
for (here = INDinstances(model); here != NULL ; here = INDnextInstance(here))
{
CONVERT_KLU_BINDING_TABLE_TO_REAL(INDposIbrPtr, INDposIbrBinding, INDposNode, INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_REAL(INDnegIbrPtr, INDnegIbrBinding, INDnegNode, INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_REAL(INDibrNegPtr, INDibrNegBinding, INDbrEq, INDnegNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL(INDibrPosPtr, INDibrPosBinding, INDbrEq, INDposNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL(INDibrIbrPtr, INDibrIbrBinding, INDbrEq, INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(INDposIbrPtr, INDposIbrBinding, INDposNode, INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(INDnegIbrPtr, INDnegIbrBinding, INDnegNode, INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(INDibrNegPtr, INDibrNegBinding, INDbrEq, INDnegNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(INDibrPosPtr, INDibrPosBinding, INDbrEq, INDposNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(INDibrIbrPtr, INDibrIbrBinding, INDbrEq, INDbrEq);
}
}

View File

@ -71,6 +71,8 @@ SPICEdev INDinfo = {
.DEVbindCSC = INDbindCSC,
.DEVbindCSCComplex = INDbindCSCComplex,
.DEVbindCSCComplexToReal = INDbindCSCComplexToReal,
.DEVisLinear = &INDisLinear,
.DEVisLinearStatic = &INDisLinearStatic,
#endif
};
@ -139,6 +141,8 @@ SPICEdev MUTinfo = {
.DEVbindCSC = MUTbindCSC,
.DEVbindCSCComplex = MUTbindCSCComplex,
.DEVbindCSCComplexToReal = MUTbindCSCComplexToReal,
.DEVisLinear = &MUTisLinear,
.DEVisLinearStatic = &MUTisLinearStatic,
#endif
};

View File

@ -16,4 +16,11 @@ extern int MUTpTSize;
extern int MUTiSize;
extern int MUTmSize;
#ifdef KLU
extern int INDisLinear ;
extern int INDisLinearStatic ;
extern int MUTisLinear ;
extern int MUTisLinearStatic ;
#endif
#endif

View File

@ -39,8 +39,8 @@ MUTbindCSC (GENmodel *inModel, CKTcircuit *ckt)
/* loop through all the instances of the model */
for (here = MUTinstances(model); here != NULL ; here = MUTnextInstance(here))
{
CREATE_KLU_BINDING_TABLE(MUTbr1br2Ptr, MUTbr1br2Binding, MUTind1->INDbrEq, MUTind2->INDbrEq);
CREATE_KLU_BINDING_TABLE(MUTbr2br1Ptr, MUTbr2br1Binding, MUTind2->INDbrEq, MUTind1->INDbrEq);
CREATE_KLU_BINDING_TABLE_DYNAMIC(MUTbr1br2Ptr, MUTbr1br2Binding, MUTind1->INDbrEq, MUTind2->INDbrEq);
CREATE_KLU_BINDING_TABLE_DYNAMIC(MUTbr2br1Ptr, MUTbr2br1Binding, MUTind2->INDbrEq, MUTind1->INDbrEq);
}
}
@ -61,8 +61,8 @@ MUTbindCSCComplex (GENmodel *inModel, CKTcircuit *ckt)
/* loop through all the instances of the model */
for (here = MUTinstances(model); here != NULL ; here = MUTnextInstance(here))
{
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(MUTbr1br2Ptr, MUTbr1br2Binding, MUTind1->INDbrEq, MUTind2->INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(MUTbr2br1Ptr, MUTbr2br1Binding, MUTind2->INDbrEq, MUTind1->INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(MUTbr1br2Ptr, MUTbr1br2Binding, MUTind1->INDbrEq, MUTind2->INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(MUTbr2br1Ptr, MUTbr2br1Binding, MUTind2->INDbrEq, MUTind1->INDbrEq);
}
}
@ -83,8 +83,8 @@ MUTbindCSCComplexToReal (GENmodel *inModel, CKTcircuit *ckt)
/* loop through all the instances of the model */
for (here = MUTinstances(model); here != NULL ; here = MUTnextInstance(here))
{
CONVERT_KLU_BINDING_TABLE_TO_REAL(MUTbr1br2Ptr, MUTbr1br2Binding, MUTind1->INDbrEq, MUTind2->INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_REAL(MUTbr2br1Ptr, MUTbr2br1Binding, MUTind2->INDbrEq, MUTind1->INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(MUTbr1br2Ptr, MUTbr1br2Binding, MUTind1->INDbrEq, MUTind2->INDbrEq);
CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(MUTbr2br1Ptr, MUTbr2br1Binding, MUTind2->INDbrEq, MUTind1->INDbrEq);
}
}

View File

@ -77,3 +77,8 @@ int RESpTSize = NUMELEMS(RESpTable);
int RESmPTSize = NUMELEMS(RESmPTable);
int RESiSize = sizeof(RESinstance);
int RESmSize = sizeof(RESmodel);
#ifdef KLU
int RESisLinear = 1 ;
int RESisLinearStatic = 1 ;
#endif

View File

@ -39,10 +39,10 @@ RESbindCSC (GENmodel *inModel, CKTcircuit *ckt)
/* loop through all the instances of the model */
for (here = RESinstances(model); here != NULL ; here = RESnextInstance(here))
{
CREATE_KLU_BINDING_TABLE(RESposPosPtr, RESposPosBinding, RESposNode, RESposNode);
CREATE_KLU_BINDING_TABLE(RESnegNegPtr, RESnegNegBinding, RESnegNode, RESnegNode);
CREATE_KLU_BINDING_TABLE(RESposNegPtr, RESposNegBinding, RESposNode, RESnegNode);
CREATE_KLU_BINDING_TABLE(RESnegPosPtr, RESnegPosBinding, RESnegNode, RESposNode);
CREATE_KLU_BINDING_TABLE_STATIC(RESposPosPtr, RESposPosBinding, RESposNode, RESposNode);
CREATE_KLU_BINDING_TABLE_STATIC(RESnegNegPtr, RESnegNegBinding, RESnegNode, RESnegNode);
CREATE_KLU_BINDING_TABLE_STATIC(RESposNegPtr, RESposNegBinding, RESposNode, RESnegNode);
CREATE_KLU_BINDING_TABLE_STATIC(RESnegPosPtr, RESnegPosBinding, RESnegNode, RESposNode);
}
}
@ -63,10 +63,10 @@ RESbindCSCComplex (GENmodel *inModel, CKTcircuit *ckt)
/* loop through all the instances of the model */
for (here = RESinstances(model); here != NULL ; here = RESnextInstance(here))
{
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(RESposPosPtr, RESposPosBinding, RESposNode, RESposNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(RESnegNegPtr, RESnegNegBinding, RESnegNode, RESnegNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(RESposNegPtr, RESposNegBinding, RESposNode, RESnegNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(RESnegPosPtr, RESnegPosBinding, RESnegNode, RESposNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_STATIC(RESposPosPtr, RESposPosBinding, RESposNode, RESposNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_STATIC(RESnegNegPtr, RESnegNegBinding, RESnegNode, RESnegNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_STATIC(RESposNegPtr, RESposNegBinding, RESposNode, RESnegNode);
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_STATIC(RESnegPosPtr, RESnegPosBinding, RESnegNode, RESposNode);
}
}
@ -87,10 +87,10 @@ RESbindCSCComplexToReal (GENmodel *inModel, CKTcircuit *ckt)
/* loop through all the instances of the model */
for (here = RESinstances(model); here != NULL ; here = RESnextInstance(here))
{
CONVERT_KLU_BINDING_TABLE_TO_REAL(RESposPosPtr, RESposPosBinding, RESposNode, RESposNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL(RESnegNegPtr, RESnegNegBinding, RESnegNode, RESnegNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL(RESposNegPtr, RESposNegBinding, RESposNode, RESnegNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL(RESnegPosPtr, RESnegPosBinding, RESnegNode, RESposNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL_STATIC(RESposPosPtr, RESposPosBinding, RESposNode, RESposNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL_STATIC(RESnegNegPtr, RESnegNegBinding, RESnegNode, RESnegNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL_STATIC(RESposNegPtr, RESposNegBinding, RESposNode, RESnegNode);
CONVERT_KLU_BINDING_TABLE_TO_REAL_STATIC(RESnegPosPtr, RESnegPosBinding, RESnegNode, RESposNode);
}
}

View File

@ -71,6 +71,8 @@ SPICEdev RESinfo = {
.DEVbindCSC = RESbindCSC,
.DEVbindCSCComplex = RESbindCSCComplex,
.DEVbindCSCComplexToReal = RESbindCSCComplexToReal,
.DEVisLinear = &RESisLinear,
.DEVisLinearStatic = &RESisLinearStatic,
#endif
};

View File

@ -10,4 +10,9 @@ extern int RESnSize;
extern int RESiSize;
extern int RESmSize;
#ifdef KLU
extern int RESisLinear ;
extern int RESisLinearStatic ;
#endif
#endif

View File

@ -52,3 +52,8 @@ int VSRCpTSize = NUMELEMS(VSRCpTable);
int VSRCmPTSize = 0;
int VSRCiSize = sizeof(VSRCinstance);
int VSRCmSize = sizeof(VSRCmodel);
#ifdef KLU
int VSRCisLinear = 0 ;
int VSRCisLinearStatic = 0 ;
#endif

View File

@ -71,6 +71,8 @@ SPICEdev VSRCinfo = {
.DEVbindCSC = VSRCbindCSC,
.DEVbindCSCComplex = VSRCbindCSCComplex,
.DEVbindCSCComplexToReal = VSRCbindCSCComplexToReal,
.DEVisLinear = &VSRCisLinear,
.DEVisLinearStatic = &VSRCisLinearStatic,
#endif
};

View File

@ -8,4 +8,9 @@ extern int VSRCnSize;
extern int VSRCiSize;
extern int VSRCmSize;
#ifdef KLU
extern int VSRCisLinear ;
extern int VSRCisLinearStatic ;
#endif
#endif