1 #ifndef _VOLTAGESOURCE_HPP_INC_
2 #define _VOLTAGESOURCE_HPP_INC_
25 stamp.
G(n1p, stamp.
sizeG_A + currentIndexp) += 1;
26 stamp.
G(stamp.
sizeG_A + currentIndexp, n1p) += 1;
29 stamp.
G(n2p, stamp.
sizeG_A + currentIndexp) += -1;
30 stamp.
G(stamp.
sizeG_A + currentIndexp, n2p) += -1;
37 size_t numCurrents)
const {
43 size_t & numNodes,
size_t & numCurrents,
size_t & numDCCurrents) {
49 std::regex_match(line, matches, voltageSourceRegex);
54 voltageSource.
n1 = std::stoi(matches.str(2));
55 voltageSource.
n2 = std::stoi(matches.str(3));
58 numNodes = std::max(numNodes, std::stoull(matches.str(2)));
59 numNodes = std::max(numNodes, std::stoull(matches.str(3)));
61 if constexpr (std::is_same_v<T, double> || std::is_same_v<T, float>) {
62 voltageSource.
value = std::stod(matches.str(4));
64 static_assert(
"Unsupported Type");
69 elements.staticElements.emplace_back(
72 {{voltageSource.
n1,
elements.staticElements.back()},
73 {voltageSource.
n2,
elements.staticElements.back()}});
std::regex generateRegex(std::string indentifier, std::string simplifiedMatching, bool startAnchor=true, bool endAnchor=true)
a helper function to aid in the construction of regexes for parsing netlist files
common weighting for all matrix elements
a glorified container for the different types of components.
A template base class to define the fundamental things a component should define.
std::string designator
The designator as in the netlist for e.g.
A matrix class with support for LU-decomposition, and left division.
A helper struct to store the preallocated stamps for MNA.
void addStaticStampTo(Stamp< T > &stamp) const
Adds this component's static stamp to the target stamp.
static void addToElements(const std::string &line, CircuitElements< T > &elements, size_t &numNodes, size_t &numCurrents, size_t &numDCCurrents)
void addDCAnalysisStampTo(Stamp< T > &stamp, const Matrix< T > &solutionVector, size_t numCurrents) const
adds this component's DC stamp to the target stamp.