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

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

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

revision 975 by johnpye, Tue Dec 19 07:55:02 2006 UTC revision 976 by johnpye, Tue Dec 19 13:52:51 2006 UTC
# Line 708  int integrator_ida_djex(long int Neq, re Line 708  int integrator_ida_djex(long int Neq, re
708      var_filter_t filter = {VAR_SVAR, VAR_SVAR};      var_filter_t filter = {VAR_SVAR, VAR_SVAR};
709      double *derivatives;      double *derivatives;
710      int *variables;      int *variables;
711      int count, j, var_yindex;      int count, j;
712        long var_yindex;
713    
714      blsys = (IntegratorSystem *)jac_data;      blsys = (IntegratorSystem *)jac_data;
715      enginedata = integrator_ida_enginedata(blsys);      enginedata = integrator_ida_enginedata(blsys);
# Line 773  int integrator_ida_djex(long int Neq, re Line 774  int integrator_ida_djex(long int Neq, re
774              varname = var_make_name(blsys->system, enginedata->varlist[variables[j]]);              varname = var_make_name(blsys->system, enginedata->varlist[variables[j]]);
775              var_yindex = blsys->y_id[variables[j]];              var_yindex = blsys->y_id[variables[j]];
776              if(var_yindex >=0){              if(var_yindex >=0){
777                  fprintf(stderr,"  var[%d]='%s'=y[%d]",variables[j],varname,var_yindex);                  fprintf(stderr,"  var[%d]='%s'=y[%ld]",variables[j],varname,var_yindex);
778              }else{              }else{
779                  fprintf(stderr,"  var[%d]='%s'=ydot[%d]",variables[j],varname,-var_yindex-1);                  fprintf(stderr,"  var[%d]='%s'=ydot[%ld]",variables[j],varname,-var_yindex-1);
780              }              }
781              ASC_FREE(varname);              ASC_FREE(varname);
782          }          }
# Line 856  int integrator_ida_jvex(realtype tt, N_V Line 857  int integrator_ida_jvex(realtype tt, N_V
857      char *relname;      char *relname;
858      int status;      int status;
859      double Jv_i;      double Jv_i;
860      int var_yindex;      long var_yindex;
861    
862      int *variables;      int *variables;
863      double *derivatives;      double *derivatives;
# Line 928  int integrator_ida_jvex(realtype tt, N_V Line 929  int integrator_ida_jvex(realtype tt, N_V
929                  if(var_yindex >= 0){                  if(var_yindex >= 0){
930  #ifdef JEX_DEBUG  #ifdef JEX_DEBUG
931                      asc_assert(blsys->y[var_yindex]==enginedata->varlist[variables[j]]);                      asc_assert(blsys->y[var_yindex]==enginedata->varlist[variables[j]]);
932                      fprintf(stderr,"Jv[%d] += %f (dF[%d]/dy[%d] = %f, v[%d] = %f)\n", i                      fprintf(stderr,"Jv[%d] += %f (dF[%d]/dy[%ld] = %f, v[%ld] = %f)\n", i
933                          , derivatives[j] * NV_Ith_S(v,var_yindex)                          , derivatives[j] * NV_Ith_S(v,var_yindex)
934                          , i, var_yindex, derivatives[j]                          , i, var_yindex, derivatives[j]
935                          , var_yindex, NV_Ith_S(v,var_yindex)                          , var_yindex, NV_Ith_S(v,var_yindex)
# Line 936  int integrator_ida_jvex(realtype tt, N_V Line 937  int integrator_ida_jvex(realtype tt, N_V
937  #endif  #endif
938                      Jv_i += derivatives[j] * NV_Ith_S(v,var_yindex);                      Jv_i += derivatives[j] * NV_Ith_S(v,var_yindex);
939                  }else{                  }else{
940                        ASC_ASSERT_LT(-var_yindex-1, NV_LENGTH_S(v));
941  #ifdef JEX_DEBUG  #ifdef JEX_DEBUG
942                      fprintf(stderr,"Jv[%d] += %f (dF[%d]/dydot[%d] = %f, v[%d] = %f)\n", i                      fprintf(stderr,"Jv[%d] += %f (dF[%d]/dydot[%ld] = %f, v[%ld] = %f)\n", i
943                          , derivatives[j] * NV_Ith_S(v,-var_yindex-1)                          , derivatives[j] * NV_Ith_S(v,-var_yindex-1)
944                          , i, -var_yindex-1, derivatives[j]                          , i, -var_yindex-1, derivatives[j]
945                          , -var_yindex-1, NV_Ith_S(v,-var_yindex-1)                          , -var_yindex-1, NV_Ith_S(v,-var_yindex-1)

Legend:
Removed from v.975  
changed lines
  Added in v.976

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