From 27fb6cd0a61a14e7b003bcfa9e7714d8c11efc4c Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 20 Nov 2022 15:07:46 +0100 Subject: [PATCH] Allow resetting the limit for warning mesaages, when a new run is started. --- src/frontend/runcoms.c | 3 +++ src/include/ngspice/cktdefs.h | 1 + src/maths/ni/niiter.c | 9 +++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/frontend/runcoms.c b/src/frontend/runcoms.c index e23623373..9d52e192e 100644 --- a/src/frontend/runcoms.c +++ b/src/frontend/runcoms.c @@ -34,6 +34,7 @@ Modified: 2000 AlansFixes static int dosim(char *what, wordlist *wl); extern struct INPmodel *modtab; extern struct dbcomm *dbs; +extern void NIresetwarnmsg(void); /* Routines for the commands op, tran, ac, dc, listing, device, state, * resume, stop, trace, run, end. Op, tran, ac, and dc cause the action @@ -261,6 +262,8 @@ static int dosim( return 0; } + NIresetwarnmsg(); + /* From now on until the next prompt, an interrupt will just * set a flag and let spice finish up, then control will be * passed back to the user. diff --git a/src/include/ngspice/cktdefs.h b/src/include/ngspice/cktdefs.h index b849c2b6f..b9b14a9cc 100644 --- a/src/include/ngspice/cktdefs.h +++ b/src/include/ngspice/cktdefs.h @@ -480,6 +480,7 @@ extern void NIdestroy(CKTcircuit *); extern int NIinit(CKTcircuit *); extern int NIintegrate(CKTcircuit *, double *, double *, double , int); extern int NIiter(CKTcircuit * , int); +extern void NIresetwarnmsg(void); extern int NIpzMuller(PZtrial **, PZtrial *); extern int NIpzComplex(PZtrial **, PZtrial *); extern int NIpzSym(PZtrial **, PZtrial *); diff --git a/src/maths/ni/niiter.c b/src/maths/ni/niiter.c index 597391750..fd7966dc9 100644 --- a/src/maths/ni/niiter.c +++ b/src/maths/ni/niiter.c @@ -20,6 +20,9 @@ Modified: 2001 AlansFixes #include "ngspice/sperror.h" #include "ngspice/fteext.h" +/* Limit the number of 'singular matrix' warnings */ +static int msgcount = 0; +void NIresetwarnmsg(void); /* NIiter() - return value is non-zero for convergence failure */ @@ -32,8 +35,6 @@ NIiter(CKTcircuit *ckt, int maxIter) int iterno = 0; int ipass = 0; - static int msgcount = 0; - /* some convergence issues that get resolved by increasing max iter */ if (maxIter < 100) maxIter = 100; @@ -283,3 +284,7 @@ NIiter(CKTcircuit *ckt, int maxIter) } /*NOTREACHED*/ } + +void NIresetwarnmsg(void) { + msgcount = 0; +};