Qucs-core
0.0.19
|
00001 /* 00002 * analysis.h - analysis class definitions 00003 * 00004 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Stefan Jahn <stefan@lkcc.org> 00005 * 00006 * This is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2, or (at your option) 00009 * any later version. 00010 * 00011 * This software is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this package; see the file COPYING. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 * 00021 * $Id: analysis.h 1869 2013-03-06 12:50:21Z crobarcro $ 00022 * 00023 */ 00024 00031 #ifndef __ANALYSIS_H__ 00032 #define __ANALYSIS_H__ 00033 00034 #include "object.h" 00035 #include "ptrlist.h" 00036 00037 #define SAVE_OPS 1 // save operating points 00038 #define SAVE_ALL 2 // also save subcircuit nodes and operating points 00039 #define SAVE_CVS 4 // save characteristic values 00040 00041 #define ACREATOR(val) \ 00042 val (); \ 00043 static analysis * create (void) { return new val (); } \ 00044 static struct define_t anadef; \ 00045 static struct define_t * definition (void) { return &anadef; } 00046 00047 namespace qucs { 00048 00049 class dataset; 00050 class net; 00051 class environment; 00052 class sweep; 00053 class vector; 00054 00061 enum analysis_type 00062 { 00063 ANALYSIS_UNKNOWN = -1, 00064 ANALYSIS_SWEEP, 00065 ANALYSIS_DC, 00066 ANALYSIS_AC, 00067 ANALYSIS_HBALANCE, 00068 ANALYSIS_TRANSIENT, 00069 ANALYSIS_SPARAMETER, 00070 ANALYSIS_E_TRANSIENT 00071 }; 00072 00082 class analysis : public object 00083 { 00084 public: 00085 00091 analysis (); 00092 00098 analysis (const std::string &); 00099 00106 analysis (analysis &); 00107 00113 virtual ~analysis (); 00114 00121 virtual int solve (void) 00122 { 00123 return 0; 00124 } 00125 00132 virtual int initialize (void) 00133 { 00134 return 0; 00135 } 00136 00143 virtual int cleanup (void) 00144 { 00145 return 0; 00146 } 00147 00155 virtual bool isExternal (void) 00156 { 00157 return false; 00158 } 00159 00160 dataset * getData (void) 00161 { 00162 return data; 00163 } 00164 00165 void setData (dataset * d) 00166 { 00167 data = d; 00168 } 00169 00170 net * getNet (void) 00171 { 00172 return subnet; 00173 } 00174 00175 void setNet (net * netlist) 00176 { 00177 subnet = netlist; 00178 } 00179 00180 environment * getEnv (void) 00181 { 00182 return env; 00183 } 00184 00185 void setEnv (environment * e) 00186 { 00187 env = e; 00188 } 00189 00190 ptrlist<analysis> * getAnalysis (void) 00191 { 00192 return actions; 00193 } 00194 00195 void setAnalysis (ptrlist<analysis> * a) 00196 { 00197 actions = a; 00198 } 00199 00206 void addAnalysis (analysis *); 00207 00214 void delAnalysis (analysis *); 00215 00216 int getType (void) 00217 { 00218 return type; 00219 } 00220 00221 void setType (int t) 00222 { 00223 type = t; 00224 } 00225 00236 sweep * createSweep (const std::string &); 00237 00247 void saveVariable (const std::string &, nr_complex_t, qucs::vector *); 00248 00254 bool getProgress (void) 00255 { 00256 return progress; 00257 } 00258 00265 void setProgress (bool p) 00266 { 00267 progress = p; 00268 } 00269 00270 protected: 00271 int runs; 00272 int type; 00273 net * subnet; 00274 dataset * data; 00275 environment * env; 00276 ptrlist<analysis> * actions; 00277 bool progress; 00278 }; 00279 00280 } // namespace qucs 00281 00282 #endif /* __ANALYSIS_H__ */