Merge branch 'pre-master-42' into bt_dev
This commit is contained in:
commit
f1ecb41be5
|
|
@ -30,6 +30,7 @@ vin in 0 DC 0 PULSE(0.1 0.2 200uS 200uS 200uS 5m 10m)
|
|||
.tran 10u 10m
|
||||
|
||||
.control
|
||||
option sparse ; KLU will fail
|
||||
run
|
||||
plot dc1.v(outo) vs dc1.v(in)
|
||||
plot v(in) v(a1) v(outo)
|
||||
|
|
|
|||
|
|
@ -179,6 +179,8 @@ com_listing(wordlist *wl)
|
|||
} else {
|
||||
if (type != LS_DECK && type != LS_RUNNABLE)
|
||||
fprintf(cp_out, "\t%s\n\n", ft_curckt->ci_name);
|
||||
else if (type == LS_RUNNABLE)
|
||||
fprintf(cp_out, "* expanded deck of %s\n", ft_curckt->ci_name);
|
||||
inp_list(cp_out,
|
||||
expand ? ft_curckt->ci_deck : ft_curckt->ci_origdeck,
|
||||
ft_curckt->ci_options, type);
|
||||
|
|
|
|||
|
|
@ -614,6 +614,7 @@ static void ptable_print(PTABLE pt)
|
|||
|
||||
/* Start of logicexp parser */
|
||||
static char *get_inst_name(void);
|
||||
static char *get_temp_name(void);
|
||||
static void aerror(char *s);
|
||||
static BOOL amatch(int t);
|
||||
static BOOL bexpr(void);
|
||||
|
|
|
|||
|
|
@ -532,7 +532,7 @@ check_autostop(char* what)
|
|||
{
|
||||
bool flag = FALSE;
|
||||
|
||||
if (cp_getvar("autostop", CP_BOOL, NULL, 0))
|
||||
// if (cp_getvar("autostop", CP_BOOL, NULL, 0))
|
||||
flag = do_measure(what, TRUE);
|
||||
|
||||
return flag;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "ngspice/spmatrix.h"
|
||||
#include "../sparse/spdefs.h"
|
||||
#include "ngspice/smpdefs.h"
|
||||
#include "ngspice/fteext.h"
|
||||
|
||||
#if defined (_MSC_VER)
|
||||
extern double scalbn(double, int);
|
||||
|
|
@ -535,9 +536,11 @@ SMPcLUfac (SMPmatrix *Matrix, double PivTol)
|
|||
if (ret == 0)
|
||||
{
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
|
||||
fprintf (stderr, "Warning (ReFactor Complex): KLU Matrix is SINGULAR\n") ;
|
||||
fprintf (stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank) ;
|
||||
fprintf (stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1) ;
|
||||
if (ft_ngdebug) {
|
||||
fprintf(stderr, "Warning (ReFactor Complex): KLU Matrix is SINGULAR\n");
|
||||
fprintf(stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank);
|
||||
fprintf(stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1);
|
||||
}
|
||||
return E_SINGULAR ;
|
||||
}
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
|
||||
|
|
@ -590,9 +593,11 @@ SMPluFac (SMPmatrix *Matrix, double PivTol, double Gmin)
|
|||
if (ret == 0)
|
||||
{
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
|
||||
fprintf (stderr, "Warning (ReFactor): KLU Matrix is SINGULAR\n") ;
|
||||
fprintf (stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank) ;
|
||||
fprintf (stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1) ;
|
||||
if (ft_ngdebug) {
|
||||
fprintf(stderr, "Warning (ReFactor): KLU Matrix is SINGULAR\n");
|
||||
fprintf(stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank);
|
||||
fprintf(stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1);
|
||||
}
|
||||
return E_SINGULAR ;
|
||||
}
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
|
||||
|
|
@ -655,9 +660,11 @@ SMPluFacKLUforCIDER (SMPmatrix *Matrix)
|
|||
if (ret == 0)
|
||||
{
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
|
||||
fprintf (stderr, "Warning (ReFactor for CIDER): KLU Matrix is SINGULAR\n") ;
|
||||
fprintf (stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank) ;
|
||||
fprintf (stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1) ;
|
||||
if (ft_ngdebug) {
|
||||
fprintf(stderr, "Warning (ReFactor for CIDER): KLU Matrix is SINGULAR\n");
|
||||
fprintf(stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank);
|
||||
fprintf(stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1);
|
||||
}
|
||||
return E_SINGULAR ;
|
||||
}
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
|
||||
|
|
@ -707,9 +714,11 @@ SMPcReorder (SMPmatrix *Matrix, double PivTol, double PivRel, int *NumSwaps)
|
|||
if (Matrix->SMPkluMatrix->KLUmatrixNumeric == NULL)
|
||||
{
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
|
||||
fprintf (stderr, "Warning (Factor Complex): KLU Matrix is SINGULAR\n") ;
|
||||
fprintf (stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank) ;
|
||||
fprintf (stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1) ;
|
||||
if (ft_ngdebug) {
|
||||
fprintf(stderr, "Warning (Factor Complex): KLU Matrix is SINGULAR\n");
|
||||
fprintf(stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank);
|
||||
fprintf(stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1);
|
||||
}
|
||||
return E_SINGULAR ;
|
||||
}
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
|
||||
|
|
@ -765,9 +774,11 @@ SMPreorder (SMPmatrix *Matrix, double PivTol, double PivRel, double Gmin)
|
|||
if (Matrix->SMPkluMatrix->KLUmatrixNumeric == NULL)
|
||||
{
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
|
||||
fprintf (stderr, "Warning (Factor): KLU Matrix is SINGULAR\n") ;
|
||||
fprintf (stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank) ;
|
||||
fprintf (stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1) ;
|
||||
if (ft_ngdebug) {
|
||||
fprintf(stderr, "Warning (Factor): KLU Matrix is SINGULAR\n");
|
||||
fprintf(stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank);
|
||||
fprintf(stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1);
|
||||
}
|
||||
return E_SINGULAR ;
|
||||
}
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
|
||||
|
|
@ -835,9 +846,11 @@ SMPreorderKLUforCIDER (SMPmatrix *Matrix)
|
|||
if (Matrix->SMPkluMatrix->KLUmatrixNumeric == NULL)
|
||||
{
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
|
||||
fprintf (stderr, "Warning (Factor for CIDER): KLU Matrix is SINGULAR\n") ;
|
||||
fprintf (stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank) ;
|
||||
fprintf (stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1) ;
|
||||
if (ft_ngdebug) {
|
||||
fprintf(stderr, "Warning (Factor for CIDER): KLU Matrix is SINGULAR\n");
|
||||
fprintf(stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank);
|
||||
fprintf(stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1);
|
||||
}
|
||||
return E_SINGULAR ;
|
||||
}
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
|
||||
|
|
@ -960,9 +973,12 @@ SMPsolve (SMPmatrix *Matrix, double RHS[], double Spare[])
|
|||
if (ret == 0)
|
||||
{
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon->status == KLU_SINGULAR) {
|
||||
fprintf (stderr, "Warning (Solve): KLU Matrix is SINGULAR\n") ;
|
||||
fprintf (stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank) ;
|
||||
fprintf (stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1) ;
|
||||
if (ft_ngdebug) {
|
||||
fprintf(stderr, "Warning (Solve): KLU Matrix is SINGULAR\n");
|
||||
fprintf(stderr, " Numerical Rank: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->numerical_rank);
|
||||
fprintf(stderr, " Singular Node: %d\n", Matrix->SMPkluMatrix->KLUmatrixCommon->singular_col + 1);
|
||||
}
|
||||
/* FIXME: Do we need a 'return E_SINGULAR' here? */
|
||||
}
|
||||
if (Matrix->SMPkluMatrix->KLUmatrixCommon == NULL) {
|
||||
fprintf (stderr, "Error (Solve): KLUcommon object is NULL. A problem occurred\n") ;
|
||||
|
|
|
|||
|
|
@ -166,8 +166,8 @@ NIiter(CKTcircuit *ckt, int maxIter)
|
|||
* This is my mod with KLU. It saves run-time, but also the system at the next iteration may be different.
|
||||
* How do we guarantee that the system is the same at the next iteration? So, the original SPARSE version below sounds like a bug.
|
||||
*/
|
||||
|
||||
fprintf (stderr, "Warning: KLU ReFactor failed. Factoring again...\n") ;
|
||||
if (ft_ngdebug)
|
||||
fprintf (stderr, "Warning: KLU ReFactor failed. Factoring again...\n") ;
|
||||
ckt->CKTniState |= NISHOULDREORDER;
|
||||
ckt->CKTmatrix->SMPkluMatrix->KLUloadDiagGmin = 0 ;
|
||||
error = SMPreorder(ckt->CKTmatrix, ckt->CKTpivotAbsTol, ckt->CKTpivotRelTol, ckt->CKTdiagGmin);
|
||||
|
|
|
|||
|
|
@ -478,8 +478,10 @@ int OSDIbindCSC(GENmodel *inModel, CKTcircuit *ckt) {
|
|||
GENmodel *gen_model;
|
||||
GENinstance *gen_inst;
|
||||
|
||||
/* setup a temporary buffer */
|
||||
uint32_t *node_ids = TMALLOC(uint32_t, descr->num_nodes);
|
||||
NG_IGNORE(ckt);
|
||||
|
||||
/* setup a temporary buffer
|
||||
uint32_t *node_ids = TMALLOC(uint32_t, descr->num_nodes);*/
|
||||
|
||||
for (gen_model = inModel; gen_model; gen_model = gen_model->GENnextModel) {
|
||||
void *model = osdi_model_data(gen_model);
|
||||
|
|
@ -503,8 +505,10 @@ int OSDIupdateCSC(GENmodel *inModel, CKTcircuit *ckt, bool complex) {
|
|||
GENmodel *gen_model;
|
||||
GENinstance *gen_inst;
|
||||
|
||||
/* setup a temporary buffer */
|
||||
uint32_t *node_ids = TMALLOC(uint32_t, descr->num_nodes);
|
||||
NG_IGNORE(ckt);
|
||||
|
||||
/* setup a temporary buffer
|
||||
uint32_t *node_ids = TMALLOC(uint32_t, descr->num_nodes);*/
|
||||
|
||||
for (gen_model = inModel; gen_model; gen_model = gen_model->GENnextModel) {
|
||||
void *model = osdi_model_data(gen_model);
|
||||
|
|
@ -522,10 +526,10 @@ int OSDIupdateCSC(GENmodel *inModel, CKTcircuit *ckt, bool complex) {
|
|||
return (OK);
|
||||
}
|
||||
int OSDIbindCSCComplexToReal(GENmodel *inModel, CKTcircuit *ckt) {
|
||||
OSDIupdateCSC(inModel, ckt, false);
|
||||
return OSDIupdateCSC(inModel, ckt, false);
|
||||
}
|
||||
|
||||
int OSDIbindCSCComplex(GENmodel *inModel, CKTcircuit *ckt) {
|
||||
OSDIupdateCSC(inModel, ckt, true);
|
||||
return OSDIupdateCSC(inModel, ckt, true);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ Modified: 2005 Paolo Nenzi - Restructured
|
|||
#include "ngspice/devdefs.h"
|
||||
#include "ngspice/sperror.h"
|
||||
#include "ngspice/cpextern.h"
|
||||
#include "ngspice/fteext.h"
|
||||
|
||||
#ifdef XSPICE
|
||||
#include "ngspice/enh.h"
|
||||
#endif
|
||||
|
||||
extern bool ft_ngdebug;
|
||||
|
||||
static int dynamic_gmin(CKTcircuit *, long int, long int, int);
|
||||
static int spice3_gmin(CKTcircuit *, long int, long int, int);
|
||||
static int new_gmin(CKTcircuit*, long int, long int, int);
|
||||
|
|
@ -108,6 +107,8 @@ CKTop (CKTcircuit *ckt, long int firstmode, long int continuemode,
|
|||
#endif
|
||||
|
||||
fprintf(cp_err, "\nError: The operating point could not be simulated successfully.\n");
|
||||
if (ft_stricterror)
|
||||
controlled_exit(1);
|
||||
fprintf(cp_err, " Any of the following steps may fail.!\n\n");
|
||||
|
||||
return converged;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -94,6 +94,8 @@ DCtran(CKTcircuit *ckt,
|
|||
int numNames;
|
||||
double maxstepsize = 0.0;
|
||||
|
||||
bool have_autostop = FALSE, flag_autostop = FALSE;
|
||||
|
||||
int ltra_num;
|
||||
CKTnode *node;
|
||||
#ifdef XSPICE
|
||||
|
|
@ -184,6 +186,8 @@ DCtran(CKTcircuit *ckt,
|
|||
save_mode = (ckt->CKTmode&MODEUIC) | MODETRANOP | MODEINITJCT;
|
||||
save_order = ckt->CKTorder;
|
||||
|
||||
have_autostop = cp_getvar("autostop", CP_BOOL, NULL, 0);
|
||||
|
||||
/* Add breakpoints here which have been requested by the user setting the
|
||||
stop command as 'stop when time = xx'.
|
||||
Get data from the global dbs data base.
|
||||
|
|
@ -466,8 +470,14 @@ DCtran(CKTcircuit *ckt,
|
|||
/* gtri - end - wbk - Update event queues/data for accepted timepoint */
|
||||
#endif
|
||||
ckt->CKTstat->STAToldIter = ckt->CKTstat->STATnumIter;
|
||||
if (check_autostop("tran") ||
|
||||
ckt->CKTfinalTime - ckt->CKTtime < ckt->CKTminBreak) {
|
||||
/* check for the end of the tran simulation, either by< stop time given,
|
||||
or final time has been reached. */
|
||||
if (have_autostop)
|
||||
/* time consuming autostop check only, when variable 'autostop' has been set
|
||||
before tran is started.*/
|
||||
flag_autostop = check_autostop("tran");
|
||||
/* If CKTtime and CKTfinalTime are almost equal, then finish */
|
||||
if (flag_autostop || AlmostEqualUlps(ckt->CKTtime, ckt->CKTfinalTime, 100)) {
|
||||
#ifdef STEPDEBUG
|
||||
printf(" done: time is %g, final time is %g, and tol is %g\n",
|
||||
ckt->CKTtime, ckt->CKTfinalTime, ckt->CKTminBreak);
|
||||
|
|
@ -480,6 +490,10 @@ DCtran(CKTcircuit *ckt,
|
|||
ckt->CKTsenInfo->SENmode = save;
|
||||
}
|
||||
#endif
|
||||
if (flag_autostop)
|
||||
fprintf(stdout, "\nNote: Autostop after %e s, all measurement conditions are fulfilled.\n", ckt->CKTtime);
|
||||
|
||||
/* Final return from tran*/
|
||||
return(OK);
|
||||
}
|
||||
if(SPfrontEnd->IFpauseTest()) {
|
||||
|
|
|
|||
|
|
@ -183,6 +183,8 @@ dot_ac(char *line, CKTcircuit *ckt, INPtables *tab, struct card *current,
|
|||
int which; /* which analysis we are performing */
|
||||
char *steptype; /* ac analysis, type of stepping function */
|
||||
bool pdef = FALSE; /* issue a warning if default parameters are used */
|
||||
char* mline = line; /* for debug printout */
|
||||
double startval, stopval;
|
||||
|
||||
NG_IGNORE(gnode);
|
||||
|
||||
|
|
@ -195,7 +197,7 @@ dot_ac(char *line, CKTcircuit *ckt, INPtables *tab, struct card *current,
|
|||
IFC(newAnalysis, (ckt, which, "AC Analysis", &foo, task));
|
||||
INPgetTok(&line, &steptype, 1); /* get DEC, OCT, or LIN */
|
||||
if (!*steptype || (!ciprefix("dec", steptype) && !ciprefix("oct", steptype) && !ciprefix("lin", steptype))) {
|
||||
current->error = "Missing DEC, OCT, or LIN\n";
|
||||
LITERR("Missing DEC, OCT, or LIN.\n");
|
||||
return (0);
|
||||
}
|
||||
ptemp.iValue = 1;
|
||||
|
|
@ -203,23 +205,35 @@ dot_ac(char *line, CKTcircuit *ckt, INPtables *tab, struct card *current,
|
|||
tfree(steptype);
|
||||
|
||||
parm = INPgetValue(ckt, &line, IF_INTEGER, tab); /* number of points */
|
||||
if (parm->iValue == 0)
|
||||
if (parm->iValue < 1) {
|
||||
pdef = TRUE;
|
||||
parm->iValue = 10;
|
||||
}
|
||||
GCA(INPapName, (ckt, which, foo, "numsteps", parm));
|
||||
|
||||
if(!isdigit(*line))
|
||||
if((*line != '.' && !isdigit(*line)) || (*line == '.' && !isdigit(*(line+1))))
|
||||
pdef = TRUE;
|
||||
parm = INPgetValue(ckt, &line, IF_REAL, tab); /* fstart */
|
||||
startval = parm->rValue;
|
||||
if (startval <= 0) {
|
||||
pdef = TRUE;
|
||||
startval = parm->rValue = 1.;
|
||||
}
|
||||
GCA(INPapName, (ckt, which, foo, "start", parm));
|
||||
|
||||
parm = INPgetValue(ckt, &line, IF_REAL, tab); /* fstop */
|
||||
if (parm->rValue == 0)
|
||||
if((*line != '.' && !isdigit(*line)) || (*line == '.' && !isdigit(*(line+1))))
|
||||
pdef = TRUE;
|
||||
parm = INPgetValue(ckt, &line, IF_REAL, tab); /* fstop */
|
||||
stopval = parm->rValue;
|
||||
if (stopval < startval) {
|
||||
pdef = TRUE;
|
||||
parm->rValue = 1000. * startval;
|
||||
}
|
||||
GCA(INPapName, (ckt, which, foo, "stop", parm));
|
||||
|
||||
if (pdef) {
|
||||
fprintf(stderr, "Warning, ngspice assumes default parameter(s) for ac simulation\n");
|
||||
fprintf(stderr, " Check your ac or .ac line\n\n");
|
||||
fprintf(stderr, " Check your input line '.ac %s'\n\n", mline);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
|
@ -770,7 +784,9 @@ INP2dot(CKTcircuit *ckt, INPtables *tab, struct card *current, TSKtask *task, CK
|
|||
} else if ((strcmp(token, ".width") == 0) ||
|
||||
strcmp(token, ".print") == 0 || strcmp(token, ".plot") == 0) {
|
||||
/* obsolete - ignore */
|
||||
LITERR(" Warning: obsolete control card - ignored \n");
|
||||
char* token2 = tprintf(" obsolete dot command '%s' - ignored \n", token);
|
||||
LITERR(token2);
|
||||
tfree(token2);
|
||||
goto quit;
|
||||
} else if ((strcmp(token, ".temp") == 0)) {
|
||||
/* .temp temp1 temp2 temp3 temp4 ..... */
|
||||
|
|
@ -877,7 +893,9 @@ INP2dot(CKTcircuit *ckt, INPtables *tab, struct card *current, TSKtask *task, CK
|
|||
rtn = 0;
|
||||
goto quit;
|
||||
}
|
||||
LITERR(" unimplemented control card - error \n");
|
||||
char *token2 = tprintf(" unimplemented dot command '%s'\n", token);
|
||||
LITERR(token2);
|
||||
tfree(token2);
|
||||
quit:
|
||||
tfree(token);
|
||||
return rtn;
|
||||
|
|
|
|||
Loading…
Reference in New Issue