/[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 916 by johnpye, Fri Oct 27 07:18:21 2006 UTC revision 917 by johnpye, Thu Nov 2 21:34:59 2006 UTC
# Line 513  int integrator_analyse_dae(IntegratorSys Line 513  int integrator_analyse_dae(IntegratorSys
513      for(j=0, i=1; i<=gl_length(sys->dynvars); ++i){      for(j=0, i=1; i<=gl_length(sys->dynvars); ++i){
514          info = (struct Integ_var_t *)gl_fetch(sys->dynvars, i);          info = (struct Integ_var_t *)gl_fetch(sys->dynvars, i);
515          if(!info->isstate)continue;          if(!info->isstate)continue;
516            varname = var_make_name(sys->system,info->i);
517          if(info->derivative == NULL){          if(info->derivative == NULL){
518                CONSOLE_DEBUG("Pure algebraic: %s",varname);
519              sys->y[j] = info->i; /* a pure algebraic variable */              sys->y[j] = info->i; /* a pure algebraic variable */
520              sys->ydot[j] = NULL;              sys->ydot[j] = NULL;
521          }else{          }else{
522                CONSOLE_DEBUG("Differential variable: %s",varname);
523              sys->y[j] = info->i; /* a variable whose derivative is present in the model */              sys->y[j] = info->i; /* a variable whose derivative is present in the model */
524              sys->ydot[j] = info->derivative;              sys->ydot[j] = info->derivative;
525          }          }
526            ASC_FREE(varname);
527            ++j;
528      }      }
529    
530      /*      /*
# Line 537  int integrator_analyse_dae(IntegratorSys Line 542  int integrator_analyse_dae(IntegratorSys
542      sys->y_id = ASC_NEW_ARRAY(long, nvarlist);      sys->y_id = ASC_NEW_ARRAY(long, nvarlist);
543      for(i=0; i< nvarlist; ++i){      for(i=0; i< nvarlist; ++i){
544          sys->y_id[i] = -2;          sys->y_id[i] = -2;
         varname = var_make_name(sys->system,varlist[i]);              
         CONSOLE_DEBUG(ASC_PROG_ERR,"Variable %d: '%s'",i,varname);  
         ASC_FREE(varname);  
545      }      }
546    
547      CONSOLE_DEBUG("WORKING THROUGH %d DYNVARS",gl_length(sys->dynvars));      CONSOLE_DEBUG("WORKING THROUGH %ld DYNVARS",gl_length(sys->dynvars));
548    
549      for(i=1; i <= gl_length(sys->dynvars); ++i){      for(i=1; i <= gl_length(sys->dynvars); ++i){
550          info = (struct Integ_var_t *)gl_fetch(sys->dynvars, i);          info = (struct Integ_var_t *)gl_fetch(sys->dynvars, i);
         CONSOLE_DEBUG("i = %d, info = %p", i, info);  
551          sys->y_id[info->varindx] = i;          sys->y_id[info->varindx] = i;
552          if(info->varindx){          varname = var_make_name(sys->system,info->i);          
553              varname = var_make_name(sys->system,info->varindx);                  if(info->varindx > 0){
554              CONSOLE_DEBUG(ASC_PROG_ERR,"Variable dynvars[%d]: '%s'",i,varname);              CONSOLE_DEBUG("Variable dynvars[%d] = y_id[%d] = '%s'",i,info->varindx,varname);
             ASC_FREE(varname);  
555          }else{          }else{
556              CONSOLE_DEBUG(ASC_PROG_ERR,"Variable dynvars[%d] not found in varlist",i);              CONSOLE_DEBUG("VARIABLE dynvars[%d] = y_id[%d] = '%s' NOT FOUND IN VARLIST",i,info->varindx,varname);
557          }          }
558            ASC_FREE(varname);
559      }      }
560      for(i=0; i< nvarlist; ++i){      for(i=0; i< nvarlist; ++i){
561          if(sys->y_id[i] < 0){          if(sys->y_id[i] < 0){
562              varname = var_make_name(sys->system,varlist[i]);                          varname = var_make_name(sys->system,varlist[i]);
563              ERROR_REPORTER_HERE(ASC_PROG_ERR,"Unconnected solver_var '%s'",i,varname);              CONSOLE_DEBUG("UNCONNECTED SOLVER VAR varlist[%d] = '%s' (probably fixed?)",i,varname);
564              ASC_FREE(varname);              ASC_FREE(varname);
             return 0;  
565          }          }
566      }      }
567    

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

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