Qucs-core  0.0.19
qucs_interface.h
Go to the documentation of this file.
00001 /*
00002  * qucs_interface.h - m-code interface 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 
00035 #ifndef __QUCS_INTERFACE_H__
00036 #define __QUCS_INTERFACE_H__
00037 
00038 
00039 namespace qucs
00040 {
00041 
00042 
00043 enum QUCS_ERROR_CODES { NETLIST_OK,
00044                         NETLIST_FILE_NOT_FOUND,
00045                         NETLIST_FAILED_CHECK };
00046 
00047 // forward declarations of some classes to avoid including
00048 // header files and speed compilation
00049 class net;
00050 class input;
00051 class circuit;
00052 class dataset;
00053 class environment;
00054 class e_trsolver;
00055 
00064 class qucsint
00065 {
00066 
00067 public:
00068     qucsint ();
00069     qucsint (char* infile);
00070     ~qucsint ();
00071 
00072     int prepare_netlist (char* infile);
00073     int evaluate ();
00074     int output (char* outfile);
00075 
00076 protected:
00077 
00078     qucs::net * subnet;
00079     qucs::input * in;
00080     qucs::circuit * gnd;
00081     qucs::dataset * out;
00082     qucs::environment * root;
00083     int err;
00084     int ret;
00085 
00086 };
00087 
00088 
00089 /*/////////////////////////////////////////////////////////////////////////////
00090 
00091                             trsolver_interface
00092 
00094 
00095 
00096 enum ETR_MODE { ETR_MODE_ASYNC, ETR_MODE_SYNC };
00097 
00107 class trsolver_interface : public qucsint
00108 {
00109 public:
00110     trsolver_interface ();
00111     trsolver_interface (char* infile);
00112 //    ~trsolver_interface ();
00113 
00114     void getETR(void);
00115     int init (double, double, int);
00116     bool getIsInitialised() { return isInitialised; };
00117     int stepsolve_sync (double synctime);
00118     void acceptstep_sync (void);
00119     int stepsolve_async (double steptime);
00120     void acceptstep_async (void);
00121     void rejectstep_async (void);
00122     void getsolution (double *);
00123 
00125     int getN ();
00126 
00128     int getM ();
00129 
00152     int setECVSVoltage(char * ecvsname, double V);
00153 
00155     int getJacRows ();
00156 
00158     int getJacCols ();
00159 
00166     int getJacData (int r, int c, double& data);
00167 
00178     int getNodeV (char * label, double& nodeV);
00179 
00190     int getVProbeV (char * probename, double& probeV);
00191 
00202     int getIProbeI (char * probename, double& probeI);
00203 
00220     void setMessageFcn (void (*newmessagefcn)(int level, const char * format, ...));
00221 
00222     // debugging functions
00223 //    void debug (void);
00230     void printSolution (void);
00231 
00232 private:
00233 
00234     bool isInitialised;
00236     qucs::e_trsolver * etr;
00237 
00238 };
00239 
00240 } // namespace qucs
00241 
00242 #endif /* __QUCS_INTERFACE_H__ */