BELFEM
0.9.3
Berkeley Lab Finite Element Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
cl_NgspiceCircuitFactory.hpp
Go to the documentation of this file.
1
/*
2
* BELFEM -- The Berkeley Lab Finite Element Framework
3
* Copyright (c) 2026, The Regents of the University of California,
4
* through Lawrence Berkeley National Laboratory (subject to receipt of any required
5
* approvals from the U.S. Dept. of Energy). All rights reserved.
6
*
7
* Developers: Christian Messe, Gregory Giard
8
*
9
* See the top-level LICENSE file for the complete license and disclaimer.
10
*/
11
12
#ifndef BELFEM_CL_NGSPICECIRCUITFACTORY_HPP
13
#define BELFEM_CL_NGSPICECIRCUITFACTORY_HPP
14
15
#include <memory>
16
17
#include "
typedefs.hpp
"
18
#include "
cl_Cell.hpp
"
19
#include "
cl_Map.hpp
"
20
#include "
cl_NetlistParser.hpp
"
21
22
namespace
belfem
23
{
24
class
SourceFunction
;
25
26
namespace
electronics
27
{
28
//-----------------------------------------------------------------------------
29
30
class
ElectricalCircuit
;
31
32
//-----------------------------------------------------------------------------
33
74
class
NgspiceCircuitFactory
75
{
76
const
string
mSource;
// for error messages
77
82
std::unique_ptr< ElectricalCircuit > mCircuit;
83
85
Map< string, index_t >
mNodeMap;
86
uint
mNumberOfNodes = 0;
87
88
//-----------------------------------------------------------------------------
89
public
:
90
//-----------------------------------------------------------------------------
91
95
NgspiceCircuitFactory
(
const
NetlistParser
& aNetlist );
96
100
NgspiceCircuitFactory
(
const
string
& aPath );
101
102
~NgspiceCircuitFactory
();
103
104
//-----------------------------------------------------------------------------
105
110
ElectricalCircuit
*
111
circuit
();
112
119
index_t
120
node_index
(
const
string
& aName )
const
;
121
122
uint
123
number_of_nodes
()
const
124
{
125
return
mNumberOfNodes;
126
}
127
128
//-----------------------------------------------------------------------------
129
private
:
130
//-----------------------------------------------------------------------------
131
132
void
133
build(
const
NetlistParser
& aNetlist );
134
135
void
136
build_node_map(
const
NetlistParser
& aNetlist );
137
139
void
140
collect_orders(
const
NetlistParser
& aNetlist,
141
Map< string, uint >
& aOrders )
const
;
142
143
void
144
create_element(
const
NetlistElement
& aElement,
145
const
NetlistParser
& aNetlist,
146
const
Map< string, uint >
& aOrders );
147
148
void
149
create_from_directive(
const
NetlistDirective
& aDirective );
150
152
real
153
rcl_value(
const
NetlistElement
& aElement,
154
const
char
* aKeyword )
const
;
155
158
SourceFunction
*
159
source_function(
const
NetlistElement
& aElement )
const
;
160
161
index_t
162
node_index_checked(
const
string
& aName,
163
const
string
& aCard,
164
const
index_t
aLine )
const
;
165
167
static
bool
168
is_ground(
const
string
& aName );
169
170
//-----------------------------------------------------------------------------
171
};
172
173
//-----------------------------------------------------------------------------
174
}
175
}
176
177
#endif
//BELFEM_CL_NGSPICECIRCUITFACTORY_HPP
cl_Cell.hpp
cl_Map.hpp
cl_NetlistParser.hpp
belfem::Map< string, index_t >
belfem::SourceFunction
Definition
cl_SourceFunction.hpp:80
belfem::electronics::ElectricalCircuit
The circuit itself: MNA assembly, Jacobian, solve and timestep.
Definition
cl_ElectricalCircuit.hpp:39
belfem::electronics::NetlistParser
Lexes an ngspice netlist into the intermediate representation the NgspiceCircuitFactory consumes.
Definition
cl_NetlistParser.hpp:144
belfem::electronics::NgspiceCircuitFactory::~NgspiceCircuitFactory
~NgspiceCircuitFactory()
belfem::electronics::NgspiceCircuitFactory::number_of_nodes
uint number_of_nodes() const
Definition
cl_NgspiceCircuitFactory.hpp:123
belfem::electronics::NgspiceCircuitFactory::circuit
ElectricalCircuit * circuit()
hand the circuit over to the caller, who owns it from here; hard-errors on a second call
Definition
cl_NgspiceCircuitFactory.cpp:56
belfem::electronics::NgspiceCircuitFactory::node_index
index_t node_index(const string &aName) const
resolve a netlist node name ( case-folded; ground aliases "0"/"gnd" allowed ) to its BELFEM index – t...
Definition
cl_NgspiceCircuitFactory.cpp:200
belfem::electronics::NgspiceCircuitFactory::NgspiceCircuitFactory
NgspiceCircuitFactory(const NetlistParser &aNetlist)
build from a lexed netlist
Definition
cl_NgspiceCircuitFactory.cpp:32
belfem::electronics
Definition
cl_Capacitor.cpp:18
belfem
USER GUIDES:
Definition
cl_Capacitor.cpp:16
belfem::uint
unsigned int uint
Definition
typedefs.hpp:30
belfem::index_t
uint32_t index_t
Definition
typedefs.hpp:52
belfem::real
double real
Definition
typedefs.hpp:36
belfem::electronics::NetlistDirective
one "* belfem:" extension directive ( plan §5, Option A ): superconductor, timed switch,...
Definition
cl_NetlistParser.hpp:92
belfem::electronics::NetlistElement
one element card ( R/C/L/V/I/D ), lexed but not interpreted: all payloads stay strings; numeric conve...
Definition
cl_NetlistParser.hpp:31
typedefs.hpp
src
circuit
cl_NgspiceCircuitFactory.hpp
Generated by
1.18.0