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%.
This commit is contained in:
Holger Vogt 2018-01-10 22:17:32 +01:00
parent 7849741b70
commit 109607a044
1 changed files with 21 additions and 4 deletions

View File

@ -56,15 +56,24 @@
* Matrix type and macro definitions for the sparse matrix routines.
*/
#include <assert.h>
#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 );