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

Diff of /trunk/pygtk/simulation.cpp

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

revision 917 by johnpye, Sat Oct 28 07:06:22 2006 UTC revision 918 by johnpye, Sat Nov 4 03:58:06 2006 UTC
# Line 290  Simulation::checkInstance(){ Line 290  Simulation::checkInstance(){
290  */  */
291  enum StructuralStatus  enum StructuralStatus
292  Simulation::checkDoF() const{  Simulation::checkDoF() const{
     cerr << "CHECKING DOF..." << endl;  
293      int dof, status;      int dof, status;
294      if(!sys){  
295              throw runtime_error("System not yet built");      if(!is_built){
296            throw runtime_error("System not yet built");
297      }      }
298        CONSOLE_DEBUG("Calling slvDOF_status...");
299      slvDOF_status(sys, &status, &dof);      slvDOF_status(sys, &status, &dof);
300      switch(status){      switch(status){
301          case ASCXX_DOF_UNDERSPECIFIED:          case ASCXX_DOF_UNDERSPECIFIED:
# Line 334  Simulation::getFreeableVariables(){ Line 335  Simulation::getFreeableVariables(){
335      }else{      }else{
336          if(fixedarrayptr ==NULL){          if(fixedarrayptr ==NULL){
337              ERROR_REPORTER_HERE(ASC_USER_ERROR,"STRUCTURALLY INCONSISTENT");              ERROR_REPORTER_HERE(ASC_USER_ERROR,"STRUCTURALLY INCONSISTENT");
338              throw runtime_error("Invalid constistency analysis result returned!");              throw runtime_error("Invalid consistency analysis result returned!");
339          }          }
340    
341          struct var_variable **vp = slv_get_master_var_list(sys);          struct var_variable **vp = slv_get_master_var_list(sys);
# Line 352  Simulation::checkStructuralSingularity() Line 353  Simulation::checkStructuralSingularity()
353      int *ril;      int *ril;
354      int *fil;      int *fil;
355    
356      cerr << "RETREIVING slfDOF_structsing INFO" << endl;      cerr << "RETRIEVING slfDOF_structsing INFO" << endl;
357    
358      int res = slvDOF_structsing(sys, mtx_FIRST, &vil, &ril, &fil);      int res = slvDOF_structsing(sys, mtx_FIRST, &vil, &ril, &fil);
359      struct var_variable **varlist = slv_get_solvers_var_list(sys);      struct var_variable **varlist = slv_get_solvers_var_list(sys);
# Line 427  Simulation::setSolver(Solver &solver){ Line 428  Simulation::setSolver(Solver &solver){
428    
429      // Update the solver object because sometimes an alternative solver can be returned, apparently.      // Update the solver object because sometimes an alternative solver can be returned, apparently.
430    
431        CONSOLE_DEBUG("Calling slv_select_solver...");
432      int selected = slv_select_solver(sys, solver.getIndex());      int selected = slv_select_solver(sys, solver.getIndex());
433      //cerr << "Simulation::setSolver: slv_select_solver returned " << selected << endl;      //cerr << "Simulation::setSolver: slv_select_solver returned " << selected << endl;
434    
# Line 468  Simulation::build(){ Line 470  Simulation::build(){
470          CONSOLE_DEBUG("Note: rebuilding system (was already built)");          CONSOLE_DEBUG("Note: rebuilding system (was already built)");
471      }      }
472    
473      Instance *i1 = getModel().getInternalType();      CONSOLE_DEBUG("Calling system_build...");
474      sys = system_build(&*i1);      sys = system_build(simroot.getInternalType());
475      if(!sys){      if(!sys){
476          throw runtime_error("Unable to build system");          throw runtime_error("Unable to build system");
477      }      }
# Line 500  Simulation::getSolverParameters() const{ Line 502  Simulation::getSolverParameters() const{
502  void  void
503  Simulation::setSolverParameters(SolverParameters &P){  Simulation::setSolverParameters(SolverParameters &P){
504      if(!sys)throw runtime_error("Can't set solver parameters: simulation has not been built yet.");      if(!sys)throw runtime_error("Can't set solver parameters: simulation has not been built yet.");
505        CONSOLE_DEBUG("Calling slv_set_parameters");
506      slv_set_parameters(sys, &(P.getInternalType()));      slv_set_parameters(sys, &(P.getInternalType()));
507  }  }
508    
# Line 523  Simulation::getFixableVariables(){ Line 526  Simulation::getFixableVariables(){
526      int32 *vip; /** TODO ensure 32 bit integers are used */      int32 *vip; /** TODO ensure 32 bit integers are used */
527    
528      // Get IDs of elegible variables in array at vip...      // Get IDs of elegible variables in array at vip...
529        CONSOLE_DEBUG("Calling slvDOF_eligible");
530      if(!slvDOF_eligible(sys,&vip)){      if(!slvDOF_eligible(sys,&vip)){
531          ERROR_REPORTER_NOLINE(ASC_USER_NOTE,"No fixable variables found.");          ERROR_REPORTER_NOLINE(ASC_USER_NOTE,"No fixable variables found.");
532      }else{      }else{
# Line 562  Simulation::getVariablesNearBounds(const Line 566  Simulation::getVariablesNearBounds(const
566      }      }
567    
568      int *vip;      int *vip;
569        CONSOLE_DEBUG("Calling slv_near_bounds...");
570      if(slv_near_bounds(sys,epsilon,&vip)){      if(slv_near_bounds(sys,epsilon,&vip)){
571          struct var_variable **vp = slv_get_solvers_var_list(sys);          struct var_variable **vp = slv_get_solvers_var_list(sys);
572          struct var_variable *var;          struct var_variable *var;
# Line 627  Simulation::solve(Solver solver, SolverR Line 632  Simulation::solve(Solver solver, SolverR
632    
633    
634      //cerr << "PRESOLVING SYSTEM...";      //cerr << "PRESOLVING SYSTEM...";
635        CONSOLE_DEBUG("Calling slv_presolve...");
636      slv_presolve(sys);      slv_presolve(sys);
637      //cerr << "DONE" << endl;      //cerr << "DONE" << endl;
638    
# Line 647  Simulation::solve(Solver solver, SolverR Line 653  Simulation::solve(Solver solver, SolverR
653      for(unsigned iter = 1; iter <= niter && !stop; ++iter){      for(unsigned iter = 1; iter <= niter && !stop; ++iter){
654    
655          if(status.isReadyToSolve()){          if(status.isReadyToSolve()){
656                CONSOLE_DEBUG("Calling slv_iterate...");
657              slv_iterate(sys);              slv_iterate(sys);
658          }          }
659    

Legend:
Removed from v.917  
changed lines
  Added in v.918

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