better detect wrap arounds (use sweep var, first column saved by ngspice) in multiple sweep dc sims
This commit is contained in:
parent
f88f9f8e2e
commit
6de84a69e9
20
src/draw.c
20
src/draw.c
|
|
@ -2457,12 +2457,13 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset)
|
|||
double xx, xx0 = 0.0; /* gcc gives false warnings if xx0 not initialized here */
|
||||
int cnt=0, wrap;
|
||||
register SPICE_DATA *gv = raw->values[sweep_idx];
|
||||
SPICE_DATA *gv0 = raw->values[0]; /* spice sweep variable, used to determine wrap arounds */
|
||||
ofs_end = ofs + raw->npoints[dset];
|
||||
for(p = ofs ; p < ofs_end; p++) {
|
||||
if(gr->logx) xx = mylog10(gv[p]);
|
||||
else xx = gv[p];
|
||||
if(p == ofs) xx0 = xx;
|
||||
wrap = (cnt > 1 && xx == xx0);
|
||||
if(p == ofs) xx0 = gv0[p];
|
||||
wrap = (cnt > 1 && gv0[p] == xx0);
|
||||
if(wrap) {
|
||||
sweepvar_wrap++;
|
||||
cnt = 0;
|
||||
|
|
@ -3324,6 +3325,7 @@ int calc_custom_data_yrange(int sweep_idx, const char *express, Graph_ctx *gr)
|
|||
for(dset = 0 ; dset < raw->datasets; dset++) {
|
||||
int cnt=0, wrap;
|
||||
register SPICE_DATA *gv = raw->values[sweep_idx];
|
||||
SPICE_DATA *gv0 = raw->values[0]; /* spice sweep variable, used to determine wrap arounds */
|
||||
ofs_end = ofs + raw->npoints[dset];
|
||||
first = -1;
|
||||
last = ofs;
|
||||
|
|
@ -3333,8 +3335,8 @@ int calc_custom_data_yrange(int sweep_idx, const char *express, Graph_ctx *gr)
|
|||
else
|
||||
xx = gv[p];
|
||||
|
||||
if(p == ofs) xx0 = xx;
|
||||
wrap = ( cnt > 1 && xx == xx0);
|
||||
if(p == ofs) xx0 = gv0[p];
|
||||
wrap = ( cnt > 1 && gv0[p] == xx0);
|
||||
if(first != -1) { /* there is something to plot ... */
|
||||
if(xx > end || xx < start || /* ... and we ran out of graph area ... */
|
||||
wrap) { /* ... or sweep variable changed direction */
|
||||
|
|
@ -3448,6 +3450,7 @@ int find_closest_wave(int i, Graph_ctx *gr)
|
|||
double prev_x = 0.0;
|
||||
int cnt=0, wrap;
|
||||
register SPICE_DATA *gvx = raw->values[sweep_idx];
|
||||
SPICE_DATA *gv0 = raw->values[0];
|
||||
register SPICE_DATA *gvy;
|
||||
ofs_end = ofs + raw->npoints[dset];
|
||||
if(expression) plot_raw_custom_data(sweep_idx, ofs, ofs_end - 1, express, NULL);
|
||||
|
|
@ -3461,10 +3464,10 @@ int find_closest_wave(int i, Graph_ctx *gr)
|
|||
for(p = ofs ; p < ofs_end; p++) {
|
||||
if(gr->logx) xx = mylog10(gvx[p]);
|
||||
else xx = gvx[p];
|
||||
if(p == ofs) xx0 = xx;
|
||||
if(p == ofs) xx0 = gv0[p];
|
||||
if(gr->logy) yy = mylog10(gvy[p]);
|
||||
else yy = gvy[p];
|
||||
wrap = (cnt > 1 && xx == xx0);
|
||||
wrap = (cnt > 1 && gv0[p] == xx0);
|
||||
if(first != -1) {
|
||||
if(xx > end || xx < start || wrap) {
|
||||
dbg(1, "find_closest_wave(): last=%d\n", last);
|
||||
|
|
@ -3718,6 +3721,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
|||
double prev_x;
|
||||
int cnt=0, wrap;
|
||||
register SPICE_DATA *gv = raw->values[sweep_idx];
|
||||
SPICE_DATA *gv0 = raw->values[0]; /* spice sweep variable, used to determine wrap arounds */
|
||||
|
||||
ofs_end = ofs + raw->npoints[dset];
|
||||
first = -1;
|
||||
|
|
@ -3730,8 +3734,8 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
|||
for(p = ofs ; p < ofs_end; p++) {
|
||||
if(gr->logx) xx = mylog10(gv[p]);
|
||||
else xx = gv[p];
|
||||
if(p == ofs) xx0 = xx;
|
||||
wrap = (cnt > 1 && xx == xx0);
|
||||
if(p == ofs) xx0 = gv0[p];
|
||||
wrap = (cnt > 1 && gv0[p] == xx0);
|
||||
if(first != -1) { /* there is something to plot ... */
|
||||
if(xx > end || xx < start || /* ... and we ran out of graph area ... */
|
||||
wrap) { /* ... or sweep variable changed direction */
|
||||
|
|
|
|||
Loading…
Reference in New Issue