From 109607a0443e9c937ba0dbd6422806b0afae24d8 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Wed, 10 Jan 2018 22:17:32 +0100 Subject: [PATCH] Lengthy op calculations make the Win GUI unresposive. A macro adds a short travel to the GUI fro0m within the matrix ordering and factoring. Time overhead during op is less than 0.5%. --- src/maths/sparse/spfactor.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/maths/sparse/spfactor.c b/src/maths/sparse/spfactor.c index dcfad94ac..337ad2ace 100644 --- a/src/maths/sparse/spfactor.c +++ b/src/maths/sparse/spfactor.c @@ -56,15 +56,24 @@ * Matrix type and macro definitions for the sparse matrix routines. */ #include - #define spINSIDE_SPARSE #include "spconfig.h" #include "ngspice/spmatrix.h" #include "spdefs.h" - - - +#ifdef HAS_WINGUI +extern void SetAnalyse(char *Analyse, int Percent); +/* to increase responsiveness of Windows GUI */ +#define INCRESP \ +do { \ + static int ii = 100; \ + ii--;\ + if (ii == 0) { \ + SetAnalyse("or", 0); \ + ii = 100; \ + } \ +} while(0) +#endif /* * Function declarations @@ -214,6 +223,10 @@ spOrderAndFactor(MatrixPtr Matrix, RealNumber RHS[], RealNumber RelThreshold, if (!Matrix->NeedsOrdering) { /* Matrix has been factored before and reordering is not required. */ for (Step = 1; Step <= Size; Step++) { +#ifdef HAS_WINGUI + /* macro to improve responsiveness of Windows GUI */ + INCRESP; +#endif pPivot = Matrix->Diag[Step]; LargestInCol = FindLargestInCol(pPivot->NextInCol); if ((LargestInCol * RelThreshold < ELEMENT_MAG(pPivot))) { @@ -258,6 +271,10 @@ spOrderAndFactor(MatrixPtr Matrix, RealNumber RHS[], RealNumber RelThreshold, /* Perform reordering and factorization. */ for (; Step <= Size; Step++) { +#ifdef HAS_WINGUI + /* macro to improve responsiveness of Windows GUI */ + INCRESP; +#endif pPivot = SearchForPivot( Matrix, Step, DiagPivoting ); if (pPivot == NULL) return MatrixIsSingular( Matrix, Step ); ExchangeRowsAndCols( Matrix, pPivot, Step );