/[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 1045 by johnpye, Thu Jan 4 07:35:22 2007 UTC revision 1046 by johnpye, Fri Jan 5 11:15:16 2007 UTC
# Line 101  Simulation::Simulation(const Simulation Line 101  Simulation::Simulation(const Simulation
101      //is_built = old.is_built;      //is_built = old.is_built;
102      CONSOLE_DEBUG("Copying Simulation...");      CONSOLE_DEBUG("Copying Simulation...");
103      sys = old.sys;      sys = old.sys;
     bin_srcname = old.bin_srcname;  
     bin_objname = old.bin_objname;  
     bin_libname = old.bin_libname;  
     bin_cmd = old.bin_cmd;  
     bin_rm = old.bin_rm;  
104      sing = NULL;      sing = NULL;
105  }  }
106    
# Line 405  Simulation::checkStructuralSingularity() Line 400  Simulation::checkStructuralSingularity()
400      cerr << "RETRIEVING slfDOF_structsing INFO" << endl;      cerr << "RETRIEVING slfDOF_structsing INFO" << endl;
401    
402      int res = slvDOF_structsing(sys, mtx_FIRST, &vil, &ril, &fil);      int res = slvDOF_structsing(sys, mtx_FIRST, &vil, &ril, &fil);
     struct var_variable **varlist = slv_get_solvers_var_list(sys);  
     struct rel_relation **rellist = slv_get_solvers_rel_list(sys);  
403    
404      if(this->sing){      if(this->sing){
405          cerr << "DELETING OLD SINGULATING INFO" << endl;          cerr << "DELETING OLD SINGULATING INFO" << endl;
# Line 415  Simulation::checkStructuralSingularity() Line 408  Simulation::checkStructuralSingularity()
408      }      }
409    
410      if(res==1){      if(res==1){
411          CONSOLE_DEBUG("processing singularity data...");          throw runtime_error("Unable to determine singularity lists");
412          sing = new SingularityInfo();      }
413    
414          // pull in the lists of vars and rels, and the freeable vars:      if(res!=0){
415          for(int i=0; ril[i]!=-1; ++i){          throw runtime_error("Invalid return from slvDOF_structsing.");
416              sing->rels.push_back( Relation(this, rellist[ril[i]]) );      }
         }  
417    
         for(int i=0; vil[i]!=-1; ++i){  
             sing->vars.push_back( Variable(this, varlist[vil[i]]) );  
         }  
418    
419          for(int i=0; fil[i]!=-1; ++i){      CONSOLE_DEBUG("processing singularity data...");
420              sing->freeablevars.push_back( Variable(this, varlist[fil[i]]) );      sing = new SingularityInfo();
         }  
421    
422          // we're done with those lists now      struct var_variable **varlist = slv_get_solvers_var_list(sys);
423          ASC_FREE(vil);      struct rel_relation **rellist = slv_get_solvers_rel_list(sys);
424          ASC_FREE(ril);  
425          ASC_FREE(fil);      // pull in the lists of vars and rels, and the freeable vars:
426        for(int i=0; ril[i]!=-1; ++i){
427          if(sing->isSingular()){          sing->rels.push_back( Relation(this, rellist[ril[i]]) );
428              CONSOLE_DEBUG("singularity found");      }
429              this->sing = sing;  
430              return FALSE;      for(int i=0; vil[i]!=-1; ++i){
431          }          sing->vars.push_back( Variable(this, varlist[vil[i]]) );
432          CONSOLE_DEBUG("no singularity");      }
433          delete sing;  
434          return TRUE;      for(int i=0; fil[i]!=-1; ++i){
435      }else{          sing->freeablevars.push_back( Variable(this, varlist[fil[i]]) );
436          if(res==0){      }
437              throw runtime_error("Unable to determine singularity lists");  
438          }else{      // we're done with those lists now
439              throw runtime_error("Invalid return from slvDOF_structsing.");      ASC_FREE(vil);
440          }      ASC_FREE(ril);
441        ASC_FREE(fil);
442    
443        if(sing->isSingular()){
444            CONSOLE_DEBUG("singularity found");
445            this->sing = sing;
446            return FALSE;
447      }      }
448        CONSOLE_DEBUG("no singularity");
449        delete sing;
450        return TRUE;
451  }  }
452    
453  /**  /**

Legend:
Removed from v.1045  
changed lines
  Added in v.1046

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