Builds an ElectricalCircuit from a lexed netlist ( todo/ngspice_parser_plan.md §9.2, decisions O5/O6/O8/O9 ). More...
#include <cl_NgspiceCircuitFactory.hpp>
Public Member Functions | |
| NgspiceCircuitFactory (const NetlistParser &aNetlist) | |
| build from a lexed netlist | |
| NgspiceCircuitFactory (const string &aPath) | |
| convenience: lex the file, then build | |
| ~NgspiceCircuitFactory () | |
| ElectricalCircuit * | circuit () |
| hand the circuit over to the caller, who owns it from here; hard-errors on a second call | |
| index_t | node_index (const string &aName) const |
| resolve a netlist node name ( case-folded; ground aliases "0"/"gnd" allowed ) to its BELFEM index – the O5 lookup for the deck-side terminal-pair and output readers. | |
| uint | number_of_nodes () const |
Builds an ElectricalCircuit from a lexed netlist ( todo/ngspice_parser_plan.md §9.2, decisions O5/O6/O8/O9 ).
Node map ( O9, frozen for restart ): the ground aliases "0" and "gnd" are one node and land on the LAST BELFEM index; every other node packs into 0 .. N-2 in order of first appearance in the netlist ( element cards and directive n+/n- keys alike ). A deck that never references ground is invalid ( manual, "Ground node" ). The map is logged at construction and exposed via node_index() so the deck-side terminal-pair reader resolves node NAMES through the same map ( O5 ) – never raw integers.
Components are created in netlist line order ( elements and directives merged by line ), which freezes the unknown-current layout for restart ( O9 ). Labels are the case-folded instance names ( O5 ).
v1 element support, refusals are hard errors naming the card:
Ownership: the factory produces and hands over – circuit() transfers the ElectricalCircuit to the caller ( it can be called once ); an unclaimed circuit dies with the factory.
| belfem::electronics::NgspiceCircuitFactory::NgspiceCircuitFactory | ( | const NetlistParser & | aNetlist | ) |
build from a lexed netlist
| belfem::electronics::NgspiceCircuitFactory::NgspiceCircuitFactory | ( | const string & | aPath | ) |
convenience: lex the file, then build
|
default |
| ElectricalCircuit * belfem::electronics::NgspiceCircuitFactory::circuit | ( | ) |
hand the circuit over to the caller, who owns it from here; hard-errors on a second call
resolve a netlist node name ( case-folded; ground aliases "0"/"gnd" allowed ) to its BELFEM index – the O5 lookup for the deck-side terminal-pair and output readers.
Hard-errors on a name the netlist does not contain.
|
inline |