If stricterrorhandling is set, ngspice detects the dangling

capacitors and resioiostors, lists them and then bails out.
This commit is contained in:
Holger Vogt 2026-07-06 10:39:49 +02:00
parent a86356980a
commit ee9578055f
1 changed files with 25 additions and 5 deletions

View File

@ -134,7 +134,13 @@ CKTtopologyReduce(CKTcircuit *ckt)
else if (nn > 0)
degree[nn]--;
removed_this_pass++;
if (reported++ < 40)
if (ft_stricterror) {
fprintf(stderr,
"Dangling capacitor %s "
"(floating node %s) found in netlist.\n", ci->CAPname,
(char*)CKTnodName(ckt, (mode & 2) ? nn : pn));
}
else if (reported++ < 40)
fprintf(stdout,
"Topology reduction: removed dangling capacitor %s "
"(floating node %s)\n", ci->CAPname,
@ -165,11 +171,17 @@ CKTtopologyReduce(CKTcircuit *ckt)
else if (nn > 0)
degree[nn]--;
removed_this_pass++;
if (reported++ < 40)
if (ft_stricterror) {
fprintf(stderr,
"Dangling resistor %s "
"(floating node %s) found in netlist.\n", ri->RESname,
(char*)CKTnodName(ckt, (mode & 2) ? nn : pn));
}
else if (reported++ < 40)
fprintf(stdout,
"Topology reduction: removed dangling resistor %s "
"(floating node %s)\n", ri->RESname,
(char *)CKTnodName(ckt, (mode & 2) ? nn : pn));
(char*)CKTnodName(ckt, (mode & 2) ? nn : pn));
}
}
@ -178,9 +190,17 @@ CKTtopologyReduce(CKTcircuit *ckt)
break;
}
if (removed_total)
if (removed_total) {
if (ft_stricterror) {
fprintf(stderr, "\nError: %d dangling passive(s) found.\n "
" Please correct the netlist.\n", removed_total);
FREE(degree);
controlled_exit(EXIT_BAD);
}
fprintf(stdout, "Topology reduction: %d dangling passive(s) removed "
"from the matrix.\n", removed_total);
"from the matrix.\n", removed_total);
}
FREE(degree);
}