1 #ifndef _CURRENTSOURCE_HPP_INC_
2 #define _CURRENTSOURCE_HPP_INC_
32 size_t numCurrents)
const {
38 size_t & numNodes,
size_t & numCurrents,
size_t & numDCCurrents) {
44 std::regex_match(line, matches, currentSourceRegex);
45 currentSource.
n1 = std::stoi(matches.str(2));
46 currentSource.
n2 = std::stoi(matches.str(3));
48 numNodes = std::max(numNodes, std::stoull(matches.str(2)));
49 numNodes = std::max(numNodes, std::stoull(matches.str(3)));
51 if constexpr (std::is_same_v<T, double> || std::is_same_v<T, float>) {
52 currentSource.
value = std::stod(matches.str(4));
54 static_assert(
"Unsupported Type");
57 elements.staticElements.emplace_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.
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.
void addStaticStampTo(Stamp< T > &stamp) const
Adds this component's static stamp to the target stamp.
A matrix class with support for LU-decomposition, and left division.
A helper struct to store the preallocated stamps for MNA.