Added the support for .ic statement in KLU mode
This commit is contained in:
parent
50b2694678
commit
43f7bede8f
|
|
@ -997,15 +997,36 @@ SMPelement *
|
|||
SMPfindElt (SMPmatrix *eMatrix, int Row, int Col, int CreateIfMissing)
|
||||
{
|
||||
MatrixPtr Matrix = eMatrix->SPmatrix ;
|
||||
ElementPtr Element ;
|
||||
|
||||
/* Begin `SMPfindElt'. */
|
||||
assert (IS_SPARSE (Matrix)) ;
|
||||
Row = Matrix->ExtToIntRowMap [Row] ;
|
||||
Col = Matrix->ExtToIntColMap [Col] ;
|
||||
Element = Matrix->FirstInCol [Col] ;
|
||||
Element = spcFindElementInCol (Matrix, &Element, Row, Col, CreateIfMissing) ;
|
||||
return (SMPelement *)Element ;
|
||||
if (eMatrix->CKTkluMODE)
|
||||
{
|
||||
int i ;
|
||||
|
||||
Row = Matrix->ExtToIntRowMap [Row] ;
|
||||
Col = Matrix->ExtToIntColMap [Col] ;
|
||||
for (i = eMatrix->CKTkluAp [Col - 1] ; i < eMatrix->CKTkluAp [Col] ; i++) {
|
||||
if (eMatrix->CKTkluAi [i] == Row - 1) {
|
||||
if (eMatrix->CKTkluMatrixIsComplex == CKTkluMatrixReal) {
|
||||
return (SMPelement *) &(eMatrix->CKTkluAx [i]) ;
|
||||
} else if (eMatrix->CKTkluMatrixIsComplex == CKTkluMatrixComplex) {
|
||||
return (SMPelement *) &(eMatrix->CKTkluAx_Complex [2 * i]) ;
|
||||
} else {
|
||||
return NULL ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL ;
|
||||
} else {
|
||||
ElementPtr Element ;
|
||||
|
||||
/* Begin `SMPfindElt'. */
|
||||
assert (IS_SPARSE (Matrix)) ;
|
||||
Row = Matrix->ExtToIntRowMap [Row] ;
|
||||
Col = Matrix->ExtToIntColMap [Col] ;
|
||||
Element = Matrix->FirstInCol [Col] ;
|
||||
Element = spcFindElementInCol (Matrix, &Element, Row, Col, CreateIfMissing) ;
|
||||
return (SMPelement *)Element ;
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX The following should probably be implemented in spUtils */
|
||||
|
|
|
|||
|
|
@ -25,15 +25,30 @@ CKTic(CKTcircuit *ckt)
|
|||
|
||||
for(node = ckt->CKTnodes;node != NULL; node = node->next) {
|
||||
if(node->nsGiven) {
|
||||
node->ptr = SMPmakeElt(ckt->CKTmatrix,node->number,node->number);
|
||||
if (ckt->CKTkluMODE) {
|
||||
node->ptr = (double *) SMPfindElt (ckt->CKTmatrix, node->number, node->number, 0) ;
|
||||
if (node->ptr == NULL) {
|
||||
printf ("Warning: The needed element doesn't exist in the matrix, but KLU mode cannot create a new element. ") ;
|
||||
printf ("Please specify an existing element for .nodeset\n") ;
|
||||
}
|
||||
} else {
|
||||
node->ptr = SMPmakeElt(ckt->CKTmatrix,node->number,node->number);
|
||||
}
|
||||
if(node->ptr == NULL) return(E_NOMEM);
|
||||
ckt->CKThadNodeset = 1;
|
||||
ckt->CKTrhsOld[node->number] = ckt->CKTrhs[node->number] = node->nodeset;
|
||||
}
|
||||
if(node->icGiven) {
|
||||
if(! ( node->ptr)) {
|
||||
node->ptr = SMPmakeElt(ckt->CKTmatrix,node->number,
|
||||
node->number);
|
||||
if (ckt->CKTkluMODE) {
|
||||
node->ptr = (double *) SMPfindElt (ckt->CKTmatrix, node->number, node->number, 0) ;
|
||||
if (node->ptr == NULL) {
|
||||
printf ("Warning: The needed element doesn't exist in the matrix, but KLU mode cannot create a new element. ") ;
|
||||
printf ("Please specify an existing element for .ic\n") ;
|
||||
}
|
||||
} else {
|
||||
node->ptr = SMPmakeElt(ckt->CKTmatrix,node->number, node->number);
|
||||
}
|
||||
if(node->ptr == NULL) return(E_NOMEM);
|
||||
}
|
||||
ckt->CKTrhsOld[node->number] = ckt->CKTrhs[node->number] = node->ic;
|
||||
|
|
|
|||
Loading…
Reference in New Issue