rewrite, using IFerrorf()

This commit is contained in:
rlar 2014-04-03 18:06:13 +02:00
parent ea7372efe7
commit 4049e8ec1f
11 changed files with 63 additions and 275 deletions

View File

@ -30,43 +30,27 @@ BDRYcheck(BDRYcard *cardList, DOMNdomain *domnList)
DOMNdomain *domn;
int cardNum = 0;
int error = OK;
char ebuf[512]; /* error message buffer */
for ( card = cardList; card != NULL; card = card->BDRYnextCard ) {
cardNum++;
if (card->BDRYxLowGiven && card->BDRYixLowGiven) {
sprintf( ebuf,
"boundary card %d uses both location and index - location ignored",
cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, ebuf );
SPfrontEnd->IFerrorf( ERR_INFO, "boundary card %d uses both location and index - location ignored", cardNum );
card->BDRYxLowGiven = FALSE;
}
if (card->BDRYxHighGiven && card->BDRYixHighGiven) {
sprintf( ebuf,
"boundary card %d uses both location and index - location ignored",
cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, ebuf );
SPfrontEnd->IFerrorf( ERR_INFO, "boundary card %d uses both location and index - location ignored", cardNum );
card->BDRYxHighGiven = FALSE;
}
if (card->BDRYyLowGiven && card->BDRYiyLowGiven) {
sprintf( ebuf,
"boundary card %d uses both location and index - location ignored",
cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, ebuf );
SPfrontEnd->IFerrorf( ERR_INFO, "boundary card %d uses both location and index - location ignored", cardNum );
card->BDRYyLowGiven = FALSE;
}
if (card->BDRYyHighGiven && card->BDRYiyHighGiven) {
sprintf( ebuf,
"boundary card %d uses both location and index - location ignored",
cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, ebuf );
SPfrontEnd->IFerrorf( ERR_INFO, "boundary card %d uses both location and index - location ignored", cardNum );
card->BDRYyHighGiven = FALSE;
}
if (!card->BDRYdomainGiven) {
sprintf( ebuf,
"boundary card %d is missing a domain index",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "boundary card %d is missing a domain index", cardNum );
error = E_PRIVATE;
} else {
/* Make sure the domain exists */
@ -76,10 +60,7 @@ BDRYcheck(BDRYcard *cardList, DOMNdomain *domnList)
}
}
if (domn == NULL) {
sprintf( ebuf,
"boundary card %d specifies a non-existent domain",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "boundary card %d specifies a non-existent domain", cardNum );
error = E_PRIVATE;
}
}
@ -94,10 +75,7 @@ BDRYcheck(BDRYcard *cardList, DOMNdomain *domnList)
}
}
if (domn == NULL) {
sprintf( ebuf,
"interface card %d specifies a non-existent domain",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "interface card %d specifies a non-existent domain", cardNum );
error = E_PRIVATE;
}
}
@ -140,7 +118,6 @@ BDRYsetup(BDRYcard *cardList, MESHcoord *xMeshList, MESHcoord *yMeshList,DOMNdom
int ixMin, ixMax, iyMin, iyMax;
int cardNum = 0;
int error;
char ebuf[512]; /* error message buffer */
/* Check the card list */
if ((error = BDRYcheck( cardList, domnList )) != 0) return( error );
@ -172,10 +149,7 @@ BDRYsetup(BDRYcard *cardList, MESHcoord *xMeshList, MESHcoord *yMeshList,DOMNdom
card->BDRYixHigh = ixMax;
}
if (card->BDRYixLow > card->BDRYixHigh) {
sprintf( ebuf,
"boundary card %d has low x index (%d) > high x index (%d)",
cardNum, card->BDRYixHigh, card->BDRYixLow );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "boundary card %d has low x index (%d) > high x index (%d)", cardNum, card->BDRYixHigh, card->BDRYixLow );
error = E_PRIVATE;
}
if (card->BDRYiyLowGiven) {
@ -197,10 +171,7 @@ BDRYsetup(BDRYcard *cardList, MESHcoord *xMeshList, MESHcoord *yMeshList,DOMNdom
card->BDRYiyHigh = iyMax;
}
if (card->BDRYiyLow > card->BDRYiyHigh) {
sprintf( ebuf,
"boundary card %d has low y index (%d) > high y index (%d)",
cardNum, card->BDRYiyHigh, card->BDRYiyLow );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "boundary card %d has low y index (%d) > high y index (%d)", cardNum, card->BDRYiyHigh, card->BDRYiyLow );
error = E_PRIVATE;
}
}

View File

@ -30,15 +30,11 @@ CONTcheck(CONTcard *cardList)
CONTcard *card;
int cardNum = 0;
int error = OK;
char ebuf[512]; /* error message buffer */
for ( card = cardList; card != NULL; card = card->CONTnextCard ) {
cardNum++;
if (!card->CONTnumberGiven) {
sprintf( ebuf,
"contact card %d is missing an electrode index",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "contact card %d is missing an electrode index", cardNum );
error = E_PRIVATE;
}

View File

@ -35,43 +35,27 @@ DOMNcheck(DOMNcard *cardList, MaterialInfo *matlList)
MATLmaterial *matl;
int cardNum = 0;
int error = OK;
char ebuf[512]; /* error message buffer */
for ( card = cardList; card != NULL; card = card->DOMNnextCard ) {
cardNum++;
if (card->DOMNxLowGiven && card->DOMNixLowGiven) {
sprintf( ebuf,
"domain card %d uses both location and index - location ignored",
cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, ebuf );
SPfrontEnd->IFerrorf( ERR_INFO, "domain card %d uses both location and index - location ignored", cardNum );
card->DOMNxLowGiven = FALSE;
}
if (card->DOMNxHighGiven && card->DOMNixHighGiven) {
sprintf( ebuf,
"domain card %d uses both location and index - location ignored",
cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, ebuf );
SPfrontEnd->IFerrorf( ERR_INFO, "domain card %d uses both location and index - location ignored", cardNum );
card->DOMNxHighGiven = FALSE;
}
if (card->DOMNyLowGiven && card->DOMNiyLowGiven) {
sprintf( ebuf,
"domain card %d uses both location and index - location ignored",
cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, ebuf );
SPfrontEnd->IFerrorf( ERR_INFO, "domain card %d uses both location and index - location ignored", cardNum );
card->DOMNyLowGiven = FALSE;
}
if (card->DOMNyHighGiven && card->DOMNiyHighGiven) {
sprintf( ebuf,
"domain card %d uses both location and index - location ignored",
cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, ebuf );
SPfrontEnd->IFerrorf( ERR_INFO, "domain card %d uses both location and index - location ignored", cardNum );
card->DOMNyHighGiven = FALSE;
}
if (!card->DOMNmaterialGiven) {
sprintf( ebuf,
"domain card %d is missing a material index",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "domain card %d is missing a material index", cardNum );
error = E_PRIVATE;
} else {
/* Make sure the material exists */
@ -81,18 +65,12 @@ DOMNcheck(DOMNcard *cardList, MaterialInfo *matlList)
}
}
if (matl == NULL) {
sprintf( ebuf,
"domain card %d specifies a non-existent material",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "domain card %d specifies a non-existent material", cardNum );
error = E_PRIVATE;
}
}
if (!card->DOMNnumberGiven) {
sprintf( ebuf,
"domain card %d is missing an ID number",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "domain card %d is missing an ID number", cardNum );
error = E_PRIVATE;
}
@ -124,7 +102,6 @@ DOMNsetup(DOMNcard *cardList, DOMNdomain **domainList, MESHcoord *xMeshList,
int ixMin, ixMax, iyMin, iyMax;
int cardNum = 0;
int error;
char ebuf[512]; /* error message buffer */
/* Initialize list of domains */
*domainList = NULL;
@ -171,10 +148,7 @@ DOMNsetup(DOMNcard *cardList, DOMNdomain **domainList, MESHcoord *xMeshList,
newDomain->ixHi = ixMax;
}
if (newDomain->ixLo > newDomain->ixHi) {
sprintf( ebuf,
"domain card %d has low x index (%d) > high x index (%d)",
cardNum, newDomain->ixLo, newDomain->ixHi );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "domain card %d has low x index (%d) > high x index (%d)", cardNum, newDomain->ixLo, newDomain->ixHi );
error = E_PRIVATE;
}
if (card->DOMNiyLowGiven) {
@ -196,10 +170,7 @@ DOMNsetup(DOMNcard *cardList, DOMNdomain **domainList, MESHcoord *xMeshList,
newDomain->iyHi = iyMax;
}
if (newDomain->iyLo > newDomain->iyHi) {
sprintf( ebuf,
"domain card %d has low y index (%d) > high y index (%d)",
cardNum, newDomain->iyLo, newDomain->iyHi );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "domain card %d has low y index (%d) > high y index (%d)", cardNum, newDomain->iyLo, newDomain->iyHi );
error = E_PRIVATE;
}
}

View File

@ -32,7 +32,6 @@ DOPcheck(DOPcard *cardList, MESHcoord *xMeshList, MESHcoord *yMeshList)
DOPcard *card;
int cardNum = 0;
int error = OK;
char ebuf[512]; /* error message buffer */
for ( card = cardList; card != NULL; card = card->DOPnextCard ) {
cardNum++;
@ -41,81 +40,54 @@ DOPcheck(DOPcard *cardList, MESHcoord *xMeshList, MESHcoord *yMeshList)
card->DOPdomains = NULL;
}
if (!card->DOPprofileTypeGiven) {
sprintf( ebuf,
"doping card %d does not specify profile type",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "doping card %d does not specify profile type", cardNum );
error = E_PRIVATE;
} else switch (card->DOPprofileType) {
case DOP_UNIF:
if (!card->DOPconcGiven) {
sprintf( ebuf,
"doping card %d needs conc of uniform distribution",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "doping card %d needs conc of uniform distribution", cardNum );
error = E_PRIVATE;
}
break;
case DOP_LINEAR:
if (!card->DOPconcGiven) {
sprintf( ebuf,
"doping card %d needs peak conc of linear distribution",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "doping card %d needs peak conc of linear distribution", cardNum );
error = E_PRIVATE;
}
break;
case DOP_GAUSS:
if (!card->DOPconcGiven) {
sprintf( ebuf,
"doping card %d needs peak conc of gaussian distribution",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "doping card %d needs peak conc of gaussian distribution", cardNum );
error = E_PRIVATE;
}
break;
case DOP_ERFC:
if (!card->DOPconcGiven) {
sprintf( ebuf,
"doping card %d needs peak conc of error-function distribution",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "doping card %d needs peak conc of error-function distribution", cardNum );
error = E_PRIVATE;
}
break;
case DOP_EXP:
if (!card->DOPconcGiven) {
sprintf( ebuf,
"doping card %d needs peak conc of exponential distribution",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "doping card %d needs peak conc of exponential distribution", cardNum );
error = E_PRIVATE;
}
break;
case DOP_SUPREM3:
case DOP_SUPASCII:
if (!card->DOPinFileGiven) {
sprintf( ebuf,
"doping card %d needs input-file name of suprem3 data",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "doping card %d needs input-file name of suprem3 data", cardNum );
error = E_PRIVATE;
}
break;
case DOP_ASCII:
if (!card->DOPinFileGiven) {
sprintf( ebuf,
"doping card %d needs input-file name of ascii data",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "doping card %d needs input-file name of ascii data", cardNum );
error = E_PRIVATE;
}
break;
default:
sprintf( ebuf,
"doping card %d has unrecognized profile type",
cardNum );
SPfrontEnd->IFerrorf( ERR_FATAL, ebuf );
SPfrontEnd->IFerrorf( ERR_FATAL, "doping card %d has unrecognized profile type", cardNum );
error = E_NOTFOUND;
break;
}

View File

@ -32,36 +32,23 @@ ELCTcheck(ELCTcard *cardList)
ELCTcard *card;
int cardNum = 0;
int error = OK;
char ebuf[512]; /* error message buffer */
for ( card = cardList; card != NULL; card = card->ELCTnextCard ) {
cardNum++;
if (card->ELCTxLowGiven && card->ELCTixLowGiven) {
sprintf( ebuf,
"electrode card %d uses both location and index - location ignored",
cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, ebuf );
SPfrontEnd->IFerrorf( ERR_INFO, "electrode card %d uses both location and index - location ignored", cardNum );
card->ELCTxLowGiven = FALSE;
}
if (card->ELCTxHighGiven && card->ELCTixHighGiven) {
sprintf( ebuf,
"electrode card %d uses both location and index - location ignored",
cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, ebuf );
SPfrontEnd->IFerrorf( ERR_INFO, "electrode card %d uses both location and index - location ignored", cardNum );
card->ELCTxHighGiven = FALSE;
}
if (card->ELCTyLowGiven && card->ELCTiyLowGiven) {
sprintf( ebuf,
"electrode card %d uses both location and index - location ignored",
cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, ebuf );
SPfrontEnd->IFerrorf( ERR_INFO, "electrode card %d uses both location and index - location ignored", cardNum );
card->ELCTyLowGiven = FALSE;
}
if (card->ELCTyHighGiven && card->ELCTiyHighGiven) {
sprintf( ebuf,
"electrode card %d uses both location and index - location ignored",
cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, ebuf );
SPfrontEnd->IFerrorf( ERR_INFO, "electrode card %d uses both location and index - location ignored", cardNum );
card->ELCTyHighGiven = FALSE;
}
if (!card->ELCTnumberGiven) {
@ -95,7 +82,6 @@ ELCTsetup(ELCTcard *cardList, ELCTelectrode **electrodeList,
int ixMin, ixMax, iyMin, iyMax;
int cardNum = 0;
int error;
char ebuf[512]; /* error message buffer */
/* Initialize list of electrodes */
*electrodeList = NULL;
@ -141,10 +127,7 @@ ELCTsetup(ELCTcard *cardList, ELCTelectrode **electrodeList,
newElectrode->ixHi = ixMax;
}
if (newElectrode->ixLo > newElectrode->ixHi) {
sprintf( ebuf,
"electrode card %d has low x index (%d) > high x index (%d)",
cardNum, newElectrode->ixLo, newElectrode->ixHi );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "electrode card %d has low x index (%d) > high x index (%d)", cardNum, newElectrode->ixLo, newElectrode->ixHi );
error = E_PRIVATE;
}
if (card->ELCTiyLowGiven) {
@ -166,10 +149,7 @@ ELCTsetup(ELCTcard *cardList, ELCTelectrode **electrodeList,
newElectrode->iyHi = iyMax;
}
if (newElectrode->iyLo > newElectrode->iyHi) {
sprintf( ebuf,
"electrode card %d has low y index (%d) > high y index (%d)",
cardNum, newElectrode->iyLo, newElectrode->iyHi );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "electrode card %d has low y index (%d) > high y index (%d)", cardNum, newElectrode->iyLo, newElectrode->iyHi );
error = E_PRIVATE;
}
}

View File

@ -31,7 +31,6 @@ int
MATLcard *card, *card2;
int cardNum = 0, cardNum2;
int error = OK;
char ebuf[512]; /* error message buffer */
for ( card = cardList; card != NULL; card = card->MATLnextCard ) {
cardNum++;
@ -40,10 +39,7 @@ int
card->MATLmaterial = SILICON;
}
if (!card->MATLnumberGiven) {
sprintf( ebuf,
"material card %d is missing an id number",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "material card %d is missing an id number", cardNum );
error = E_PRIVATE;
}
@ -55,10 +51,7 @@ int
for ( card2 = cardList; card2 != card; card2 = card2->MATLnextCard ) {
cardNum2++;
if (card2->MATLnumber == card->MATLnumber) {
sprintf( ebuf,
"material cards %d and %d use same id %d",
cardNum2, cardNum, card->MATLnumber );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "material cards %d and %d use same id %d", cardNum2, cardNum, card->MATLnumber );
error = E_PRIVATE;
}
}

View File

@ -189,13 +189,9 @@ MESHcheck(char dim, MESHcard *cardList)
double locStart = 0.0, locEnd;
double ratio;
int error = OK;
char errBuf[512];
if ( cardList == NULL ) {
sprintf( errBuf,
"%c.mesh card list is empty",
dim );
SPfrontEnd->IFerrorf( ERR_FATAL, errBuf );
SPfrontEnd->IFerrorf( ERR_FATAL, "%c.mesh card list is empty", dim );
locEnd = locStart;
return( E_PRIVATE );
}
@ -205,28 +201,19 @@ MESHcheck(char dim, MESHcard *cardList)
/* Am I trying to find number of nodes directly & indirectly? */
if (card->MESHnumberGiven && card->MESHratioGiven) {
sprintf( errBuf,
"%c.mesh card %d uses both number and ratio - number ignored",
dim, cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, errBuf );
SPfrontEnd->IFerrorf( ERR_INFO, "%c.mesh card %d uses both number and ratio - number ignored", dim, cardNum );
card->MESHnumberGiven = FALSE;
}
/* Will I be able to locate endpoints? */
if (!card->MESHlocationGiven && !card->MESHwidthGiven) {
sprintf( errBuf,
"%c.mesh card %d has no distances",
dim, cardNum );
SPfrontEnd->IFerrorf( ERR_FATAL, errBuf );
SPfrontEnd->IFerrorf( ERR_FATAL, "%c.mesh card %d has no distances", dim, cardNum );
locEnd = locStart;
error = E_PRIVATE;
}
else if (card->MESHlocationGiven && card->MESHwidthGiven) {
sprintf( errBuf,
"%c.mesh card %d uses both location and width - location ignored",
dim, cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, errBuf );
SPfrontEnd->IFerrorf( ERR_INFO, "%c.mesh card %d uses both location and width - location ignored", dim, cardNum );
card->MESHlocationGiven = FALSE;
locEnd = locStart + card->MESHwidth;
@ -241,20 +228,14 @@ MESHcheck(char dim, MESHcard *cardList)
/* Are the endpoints in the wrong order? */
if ( locEnd - locStart < - CMP_TOL ) {
sprintf( errBuf,
"%c.mesh card %d uses negative width",
dim, cardNum );
SPfrontEnd->IFerrorf( ERR_FATAL, errBuf );
SPfrontEnd->IFerrorf( ERR_FATAL, "%c.mesh card %d uses negative width", dim, cardNum );
error = E_PRIVATE;
}
/* Are the endpoints too close together? */
else if ( (locEnd - locStart <= CMP_TOL) ) {
if ( !(cardNum == 1 && locStart == locEnd) ) {
sprintf( errBuf,
"%c.mesh card %d has negligible width - ignored",
dim, cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, errBuf );
SPfrontEnd->IFerrorf( ERR_INFO, "%c.mesh card %d has negligible width - ignored", dim, cardNum );
locStart = locEnd;
}
}
@ -267,10 +248,7 @@ MESHcheck(char dim, MESHcard *cardList)
ratio = 1.0;
}
if ((ratio < 1.0) || (ratio > 10.0)) {
sprintf( errBuf,
"%c.mesh card %d has ratio out of range - reset to 1.0",
dim, cardNum );
SPfrontEnd->IFerrorf( ERR_INFO, errBuf );
SPfrontEnd->IFerrorf( ERR_INFO, "%c.mesh card %d has ratio out of range - reset to 1.0", dim, cardNum );
ratio = 1.0;
}
@ -278,10 +256,7 @@ MESHcheck(char dim, MESHcard *cardList)
if ((card->MESHhStartGiven && (card->MESHhStart <= 0.0)) ||
(card->MESHhEndGiven && (card->MESHhEnd <= 0.0)) ||
(card->MESHhMaxGiven && (card->MESHhMax <= 0.0))) {
sprintf( errBuf,
"%c.mesh card %d wants to use a non-positive spacing",
dim, cardNum );
SPfrontEnd->IFerrorf( ERR_FATAL, errBuf );
SPfrontEnd->IFerrorf( ERR_FATAL, "%c.mesh card %d wants to use a non-positive spacing", dim, cardNum );
error = E_PRIVATE;
}
@ -289,18 +264,12 @@ MESHcheck(char dim, MESHcard *cardList)
if (card->MESHhMaxGiven && (
( card->MESHhStartGiven && card->MESHhEndGiven) ||
(!card->MESHhStartGiven && !card->MESHhEndGiven))) {
sprintf( errBuf,
"%c.mesh card %d needs to use one of h.start or h.end with h.max",
dim, cardNum );
SPfrontEnd->IFerrorf( ERR_FATAL, errBuf );
SPfrontEnd->IFerrorf( ERR_FATAL, "%c.mesh card %d needs to use one of h.start or h.end with h.max", dim, cardNum );
error = E_PRIVATE;
}
else if (card->MESHhMaxGiven && card->MESHhStartGiven) {
if (card->MESHhStart > card->MESHhMax) {
sprintf( errBuf,
"%c.mesh card %d wants h.start > h.max",
dim, cardNum );
SPfrontEnd->IFerrorf( ERR_FATAL, errBuf );
SPfrontEnd->IFerrorf( ERR_FATAL, "%c.mesh card %d wants h.start > h.max", dim, cardNum );
error = E_PRIVATE;
}
else {
@ -309,10 +278,7 @@ MESHcheck(char dim, MESHcard *cardList)
}
else if (card->MESHhMaxGiven && card->MESHhEndGiven) {
if (card->MESHhEnd > card->MESHhMax) {
sprintf( errBuf,
"%c.mesh card %d wants h.end > h.max",
dim, cardNum );
SPfrontEnd->IFerrorf( ERR_FATAL, errBuf );
SPfrontEnd->IFerrorf( ERR_FATAL, "%c.mesh card %d wants h.end > h.max", dim, cardNum );
error = E_PRIVATE;
}
else {
@ -425,7 +391,6 @@ MESHsetup(char dim, MESHcard *cardList, MESHcoord **coordList, int *numCoords)
double hStart, hEnd, hMax, hBig;
double ratStart, ratEnd;
int error = OK;
char errBuf[512];
/* Initialize list of coordinates. */
*coordList = endCoord = NULL;
@ -460,10 +425,7 @@ MESHsetup(char dim, MESHcard *cardList, MESHcoord **coordList, int *numCoords)
}
/* Are node numbers in the wrong order? */
if ( numEnd < numStart ) {
sprintf( errBuf,
"%c.mesh card %d has out-of-order node numbers ( %d > %d )",
dim, cardNum, numStart, numEnd );
SPfrontEnd->IFerrorf( ERR_FATAL, errBuf );
SPfrontEnd->IFerrorf( ERR_FATAL, "%c.mesh card %d has out-of-order node numbers ( %d > %d )", dim, cardNum, numStart, numEnd );
error = E_PRIVATE;
}
}
@ -492,10 +454,7 @@ MESHsetup(char dim, MESHcard *cardList, MESHcoord **coordList, int *numCoords)
error = MESHspacing( card, &ratStart, &ratEnd,
&nspStart, &nspMax, &nspEnd );
if (error) {
sprintf( errBuf,
"%c.mesh card %d can't be spaced automatically",
dim, cardNum );
SPfrontEnd->IFerrorf( ERR_FATAL, errBuf );
SPfrontEnd->IFerrorf( ERR_FATAL, "%c.mesh card %d can't be spaced automatically", dim, cardNum );
return( error );
}
else {
@ -504,10 +463,7 @@ MESHsetup(char dim, MESHcard *cardList, MESHcoord **coordList, int *numCoords)
}
/* Are the node numbers properly ordered? */
if ( numEnd <= numStart ) {
sprintf( errBuf,
"%c.mesh card %d results in out-of-order node numbers ( %d > %d )",
dim, cardNum, numStart, numEnd );
SPfrontEnd->IFerrorf( ERR_FATAL, errBuf );
SPfrontEnd->IFerrorf( ERR_FATAL, "%c.mesh card %d results in out-of-order node numbers ( %d > %d )", dim, cardNum, numStart, numEnd );
error = E_PRIVATE;
}
else {
@ -716,13 +672,10 @@ oneSideSpacing(double width, double spacing, double rWanted, double *rFound,
{
int nSpaces; /* Number of spaces */
double rTemp1, rTemp2; /* For temporarily calc'ed ratios */
char errBuf[80];
/* Make sure we can take at least one step. */
if ( width < spacing ) {
sprintf( errBuf,
"one-sided spacing can't find an acceptable solution\n");
SPfrontEnd->IFerrorf( ERR_WARNING, errBuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "one-sided spacing can't find an acceptable solution\n");
*rFound = 0.0;
*nFound = 0;
return(E_PRIVATE);
@ -747,9 +700,7 @@ oneSideSpacing(double width, double spacing, double rWanted, double *rFound,
oneSideRatio( width, spacing, &rTemp1, nSpaces );
oneSideRatio( width, spacing, &rTemp2, nSpaces+1 );
if ( (rTemp1 == 0.0) && (rTemp2 == 0.0) ) {
sprintf( errBuf,
"one-sided spacing can't find an acceptable solution\n");
SPfrontEnd->IFerrorf( ERR_WARNING, errBuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "one-sided spacing can't find an acceptable solution\n");
*rFound = 0.0;
*nFound = 0;
return(E_PRIVATE);
@ -918,16 +869,13 @@ twoSideSpacing(double width, double hStart, double hEnd, double rWanted,
int nSaveE = 0; /* " */
double rSaveS = 0.0; /* " */
double rSaveE = 0.0; /* " */
char errBuf[80];
/*
* It's an error if there isn't enough width to fit in both spaces.
*/
remaining = width - (hStart + hEnd);
if (remaining < 0.0) {
sprintf( errBuf,
"two-sided spacing can't find an acceptable solution\n");
SPfrontEnd->IFerrorf( ERR_WARNING, errBuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "two-sided spacing can't find an acceptable solution\n");
*rSfound = *rEfound = 0.0;
*nSfound = *nEfound = 0;
return(E_PRIVATE);
@ -1065,9 +1013,7 @@ twoSideSpacing(double width, double hStart, double hEnd, double rWanted,
/* Prepare return values. */
if (rSaveS == 0.0) {
sprintf( errBuf,
"two-sided spacing can't find an acceptable solution\n");
SPfrontEnd->IFerrorf( ERR_WARNING, errBuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "two-sided spacing can't find an acceptable solution\n");
*rSfound = *rEfound = 0.0;
*nSfound = *nEfound = 0;
return(E_PRIVATE);
@ -1185,7 +1131,6 @@ maxLimSpacing(double width, double hStart, double hMax, double rWanted,
int i; /* Searching indices */
int solnFound; /* For partial search termination */
int solnError; /* For partial search termination */
char errBuf[80];
/* Compute the ratio needed to exactly go from hStart to hMax
* in the given width. If hMax is really big, then we know
@ -1288,9 +1233,7 @@ maxLimSpacing(double width, double hStart, double hMax, double rWanted,
/* Prepare return values. */
if (rSaveS == 0.0) {
sprintf( errBuf,
"max-limited spacing can't find an acceptable solution\n");
SPfrontEnd->IFerrorf( ERR_WARNING, errBuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "max-limited spacing can't find an acceptable solution\n");
*rFound = 0.0;
*nSfound = *nMfound = 0;
return(E_PRIVATE);

View File

@ -32,15 +32,11 @@ MOBcheck(MOBcard *cardList, MaterialInfo *matlList)
MATLmaterial *matl;
int cardNum = 0;
int error = OK;
char ebuf[512]; /* error message buffer */
for ( card = cardList; card != NULL; card = card->MOBnextCard ) {
cardNum++;
if (!card->MOBmaterialGiven) {
sprintf( ebuf,
"mobility card %d is missing a material index",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "mobility card %d is missing a material index", cardNum );
error = E_PRIVATE;
} else {
/* Make sure the material exists */
@ -50,10 +46,7 @@ MOBcheck(MOBcard *cardList, MaterialInfo *matlList)
}
}
if (matl == NULL) {
sprintf( ebuf,
"mobility card %d specifies a non-existent material",
cardNum );
SPfrontEnd->IFerrorf( ERR_WARNING, ebuf );
SPfrontEnd->IFerrorf( ERR_WARNING, "mobility card %d specifies a non-existent material", cardNum );
error = E_PRIVATE;
}
}

View File

@ -29,7 +29,6 @@ NIiter(CKTcircuit *ckt, int maxIter)
int ipass;
int error;
int i,j; /* temporaries for finding error location */
char *message; /* temporary message buffer */
double *temp;
double startTime;
static char *msg = "Too many iterations without convergence";
@ -121,12 +120,7 @@ NIiter(CKTcircuit *ckt, int maxIter)
* wrong - so we ask for the troublesome entry
*/
SMPgetError(ckt->CKTmatrix,&i,&j);
message = TMALLOC(char, 1000); /* should be enough */
(void)sprintf(message,
"singular matrix: check nodes %s and %s\n",
NODENAME(ckt,i),NODENAME(ckt,j));
SPfrontEnd->IFerrorf (ERR_WARNING, message);
FREE(message);
SPfrontEnd->IFerrorf (ERR_WARNING, "singular matrix: check nodes %s and %s\n", NODENAME(ckt,i), NODENAME(ckt,j));
ckt->CKTstat->STATnumIter += iterno;
#ifdef STEPDEBUG
printf("reorder returned error \n");

View File

@ -120,7 +120,6 @@ CKTpzFindZeros(CKTcircuit *ckt, PZtrial **rootinfo, int *rootcount)
PZtrial *neighborhood[3];
int strat;
int error;
char ebuf[513];
NIpzK = 0.0;
NIpzK_mag = 0;
@ -184,10 +183,7 @@ CKTpzFindZeros(CKTcircuit *ckt, PZtrial **rootinfo, int *rootcount)
}
if (SPfrontEnd->IFpauseTest()) {
sprintf(ebuf,
"Pole-Zero analysis interrupted; %d trials, %d roots\n",
Seq_Num, NZeros);
SPfrontEnd->IFerrorf (ERR_WARNING, ebuf);
SPfrontEnd->IFerrorf (ERR_WARNING, "Pole-Zero analysis interrupted; %d trials, %d roots\n", Seq_Num, NZeros);
error = E_PAUSE;
break;
}
@ -218,17 +214,11 @@ CKTpzFindZeros(CKTcircuit *ckt, PZtrial **rootinfo, int *rootcount)
*rootcount = NZeros;
if (Aberr_Num > 2) {
sprintf(ebuf,
"Pole-zero converging to numerical aberrations; giving up after %d trials",
Seq_Num);
SPfrontEnd->IFerrorf (ERR_WARNING, ebuf);
SPfrontEnd->IFerrorf (ERR_WARNING, "Pole-zero converging to numerical aberrations; giving up after %d trials", Seq_Num);
}
if (NIter >= NITER_LIM) {
sprintf(ebuf,
"Pole-zero iteration limit reached; giving up after %d trials",
Seq_Num);
SPfrontEnd->IFerrorf (ERR_WARNING, ebuf);
SPfrontEnd->IFerrorf (ERR_WARNING, "Pole-zero iteration limit reached; giving up after %d trials", Seq_Num);
}
return error;

View File

@ -28,9 +28,6 @@ DIOtemp(GENmodel *inModel, CKTcircuit *ckt)
double vtnom;
DIOinstance *here;
int iter;
#ifdef TRACE
char *emsg;
#endif
double dt;
double factor;
double tBreakdownVoltage;
@ -203,13 +200,7 @@ DIOtemp(GENmodel *inModel, CKTcircuit *ckt)
if (cbv < here->DIOtSatCur * tBreakdownVoltage/vt) {
cbv=here->DIOtSatCur * tBreakdownVoltage/vt;
#ifdef TRACE
emsg = TMALLOC(char, 100);
if(emsg == NULL) return(E_NOMEM);
(void)sprintf(emsg,
"%%s: breakdown current increased to %g to resolve",
cbv);
SPfrontEnd->IFerrorf (ERR_WARNING, emsg, here->DIOname);
FREE(emsg);
SPfrontEnd->IFerrorf (ERR_WARNING, "%s: breakdown current increased to %g to resolve", here->DIOname, cbv);
SPfrontEnd->IFerrorf (ERR_WARNING,
"incompatibility with specified saturation current");
#endif
@ -227,13 +218,7 @@ DIOtemp(GENmodel *inModel, CKTcircuit *ckt)
if (fabs(xcbv-cbv) <= tol) goto matched;
}
#ifdef TRACE
emsg = TMALLOC(char, 100);
if(emsg == NULL) return(E_NOMEM);
(void)sprintf(emsg,
"%%s: unable to match forward and reverse diode regions: bv = %g, ibv = %g",
xbv,xcbv);
SPfrontEnd->IFerrorf (ERR_WARNING, emsg, here->DIOname);
FREE(emsg);
SPfrontEnd->IFerrorf (ERR_WARNING, "%s: unable to match forward and reverse diode regions: bv = %g, ibv = %g", here->DIOname, xbv, xcbv);
#endif
}
matched: