From 85b07e35bfed6bedbdb308b0de12bcc8c59429d5 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 16 Jul 2021 10:26:11 +0200 Subject: [PATCH] Fixes bug 483 prevent crash when surface mobility (surfmob) has been selected in 2D simulation. The patch is provided by Brian Taylor (see https://sourceforge.net/p/ngspice/mailman/ngspice-devel/thread/e6e921a3-677c-f513-7410-df8568c4bdad%40comcast.net/#msg37318450 ) --- src/ciderlib/twod/twocont.c | 2 +- src/ciderlib/twod/twoncont.c | 2 +- src/ciderlib/twod/twopcont.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ciderlib/twod/twocont.c b/src/ciderlib/twod/twocont.c index 5b2e93a77..590dffe27 100644 --- a/src/ciderlib/twod/twocont.c +++ b/src/ciderlib/twod/twocont.c @@ -253,7 +253,7 @@ void pNode->fPPsiOx = spGetElement( matrix, pEqn, psiEqnOxP ); } } else { /* Horizontal Slice */ - if ( nIndex <= 1 ) { /* Top Side */ + if ( nIndex == 0 || nIndex == 3 ) { /* Left (Top?) Side : bug 483 */ pNode->fNPsiIn = spGetElement( matrix, nEqn, psiEqnInM ); pNode->fNPsiInP1 = spGetElement( matrix, nEqn, psiEqnInP ); pNode->fNPsiOx = spGetElement( matrix, nEqn, psiEqnOxM ); diff --git a/src/ciderlib/twod/twoncont.c b/src/ciderlib/twod/twoncont.c index 6eb832c56..d491e99cc 100644 --- a/src/ciderlib/twod/twoncont.c +++ b/src/ciderlib/twod/twoncont.c @@ -211,7 +211,7 @@ void pNode->fNPsiOx = spGetElement( matrix, nEqn, psiEqnOxP ); } } else { /* Horizontal Slice */ - if ( nIndex <= 1 ) { /* Top Side */ + if ( nIndex == 0 || nIndex == 3 ) { /* Left (Top?) Side : bug 483 */ pNode->fNPsiIn = spGetElement( matrix, nEqn, psiEqnInM ); pNode->fNPsiInP1 = spGetElement( matrix, nEqn, psiEqnInP ); pNode->fNPsiOx = spGetElement( matrix, nEqn, psiEqnOxM ); diff --git a/src/ciderlib/twod/twopcont.c b/src/ciderlib/twod/twopcont.c index 67e3bc22f..6b2b81feb 100644 --- a/src/ciderlib/twod/twopcont.c +++ b/src/ciderlib/twod/twopcont.c @@ -210,7 +210,7 @@ void pNode->fPPsiOx = spGetElement( matrix, pEqn, psiEqnOxP ); } } else { /* Horizontal Slice */ - if ( nIndex <= 1 ) { /* Top Side */ + if ( nIndex == 0 || nIndex == 3 ) { /* Left (Top?) Side : bug 483 */ pNode->fPPsiIn = spGetElement( matrix, pEqn, psiEqnInM ); pNode->fPPsiInP1 = spGetElement( matrix, pEqn, psiEqnInP ); pNode->fPPsiOx = spGetElement( matrix, pEqn, psiEqnOxM );