Skip to content

Instantly share code, notes, and snippets.

@Nick0412
Created December 3, 2019 07:04
Show Gist options
  • Save Nick0412/0b9a0ba8848cb5225d5bd663dad8fd77 to your computer and use it in GitHub Desktop.
Save Nick0412/0b9a0ba8848cb5225d5bd663dad8fd77 to your computer and use it in GitHub Desktop.
Architecture of Circuit Solver
// Node.h
class Component;
class Node
{
private:
std::unordered_set<Component*> m_components;
};
// Component.h
class Node;
/* Classes like resistor, inductor, capacitor, ect.
* inherit from this (at the moment no virtual functions)
*/
class Component
{
private:
std::unordered_set<Node*> m_nodes;
};
// Circuit.h
class Component;
class Node;
class Circuit
{
public:
std::unordered_set<Node*> m_nodes;
std::unordered_set<Component*> m_components;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment