/[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 1033 by johnpye, Wed Jan 3 12:46:37 2007 UTC revision 1034 by johnpye, Thu Jan 4 05:37:55 2007 UTC
# Line 676  SingularityInfo::isSingular() const{ Line 676  SingularityInfo::isSingular() const{
676  */  */
677  void  void
678  Simulation::solve(Solver solver, SolverReporter &reporter){  Simulation::solve(Solver solver, SolverReporter &reporter){
679        int res;
680    
     // no need for this stuff: setSolver will try it anyway?  
 /*  
     if(!sys){  
         try{  
             CONSOLE_DEBUG("Building system");  
             build();  
         }catch(runtime_error &e){  
             stringstream ss;  
             ss << "Unable to build system: ";  
             ss << e.what();  
             throw runtime_error(ss.str());  
         }  
     }  
 */  
681      CONSOLE_DEBUG("Setting solver to '%s'",solver.getName().c_str());      CONSOLE_DEBUG("Setting solver to '%s'",solver.getName().c_str());
682      setSolver(solver);      setSolver(solver);
683    
684      //cerr << "PRESOLVING SYSTEM...";      //cerr << "PRESOLVING SYSTEM...";
685      CONSOLE_DEBUG("Calling slv_presolve...");      CONSOLE_DEBUG("Calling slv_presolve...");
686      slv_presolve(sys);  
687        res = slv_presolve(sys);
688        CONSOLE_DEBUG("slv_presolve returns %d",res);
689        if(res!=0){
690            throw runtime_error("Error in slv_presolve");
691        }
692    
693      //cerr << "DONE" << endl;      //cerr << "DONE" << endl;
694    
695      //cerr << "SOLVING SYSTEM..." << endl;      //cerr << "SOLVING SYSTEM..." << endl;
# Line 717  Simulation::solve(Solver solver, SolverR Line 710  Simulation::solve(Solver solver, SolverR
710    
711          if(status.isReadyToSolve()){          if(status.isReadyToSolve()){
712              /* CONSOLE_DEBUG("Calling slv_iterate..."); */              /* CONSOLE_DEBUG("Calling slv_iterate..."); */
713              slv_iterate(sys);              res = slv_iterate(sys);
714          }          }
715    
716            if(res)CONSOLE_DEBUG("slv_iterate returns %d",res);
717    
718          status.getSimulationStatus(*this);          status.getSimulationStatus(*this);
719    
720          if(reporter.report(&status)){          if(res || reporter.report(&status)){
721              stop = true;              stop = true;
722          }          }
723      }      }
# Line 732  Simulation::solve(Solver solver, SolverR Line 727  Simulation::solve(Solver solver, SolverR
727            
728      activeblock = status.getCurrentBlockNum();      activeblock = status.getCurrentBlockNum();
729    
730        // reporter can do output of num of iterations etc, if it wants to.
731      reporter.finalise(&status);      reporter.finalise(&status);
732    
     // Just a little bit of console output:  
   
     if(status.isOK()){  
         //cerr << "... SOLVED, STATUS OK" << endl;  
     }else{  
         cerr << "... SOLVER FAILED" << endl;  
     }  
   
     //cerr << "SOLVER PERFORMED " << status.getIterationNum() << " ITERATIONS IN " << elapsed << "s" << endl;  
   
733      // communicate solver variable status back to the instance tree      // communicate solver variable status back to the instance tree
734      processVarStatus();      processVarStatus();
735    
736        if(res || !status.isOK())throw runtime_error("Error in solving");
737  }  }
738    
739  //------------------------------------------------------------------------------  //------------------------------------------------------------------------------

Legend:
Removed from v.1033  
changed lines
  Added in v.1034

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