From 962c73e14eb9cc66443b86889357de1cd7f5cd44 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Wed, 25 Sep 2013 23:33:36 +0200 Subject: [PATCH] dctran.c, sharedspice.c: function sharedsync has modified parameter list --- src/sharedspice.c | 13 +++++++++---- src/spicelib/analysis/dctran.c | 9 +++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/sharedspice.c b/src/sharedspice.c index 7bf0e7c77..af393b382 100644 --- a/src/sharedspice.c +++ b/src/sharedspice.c @@ -202,7 +202,7 @@ void sighandler_sharedspice(int num); void wl_delete_first(wordlist **wlstart, wordlist **wlend); int add_bkpt(void); -int sharedsync(double*, double*, double, double, int, int*, int); +int sharedsync(double*, double*, double, double, double, int, int*, int); #if !defined(low_latency) static char* outstorage(char*, bool); @@ -1775,7 +1775,8 @@ getisrcval(double time, char *iname) convergence, after olddelta had been added in the previous step. cktdelta pointer to newly defined ckt->CKTdelta, e.g. by recognizing truncation errors olddelta old ckt->CKTdelta, has already been added in the previous step. - finalt final time + finalt final time CKTfinaltime + delmin minimum delta CKTdelmin redostep if 0, converged, if 1, either no convergence, need to redo with new ckt->CKTdelta or ckt->CKTdelta has been reduced by tuncation errors too large. @@ -1784,7 +1785,8 @@ getisrcval(double time, char *iname) */ int -sharedsync(double *pckttime, double *pcktdelta, double olddelta, double finalt, int redostep, int *rejected, int loc) +sharedsync(double *pckttime, double *pcktdelta, double olddelta, double finalt, + double delmin, int redostep, int *rejected, int loc) { /* standard procedure, cktdelta has been provided by ngspice */ if (!wantsync) { @@ -1803,6 +1805,9 @@ sharedsync(double *pckttime, double *pcktdelta, double olddelta, double finalt, /* use cktdelta as suggested by ngspice or acquire new cktdelta via pointer pcktdelta in user supplied callback */ getsync(*pckttime, pcktdelta, olddelta, redostep, ng_ident, loc, userptr); + /* never move beyond final time */ + if (*pckttime + *pcktdelta > finalt) + *pcktdelta = finalt - *pckttime - 1.1 * delmin; return 1; } else { @@ -1812,7 +1817,7 @@ sharedsync(double *pckttime, double *pcktdelta, double olddelta, double finalt, int retval = getsync(*pckttime, pcktdelta, olddelta, redostep, ng_ident, loc, userptr); /* never move beyond final time */ if (*pckttime + *pcktdelta > finalt) - *pcktdelta = finalt - *pckttime; + *pcktdelta = finalt - *pckttime - 1.1 * delmin; /* user has decided to redo the step, ignoring redostep being set to 0 by ngspice. */ diff --git a/src/spicelib/analysis/dctran.c b/src/spicelib/analysis/dctran.c index 0358a1c7d..eddf96270 100644 --- a/src/spicelib/analysis/dctran.c +++ b/src/spicelib/analysis/dctran.c @@ -36,7 +36,7 @@ extern struct dbcomm *dbs; #ifdef SHARED_MODULE extern int add_bkpt(void); -extern int sharedsync(double*, double*, double, double, int, int*, int); +extern int sharedsync(double*, double*, double, double, double, int, int*, int); extern int ng_ident; /* for debugging */ static double del_before; /* for debugging */ #endif @@ -630,7 +630,8 @@ resume: #ifdef SHARED_MODULE /* Either directly go to next time step, or modify ckt->CKTdelta depending on synchronization requirements. sharedsync() returns 0. */ - sharedsync(&ckt->CKTtime, &ckt->CKTdelta, 0, ckt->CKTfinalTime, 0, &ckt->CKTstat->STATrejected, 0); + sharedsync(&ckt->CKTtime, &ckt->CKTdelta, 0, ckt->CKTfinalTime, + ckt->CKTdelmin, 0, &ckt->CKTstat->STATrejected, 0); #endif /* gtri - begin - wbk - Do event solution */ @@ -965,8 +966,8 @@ resume: function. */ chkStep: - if(sharedsync(&ckt->CKTtime, &ckt->CKTdelta, olddelta, ckt->CKTfinalTime, redostep, - &ckt->CKTstat->STATrejected, 1) == 0) + if(sharedsync(&ckt->CKTtime, &ckt->CKTdelta, olddelta, ckt->CKTfinalTime, + ckt->CKTdelmin, redostep, &ckt->CKTstat->STATrejected, 1) == 0) goto nextTime; #endif