/[ascend]/trunk/pygtk/interface/simulation.cpp
ViewVC logotype

Diff of /trunk/pygtk/interface/simulation.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 163 by johnpye, Thu Dec 22 15:18:02 2005 UTC revision 164 by johnpye, Tue Jan 3 09:54:43 2006 UTC
# Line 62  Simulation::Simulation(Instance *i, cons Line 62  Simulation::Simulation(Instance *i, cons
62      //simroot = Instanc(GetSimulationRoot(i),name);      //simroot = Instanc(GetSimulationRoot(i),name);
63  }  }
64    
65    Simulation::Simulation(const Simulation &old) : Instanc(old), simroot(old.simroot){
66        is_built = old.is_built;
67        sys = old.sys;
68        bin_srcname = old.bin_srcname;
69        bin_objname = old.bin_objname;
70        bin_libname = old.bin_libname;
71        bin_cmd = old.bin_cmd;
72        bin_rm = old.bin_rm;    
73    }
74    
75    Simulation::~Simulation(){
76        //CONSOLE_DEBUG("Deleting simulation %s", getName().toString());
77    }
78    
79  Instanc &  Instanc &
80  Simulation::getModel(){  Simulation::getModel(){
81      if(!simroot.getInternalType()){      if(!simroot.getInternalType()){
# Line 74  void Line 88  void
88  Simulation::checkDoF() const{  Simulation::checkDoF() const{
89          cerr << "CHECKING DOF..." << endl;          cerr << "CHECKING DOF..." << endl;
90          int dof, status;          int dof, status;
91          if(sys==NULL){          if(!sys){
92                  throw runtime_error("System not yet built");                  throw runtime_error("System not yet built");
93          }          }
94          slvDOF_status(sys, &status, &dof);          slvDOF_status(sys, &status, &dof);
# Line 97  Simulation::run(const Method &method){ Line 111  Simulation::run(const Method &method){
111      //cerr << "CREATED NAME '" << name.getName() << "'" << endl;      //cerr << "CREATED NAME '" << name.getName() << "'" << endl;
112      Proc_enum pe;      Proc_enum pe;
113      pe = Initialize(      pe = Initialize(
114          getModel().getInternalType() ,name.getInternalType(), "__not_named__"          &*(getModel().getInternalType()) ,name.getInternalType(), "__not_named__"
115          ,ASCERR          ,ASCERR
116          ,0, NULL, NULL          ,0, NULL, NULL
117      );      );
# Line 183  const bool Line 197  const bool
197  Simulation::check(){  Simulation::check(){
198      cerr << "CHECKING SIMULATION" << endl;      cerr << "CHECKING SIMULATION" << endl;
199      Instance *i1 = getModel().getInternalType();      Instance *i1 = getModel().getInternalType();
200      CheckInstance(stderr, i1);      CheckInstance(stderr, &*i1);
201      cerr << "...DONE CHECKING" << endl;      cerr << "...DONE CHECKING" << endl;
202  }        }      
203    
204  void  void
205  Simulation::build(){  Simulation::build(){
206      cerr << "BUILDING SIMULATION..." << endl;      cerr << "BUILDING SIMULATION..." << endl;
207      sys = system_build(getModel().getInternalType());      Instance *i1 = getModel().getInternalType();
208      if(sys == NULL){      sys = system_build(&*i1);
209        if(!sys){
210          throw runtime_error("Unable to build system");          throw runtime_error("Unable to build system");
211      }      }
212      is_built = true;      is_built = true;
# Line 204  Simulation::getFixableVariables(){ Line 219  Simulation::getFixableVariables(){
219      vector<Variable> vars;      vector<Variable> vars;
220      vars.reserve(100);      vars.reserve(100);
221    
222      if(sys==NULL){      if(!sys){
223          throw runtime_error("Simulation system not yet built");          throw runtime_error("Simulation system not yet built");
224      }      }
225    
# Line 260  Simulation::solve(Solver solver){ Line 275  Simulation::solve(Solver solver){
275      enum inst_t k = getModel().getKind();      enum inst_t k = getModel().getKind();
276      if(k!=MODEL_INST)throw runtime_error("Can't solve: not an instance of type MODEL_INST");      if(k!=MODEL_INST)throw runtime_error("Can't solve: not an instance of type MODEL_INST");
277            
278      int npend = NumberPendingInstances(getInternalType());      Instance *i1 = getInternalType();
279        int npend = NumberPendingInstances(&*i1);
280      if(npend)throw runtime_error("Can't solve: There are still %d pending instances");        if(npend)throw runtime_error("Can't solve: There are still %d pending instances");  
281    
282      if(!sys)throw runtime_error("Can't solve: Simulation system has not been built yet.");      if(!sys)throw runtime_error("Can't solve: Simulation system has not been built yet.");

Legend:
Removed from v.163  
changed lines
  Added in v.164

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22