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

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

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

revision 1386 by jpye, Thu Apr 5 14:10:43 2007 UTC revision 1387 by jpye, Sat Apr 7 14:43:31 2007 UTC
# Line 215  static int integrator_ida_sort_rels_and_ Line 215  static int integrator_ida_sort_rels_and_
215  #endif  #endif
216      asc_assert(ny1 == sys->n_y);      asc_assert(ny1 == sys->n_y);
217    
218        ERROR_REPORTER_HERE(ASC_USER_NOTE,"moving derivs to start of remainder\n");
219      if(system_cut_vars(sys->system, ny1, &integrator_ida_deriv, &nydot)){      if(system_cut_vars(sys->system, ny1, &integrator_ida_deriv, &nydot)){
220          ERROR_REPORTER_HERE(ASC_PROG_ERR,"Problem cutting derivs");          ERROR_REPORTER_HERE(ASC_PROG_ERR,"Problem cutting derivs");
221          return 1;          return 1;
# Line 350  int integrator_ida_check_index(Integrato Line 351  int integrator_ida_check_index(Integrato
351      asc_assert(system_vfilter_deriv.matchbits & VAR_DERIV);      asc_assert(system_vfilter_deriv.matchbits & VAR_DERIV);
352      asc_assert(system_vfilter_deriv.matchvalue & VAR_DERIV);      asc_assert(system_vfilter_deriv.matchvalue & VAR_DERIV);
353    
354        CONSOLE_DEBUG("system has %d vars matching deriv filter",slv_count_solvers_vars(sys->system, &system_vfilter_deriv));
355    
356      res = system_jacobian(sys->system      res = system_jacobian(sys->system
357          , &system_rfilter_diff          , &system_rfilter_diff
358          , &system_vfilter_deriv          , &system_vfilter_deriv
# Line 570  int integrator_ida_analyse(IntegratorSys Line 573  int integrator_ida_analyse(IntegratorSys
573    
574      /* ...(1) FIX the derivatives */      /* ...(1) FIX the derivatives */
575      CONSOLE_DEBUG("Checking system with derivatives fixed...");      CONSOLE_DEBUG("Checking system with derivatives fixed...");
576      for(i=0;i<n_y;++i){      for(i=0;i<sys->n_y;++i){
577          if(sys->ydot[i])var_set_fixed(sys->ydot[i],1);          if(sys->ydot[i])var_set_fixed(sys->ydot[i],1);
578      }      }
579    
# Line 580  int integrator_ida_analyse(IntegratorSys Line 583  int integrator_ida_analyse(IntegratorSys
583    
584      /* ...(2) FREE the derivatives, FIX the diffvars */      /* ...(2) FREE the derivatives, FIX the diffvars */
585      CONSOLE_DEBUG("Checking system with differential variables fixed...");      CONSOLE_DEBUG("Checking system with differential variables fixed...");
586      for(i=0;i<n_y;++i){      for(i=0;i<sys->n_y;++i){
587          if(sys->ydot[i]){          if(sys->ydot[i]){
588              var_set_fixed(sys->ydot[i],0);              var_set_fixed(sys->ydot[i],0);
589              var_set_fixed(sys->y[i],1);              var_set_fixed(sys->y[i],1);
# Line 591  int integrator_ida_analyse(IntegratorSys Line 594  int integrator_ida_analyse(IntegratorSys
594      if(res)return 200 + res;      if(res)return 200 + res;
595            
596      /* ...(3) restore as it was, FREE the diffvars */      /* ...(3) restore as it was, FREE the diffvars */
597      for(i=0;i<n_y;++i){      for(i=0;i<sys->n_y;++i){
598          if(sys->ydot[i]){          if(sys->ydot[i]){
599              var_set_fixed(sys->y[i],0);              var_set_fixed(sys->y[i],0);
600          }          }
# Line 921  int integrator_ida_diffindex(const Integ Line 924  int integrator_ida_diffindex(const Integ
924      return sys->y_id[var_sindex(deriv) - sys->n_y];      return sys->y_id[var_sindex(deriv) - sys->n_y];
925  }  }
926    
927    /**
928        A less assertive version of diffindex...
929    */
930    int integrator_ida_diffindex1(const IntegratorSystem *sys, const struct var_variable *deriv){
931        if(var_sindex(deriv) >= sys->n_y)return -1;
932        if(var_sindex(deriv) < sys->n_y + sys->n_ydot)return -2;
933        return sys->y_id[var_sindex(deriv) - sys->n_y];
934    }
935    
936  /**  /**
937      This function will output the data structures provided to use BY THE      This function will output the data structures provided to use BY THE
938      SYSTEM -- not the ones we're working with here IN THE SOLVER.      SYSTEM -- not the ones we're working with here IN THE SOLVER.

Legend:
Removed from v.1386  
changed lines
  Added in v.1387

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