From e07486df2a4cc874d91cc3ddbd792bb006c46b0b Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sat, 10 Jul 2010 13:22:44 +0000 Subject: [PATCH] patch B. Swartz 2010-07-04 --- ChangeLog | 3 ++ src/frontend/com_measure2.c | 65 ++++++++++++++++++++++++++++++++----- 2 files changed, 60 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index e1cfc77ee..7e3649012 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2010-07-10 Holger Vogt + * com_measure2.c: patch by Bill Swartz from 2010-07-04 + 2010-07-10 Robert Larice * src/xspice/icm/spice2poly/icm_spice2poly/cfunc.mod , * src/xspice/icm/xtradev/capacitor/cfunc.mod , diff --git a/src/frontend/com_measure2.c b/src/frontend/com_measure2.c index 2d9999a0d..f493be266 100644 --- a/src/frontend/com_measure2.c +++ b/src/frontend/com_measure2.c @@ -369,6 +369,8 @@ static void com_measure_when( int section = -1; int measurement_pending; int init_measured_value; + bool ac_check ; + bool sp_check ; double value, prevValue; double timeValue, prevTimeValue; @@ -396,16 +398,31 @@ static void com_measure_when( measurement_pending=0; init_measured_value=1; + + /* ----------------------------------------------------------------- + * Take the string tests outside of the loop for speed. + * ----------------------------------------------------------------- */ + if (cieq (meas->m_analysis,"ac")) { + ac_check = TRUE ; + } else { + ac_check = FALSE ; + } + if (cieq (meas->m_analysis,"sp")) { + sp_check = TRUE ; + } else { + sp_check = FALSE ; + } + for (i=0; i < d->v_length; i++) { // value = d->v_realdata[i]; // timeValue = dTime->v_realdata[i]; - if (cieq (meas->m_analysis,"ac")) { + if (ac_check) { value = get_value(meas, d, i); //d->v_compdata[i].cx_real; timeValue = dTime->v_compdata[i].cx_real; } - else if (cieq (meas->m_analysis,"sp")) { + else if (sp_check) { if (d->v_compdata) value = get_value(meas, d, i); //d->v_compdata[i].cx_real; else @@ -505,6 +522,8 @@ static void measure_at( int i; double value, pvalue, svalue, psvalue; + bool ac_check ; + bool sp_check ; struct dvec *d, *dScale; psvalue = pvalue = 0; @@ -520,13 +539,27 @@ static void measure_at( fprintf(cp_err, "Error: no such vector time, frequency or dc.\n"); return; } - + + /* ----------------------------------------------------------------- + * Take the string tests outside of the loop for speed. + * ----------------------------------------------------------------- */ + if (cieq (meas->m_analysis,"ac")) { + ac_check = TRUE ; + } else { + ac_check = FALSE ; + } + if (cieq (meas->m_analysis,"sp")) { + sp_check = TRUE ; + } else { + sp_check = FALSE ; + } + for (i=0; i < d->v_length; i++) { - if (cieq (meas->m_analysis,"ac")) { + if (ac_check) { value = get_value(meas, d, i); //d->v_compdata[i].cx_real; svalue = dScale->v_compdata[i].cx_real; } - else if (cieq (meas->m_analysis,"sp")) { + else if (sp_check) { if (d->v_compdata) value = get_value(meas, d, i); //d->v_compdata[i].cx_real; else @@ -568,6 +601,8 @@ static void measure_minMaxAvg( struct dvec *d, *dScale; double value, svalue, mValue, mValueAt; int first; + bool ac_check ; + bool sp_check ; mValue =0; mValueAt = svalue =0; @@ -596,13 +631,27 @@ static void measure_minMaxAvg( fprintf(cp_err, "Error: no such vector as time, frquency or dc.\n"); return; } - + + /* ----------------------------------------------------------------- + * Take the string tests outside of the loop for speed. + * ----------------------------------------------------------------- */ + if (cieq (meas->m_analysis,"ac")) { + ac_check = TRUE ; + } else { + ac_check = FALSE ; + } + if (cieq (meas->m_analysis,"sp")) { + sp_check = TRUE ; + } else { + sp_check = FALSE ; + } + for (i=0; i < d->v_length; i++) { - if (cieq (meas->m_analysis,"ac")) { + if (ac_check) { value = get_value(meas, d, i); //d->v_compdata[i].cx_real; svalue = dScale->v_compdata[i].cx_real; } - else if (cieq (meas->m_analysis,"sp")) { + else if (sp_check) { if (d->v_compdata) value = get_value(meas, d, i); //d->v_compdata[i].cx_real; else