|
|
|
@ -123,48 +123,6 @@ CKTsetup(CKTcircuit *ckt) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#ifdef KLU |
|
|
|
if (ckt->CKTmatrix->CKTkluMODE) |
|
|
|
{ |
|
|
|
fprintf (stderr, "Using KLU as Direct Linear Solver\n") ; |
|
|
|
|
|
|
|
int i ; |
|
|
|
int n = SMPmatSize (ckt->CKTmatrix) ; |
|
|
|
ckt->CKTmatrix->CKTkluN = n ; |
|
|
|
|
|
|
|
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->CKTkluIntermediate = TMALLOC (double, n) ; |
|
|
|
|
|
|
|
ckt->CKTmatrix->CKTbindStruct = TMALLOC (BindElement, nz) ; |
|
|
|
|
|
|
|
ckt->CKTmatrix->CKTdiag_CSC = TMALLOC (double *, n) ; |
|
|
|
|
|
|
|
/* Complex Stuff needed for AC Analysis */ |
|
|
|
ckt->CKTmatrix->CKTkluAx_Complex = TMALLOC (double, 2 * nz) ; |
|
|
|
ckt->CKTmatrix->CKTkluIntermediate_Complex = TMALLOC (double, 2 * n) ; |
|
|
|
|
|
|
|
/* Binding Table from Sparse to CSC Format Creation */ |
|
|
|
SMPmatrix_CSC (ckt->CKTmatrix) ; |
|
|
|
|
|
|
|
/* Binding Table Sorting */ |
|
|
|
qsort (ckt->CKTmatrix->CKTbindStruct, (size_t)nz, sizeof(BindElement), BindCompare) ; |
|
|
|
|
|
|
|
/* KLU Pointers Assignment */ |
|
|
|
for (i = 0 ; i < DEVmaxnum ; i++) |
|
|
|
if (DEVices [i] && DEVices [i]->DEVbindCSC && ckt->CKThead [i]) |
|
|
|
DEVices [i]->DEVbindCSC (ckt->CKThead [i], ckt) ; |
|
|
|
|
|
|
|
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixReal ; |
|
|
|
} else { |
|
|
|
fprintf (stderr, "Using SPARSE 1.3 as Direct Linear Solver\n") ; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
for(i=0;i<=MAX(2,ckt->CKTmaxOrder)+1;i++) { /* dctran needs 3 states as minimum */ |
|
|
|
CKALLOC(ckt->CKTstates[i],ckt->CKTnumStates,double); |
|
|
|
} |
|
|
|
@ -208,11 +166,53 @@ CKTsetup(CKTcircuit *ckt) |
|
|
|
i++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/* gtri - end - Setup for adding rshunt option resistors */ |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef KLU |
|
|
|
if (ckt->CKTmatrix->CKTkluMODE) |
|
|
|
{ |
|
|
|
fprintf (stderr, "Using KLU as Direct Linear Solver\n") ; |
|
|
|
|
|
|
|
int i ; |
|
|
|
int n = SMPmatSize (ckt->CKTmatrix) ; |
|
|
|
ckt->CKTmatrix->CKTkluN = n ; |
|
|
|
|
|
|
|
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->CKTkluIntermediate = TMALLOC (double, n) ; |
|
|
|
|
|
|
|
ckt->CKTmatrix->CKTbindStruct = TMALLOC (BindElement, nz) ; |
|
|
|
|
|
|
|
ckt->CKTmatrix->CKTdiag_CSC = TMALLOC (double *, n) ; |
|
|
|
|
|
|
|
/* Complex Stuff needed for AC Analysis */ |
|
|
|
ckt->CKTmatrix->CKTkluAx_Complex = TMALLOC (double, 2 * nz) ; |
|
|
|
ckt->CKTmatrix->CKTkluIntermediate_Complex = TMALLOC (double, 2 * n) ; |
|
|
|
|
|
|
|
/* Binding Table from Sparse to CSC Format Creation */ |
|
|
|
SMPmatrix_CSC (ckt->CKTmatrix) ; |
|
|
|
|
|
|
|
/* Binding Table Sorting */ |
|
|
|
qsort (ckt->CKTmatrix->CKTbindStruct, (size_t)nz, sizeof(BindElement), BindCompare) ; |
|
|
|
|
|
|
|
/* KLU Pointers Assignment */ |
|
|
|
for (i = 0 ; i < DEVmaxnum ; i++) |
|
|
|
if (DEVices [i] && DEVices [i]->DEVbindCSC && ckt->CKThead [i]) |
|
|
|
DEVices [i]->DEVbindCSC (ckt->CKThead [i], ckt) ; |
|
|
|
|
|
|
|
ckt->CKTmatrix->CKTkluMatrixIsComplex = CKTkluMatrixReal ; |
|
|
|
} else { |
|
|
|
fprintf (stderr, "Using SPARSE 1.3 as Direct Linear Solver\n") ; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
return(OK); |
|
|
|
} |
|
|
|
|
|
|
|
|