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

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

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

revision 1217 by johnpye, Tue Jan 23 13:10:26 2007 UTC revision 1218 by johnpye, Tue Jan 23 13:42:49 2007 UTC
# Line 627  int integrator_ida_analyse(IntegratorSys Line 627  int integrator_ida_analyse(IntegratorSys
627                  sys->ydot[n_y] = v;                  sys->ydot[n_y] = v;
628                  sys->y_id[var_sindex(v)] = -n_y-1;                  sys->y_id[var_sindex(v)] = -n_y-1;
629                  varname = var_make_name(sys->system,v);                  varname = var_make_name(sys->system,v);
630                  CONSOLE_DEBUG("'%s' is derivative (%ld)",varname,n_y);                  CONSOLE_DEBUG("'%s' is derivative (%ld, %p, %p)",varname,n_y,v,sys->ydot[-sys->y_id[var_sindex(v)]-1]);
631                  ASC_FREE(varname);                  ASC_FREE(varname);
632                  n_y++;                  n_y++;
633                  continue;                  continue;
# Line 716  int integrator_ida_analyse(IntegratorSys Line 716  int integrator_ida_analyse(IntegratorSys
716      /*   - boundaries (optional) */      /*   - boundaries (optional) */
717      /* ERROR_REPORTER_HERE(ASC_PROG_ERR,"Implementation incomplete");      /* ERROR_REPORTER_HERE(ASC_PROG_ERR,"Implementation incomplete");
718      return -1; */      return -1; */
719    
720        if(integrator_ida_check_lists(sys)){
721            integrator_debug(sys,stderr);
722        }
723      return 0;      return 0;
724  }  }
725  #endif  #endif
# Line 1958  int integrator_ida_debug(const Integrato Line 1962  int integrator_ida_debug(const Integrato
1962      }      }
1963    
1964      fprintf(fp,"\n\nCORRESPONDENCE OF SOLVER VARS TO INTEGRATOR VARS\n\n");      fprintf(fp,"\n\nCORRESPONDENCE OF SOLVER VARS TO INTEGRATOR VARS\n\n");
1965      fprintf(fp,"index\t%-15s\ty_id\ty\tydot\n","name");      fprintf(fp,"sindex\t%-15s\ty_id\ty\tydot\n","name");
1966      fprintf(fp,"-----\t%-15s\t-----\t-----\t-----\n","----");      fprintf(fp,"------\t%-15s\t-----\t-----\t-----\n","----");
1967    
1968    
1969      /* visit all the slv_system_t master var lists to collect vars */      /* visit all the slv_system_t master var lists to collect vars */
# Line 2019  int integrator_ida_debug(const Integrato Line 2023  int integrator_ida_debug(const Integrato
2023  static int integrator_ida_check_lists(const IntegratorSystem *sys){  static int integrator_ida_check_lists(const IntegratorSystem *sys){
2024      long i, y_id;      long i, y_id;
2025      struct var_variable **svars;      struct var_variable **svars;
2026        char *varname1, *varname2;
2027      long n;      long n;
2028      int err = 0;      int err = 0;
2029      svars = slv_get_solvers_var_list(sys->system);      svars = slv_get_solvers_var_list(sys->system);
# Line 2029  static int integrator_ida_check_lists(co Line 2034  static int integrator_ida_check_lists(co
2034              CONSOLE_DEBUG("Skipping y_id[%ld] = %ld",i,y_id);              CONSOLE_DEBUG("Skipping y_id[%ld] = %ld",i,y_id);
2035              continue;              continue;
2036          }          }
2037          if(y_id > 0){          varname1 = var_make_name(sys->system,svars[i]);
2038            if(y_id >= 0){
2039              if(sys->y[y_id]!=svars[i]){              if(sys->y[y_id]!=svars[i]){
2040                  ERROR_REPORTER_HERE(ASC_PROG_ERR,"Error y: y_id[%ld] = %ld",i,y_id);                  varname2 = var_make_name(sys->system,sys->y[y_id]);
2041                    ERROR_REPORTER_HERE(ASC_PROG_ERR,"Error y: y_id[%ld]=%ld-->'%s', but svars[%ld]='%s'"
2042                        ,i,y_id,varname2,i,varname1
2043                    );
2044                    ASC_FREE(varname2);
2045                    err++;
2046                }
2047            }else if(sys->ydot[-y_id-1] != NULL){
2048                CONSOLE_DEBUG("y_id = %ld  --> -y_id-1 = %ld --> sys->ydot[%ld] = %p"
2049                    ,y_id, -y_id-1, -y_id-1, sys->ydot[-y_id-1]
2050                );
2051                varname2 = var_make_name(sys->system,sys->ydot[-y_id-1]);
2052                if(sys->ydot[-y_id-1]!=svars[i]){
2053                    ERROR_REPORTER_HERE(ASC_PROG_ERR,"Error y: y_id[%ld]=%ld-->'%s', but svars[%ld]='%s'"
2054                        ,i,-y_id-1,varname2,i,varname1
2055                    );
2056                  err++;                  err++;
2057              }              }
2058          }else if(sys->ydot[-y_id-1]!=svars[i]){              ASC_FREE(varname2);
             ERROR_REPORTER_HERE(ASC_PROG_ERR,"Error ydot: y_id[%ld] = %ld",i,y_id);  
             err++;  
2059          }          }
2060            ASC_FREE(varname1);
2061      }      }
2062      return err;      return err;
2063  }  }

Legend:
Removed from v.1217  
changed lines
  Added in v.1218

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