/[ascend]/trunk/base/generic/solver/integrator.c
ViewVC logotype

Diff of /trunk/base/generic/solver/integrator.c

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

revision 984 by johnpye, Wed Dec 20 14:34:16 2006 UTC revision 985 by johnpye, Thu Dec 21 04:06:02 2006 UTC
# Line 662  int integrator_analyse_dae(IntegratorSys Line 662  int integrator_analyse_dae(IntegratorSys
662      }      }
663    
664      CONSOLE_DEBUG("CORRESPONDENCE OF SOLVER VARS TO INTEGRATOR VARS");      CONSOLE_DEBUG("CORRESPONDENCE OF SOLVER VARS TO INTEGRATOR VARS");
665      fprintf(stderr,"index\tname\ty_id\ty\tydot\n");      fprintf(stderr,"index\t%-15s\ty_id\ty\tydot\n","name");
666      fprintf(stderr,"-----\t-----\t-----\t-----\t-----\n");      fprintf(stderr,"-----\t%-15s\t-----\t-----\t-----\n","----");
667      integrator_visit_system_vars(sys,integrator_dae_show_var);      integrator_visit_system_vars(sys,integrator_dae_show_var);
668  #endif  #endif
669    
# Line 680  void integrator_dae_show_var(IntegratorS Line 680  void integrator_dae_show_var(IntegratorS
680            
681      varname = var_make_name(sys->system, var);      varname = var_make_name(sys->system, var);
682    
683      // maybe it's the independent variable      if(varindx==NULL){
684            fprintf(stderr,".\t%-15s\t",varname);
685        }else{
686            fprintf(stderr,"%d\t%-15s\t",*varindx,varname);
687        }
688    
689      if(var==sys->x){      if(var==sys->x){
690          if(varindx==NULL){          // it's the independent variable
691              fprintf(stderr,".\t%s\t(indep)\n",varname);          fprintf(stderr,"(indep)\n");
692        }else if(var_fixed(var)){
693            // it's fixed, so not really a DAE var
694            fprintf(stderr,"(fixed)\n");
695        }else if(varindx==NULL){
696            // there's no varindx, so looks like a problem
697            fprintf(stderr,"(not visited?)\n");
698        }else{
699            // a DAE var, by elimination
700            y_id = sys->y_id[*varindx];
701    
702            fprintf(stderr,"%ld", y_id);
703            if(y_id >= 0){
704                fprintf(stderr,"\ty[%ld]\t.\n",y_id);
705          }else{          }else{
706              fprintf(stderr,"%d\t%s\t(index)\n",*varindx,varname);              fprintf(stderr,"\t.\tydot[%ld]\n",-y_id-1);
707          }          }
         ASC_FREE(varname);  
         return;  
     }  
708    
709      // if it's fixed then it's not really a DAE var          ASC_ASSERT_LT(*varindx,1e7L);
710      if(var_fixed(var)){          ASC_ASSERT_LT(y_id, 9999999L);
711          fprintf(stderr,"%d\t%s\t(fixed)\n",*varindx,varname);          ASC_ASSERT_LT(-9999999L, y_id);
         ASC_FREE(varname);  
         return;  
712      }      }
   
     // if there's no varindx, and neither of the above, then there's a problem  
     if(varindx==NULL){  
         fprintf(stderr,".\t%s\t(not visited?)\t",varname);  
         ASC_FREE(varname);  
         return;  
     }  
   
     y_id = sys->y_id[*varindx];  
   
     fprintf(stderr,"%d\t%s\t%ld", *varindx, varname,y_id);  
713      ASC_FREE(varname);      ASC_FREE(varname);
     if(y_id >= 0){  
         fprintf(stderr,"\ty[%ld]\t.\n",y_id);  
     }else{  
         fprintf(stderr,"\t.\tydot[%ld]\n",-y_id-1);  
     }  
   
     ASC_ASSERT_LT(*varindx,1e7L);  
     ASC_ASSERT_LT(y_id, 9999999L);  
     ASC_ASSERT_LT(-9999999L, y_id);  
714  }  }
715    
716  void integrator_visit_system_vars(IntegratorSystem *sys,IntegratorVarVisitorFn *visitfn){  void integrator_visit_system_vars(IntegratorSystem *sys,IntegratorVarVisitorFn *visitfn){

Legend:
Removed from v.984  
changed lines
  Added in v.985

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