00001 #ifndef CCIRCUITSOLVER_HH 00002 #define CCIRCUITSOLVER_HH 00003 00004 #include <math/Complex.hh> 00005 #include <math/CMatrix.hh> 00006 #include <electro/CElement.hh> 00007 #include <CCircuit.hh> 00008 #include <CRlcException.hh> 00009 00010 00014 class CUsedList 00015 { 00016 public : 00022 ~CUsedList(){} 00023 void use(CNode *x) {m_used.push_back(x);} 00024 bool was_used(CNode *x){ 00025 for(int i=0;i<m_used.size();i++) 00026 if(m_used[i]==x) return true; 00027 return false; 00028 } 00029 protected: 00030 std::vector<CNode *> m_used; 00031 }; 00032 00036 class CCircuitSolver 00037 { 00038 public : 00044 CCircuitSolver(CCircuit * data=NULL) {m_data=data;} 00049 ~CCircuitSolver(); 00050 00054 void solve(); 00058 void clear(); 00063 void load(CCircuit * data) {m_data=data;} 00064 00065 protected: 00066 00068 CCircuit *m_data; 00069 00071 CUsedList used; 00072 00074 CElement * get_item(std::string s); 00075 00077 std::vector<CExNode *> exnodes; 00079 std::vector<CBranch *> branches; 00080 00082 void zciagaj(); 00084 void serch_nodes(CExNode *des, CNode *start); 00086 void print_aliases(); 00088 void make_branches(); 00089 00090 //omegi wystepujaca w calym obwodzie 00092 std::vector<double> m_omegas; 00094 void found_omegas(); 00096 void print_omegas(); 00097 00098 //macierze topologiczne 00100 CMatrix<Complex> *A; 00102 CMatrix<Complex> *Yb; 00103 CMatrix<Complex> *Yn; 00105 CMatrix<Complex> *E; 00107 CMatrix<Complex> *I; 00109 CMatrix<Complex> *In; 00111 CMatrix<Complex> *Un; 00112 00113 //funkcje tworzace macierze 00115 void makeA(); 00117 void makeYb(double omega=0); 00119 void makeYn(double omega=0); 00121 void makeE(double omega=0); 00123 void makeI(double omega=0); 00125 void makeIn(); 00127 void makeUn(); 00128 00129 }; 00130 00131 #endif // CCIRCUITSOLVER_HH