From 295f212de8afe7a9bc2013a5baf4139253fb48b1 Mon Sep 17 00:00:00 2001 From: Brian Taylor Date: Mon, 6 Nov 2023 14:55:02 -0800 Subject: [PATCH] When CIDER is detected, until KLU works with CIDER, print Error: CIDER simulation is not (yet) supported with 'option klu'. Use 'option sparse' instead. and then call controlled exit(1). --- src/include/ngspice/cidersupt.h | 11 ++++++++++- src/spicelib/devices/nbjt/nbjtset.c | 1 + src/spicelib/devices/nbjt2/nbt2set.c | 2 +- src/spicelib/devices/numd/numdset.c | 1 + src/spicelib/devices/numd2/nud2set.c | 1 + src/spicelib/devices/numos/nummset.c | 2 ++ 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/include/ngspice/cidersupt.h b/src/include/ngspice/cidersupt.h index fd26d80bf..e42f76569 100644 --- a/src/include/ngspice/cidersupt.h +++ b/src/include/ngspice/cidersupt.h @@ -89,6 +89,15 @@ extern BOOLEAN hasSORConverged(double *, double *, int); extern BOOLEAN foundError(int ); extern BOOLEAN compareFiletypeVar(char *); - +#ifdef KLU +#define klu_support_for_cider \ + if (ckt->CKTkluMODE) { \ + fprintf(stderr, "Error: CIDER simulation is not (yet) supported with 'option klu'.\n"); \ + fprintf(stderr, " Use 'option sparse' instead.\n"); \ + controlled_exit(1); \ + } +#else +#define klu_support_for_cider +#endif #endif diff --git a/src/spicelib/devices/nbjt/nbjtset.c b/src/spicelib/devices/nbjt/nbjtset.c index 187dab974..12aa5a696 100644 --- a/src/spicelib/devices/nbjt/nbjtset.c +++ b/src/spicelib/devices/nbjt/nbjtset.c @@ -44,6 +44,7 @@ NBJTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) ONEmaterial *pM, *pMaterial = NULL, *materialList = NULL; double startTime; + klu_support_for_cider /* loop through all the diode models */ for (; model != NULL; model = NBJTnextModel(model)) { diff --git a/src/spicelib/devices/nbjt2/nbt2set.c b/src/spicelib/devices/nbjt2/nbt2set.c index a39fe7684..1b126b98e 100644 --- a/src/spicelib/devices/nbjt2/nbt2set.c +++ b/src/spicelib/devices/nbjt2/nbt2set.c @@ -47,7 +47,7 @@ NBJT2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) DOPtable *dopTableList = NULL; double startTime; - + klu_support_for_cider /* loop through all the models */ for (; model != NULL; model = NBJT2nextModel(model)) { diff --git a/src/spicelib/devices/numd/numdset.c b/src/spicelib/devices/numd/numdset.c index 63748b2e0..fd9efa662 100644 --- a/src/spicelib/devices/numd/numdset.c +++ b/src/spicelib/devices/numd/numdset.c @@ -45,6 +45,7 @@ NUMDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) DOPtable *dopTableList = NULL; double startTime; + klu_support_for_cider /* loop through all the models */ for (; model != NULL; model = NUMDnextModel(model)) { diff --git a/src/spicelib/devices/numd2/nud2set.c b/src/spicelib/devices/numd2/nud2set.c index 571dcdadc..973b0140d 100644 --- a/src/spicelib/devices/numd2/nud2set.c +++ b/src/spicelib/devices/numd2/nud2set.c @@ -47,6 +47,7 @@ NUMD2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) DOPtable *dopTableList = NULL; double startTime; + klu_support_for_cider /* loop through all the models */ for (; model != NULL; model = NUMD2nextModel(model)) { diff --git a/src/spicelib/devices/numos/nummset.c b/src/spicelib/devices/numos/nummset.c index 37f0efc31..0ae7760ff 100644 --- a/src/spicelib/devices/numos/nummset.c +++ b/src/spicelib/devices/numos/nummset.c @@ -47,6 +47,8 @@ NUMOSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) DOPtable *dopTableList = NULL; double startTime; + klu_support_for_cider + /* loop through all the models */ for (; model != NULL; model = NUMOSnextModel(model)) { if (!model->NUMOSpInfo) {