/[ascend]/branches/ksenija2/solvers/ida/idaboundary.c
ViewVC logotype

Diff of /branches/ksenija2/solvers/ida/idaboundary.c

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

revision 2881 by jpye, Sun Mar 29 05:31:03 2015 UTC revision 2882 by jpye, Sun Mar 29 12:20:00 2015 UTC
# Line 52  int some_dis_vars_changed(slv_system_t s Line 52  int some_dis_vars_changed(slv_system_t s
52              if(dis_value(cur_dis) != dis_previous_value(cur_dis)){              if(dis_value(cur_dis) != dis_previous_value(cur_dis)){
53  #ifdef IDA_BND_DEBUG  #ifdef IDA_BND_DEBUG
54                  dis_name = dis_make_name(sys, cur_dis);                  dis_name = dis_make_name(sys, cur_dis);
55                  CONSOLE_DEBUG("Boundary %s (i=%d) has changed (current=%d, prev=%d)", dis_name,                  CONSOLE_DEBUG("Boolean %s (i=%d) has changed (current=%d, prev=%d)", dis_name,
56                          i, dis_value(cur_dis), dis_previous_value(cur_dis));                          i, dis_value(cur_dis), dis_previous_value(cur_dis));
57                  ASC_FREE(dis_name);                  ASC_FREE(dis_name);
58  #endif  #endif
# Line 306  int ida_cross_boundary(IntegratorSystem Line 306  int ida_cross_boundary(IntegratorSystem
306                      /* reminder: 'rootsfound[i] == 1 for UP or -1 for DOWN. */                      /* reminder: 'rootsfound[i] == 1 for UP or -1 for DOWN. */
307              /* this boundary was one of the boundaries triggered */              /* this boundary was one of the boundaries triggered */
308              bnd = enginedata->bndlist[i];              bnd = enginedata->bndlist[i];
309    #ifdef IDA_BND_DEBUG
310                char *name = bnd_make_name(integ->system,enginedata->bndlist[i]);
311                CONSOLE_DEBUG("Boundary '%s': ida_incr=%d, dirn=%d,ida_value=%d,ida_first_cross=%d,bnd_cond_states[i]=%d"
312                    ,name,bnd_ida_incr(bnd),rootsfound[i],bnd_ida_value(bnd)
313                    ,bnd_ida_first_cross(bnd)!=0,bnd_cond_states[i]
314                );
315    #endif
316              bnd_set_ida_crossed(bnd, 1);              bnd_set_ida_crossed(bnd, 1);
317              if(bnd_ida_first_cross(bnd) /* not crossed before */              if(bnd_ida_first_cross(bnd) /* not crossed before */
318                  || !((rootsfound[i] == 1 && bnd_ida_incr(bnd)) /* not crossing upwards twice in a row */                  || !((rootsfound[i] == 1 && bnd_ida_incr(bnd)) /* not crossing upwards twice in a row */
# Line 319  int ida_cross_boundary(IntegratorSystem Line 326  int ida_cross_boundary(IntegratorSystem
326                      bnd_cond_states[i] = 0;                      bnd_cond_states[i] = 0;
327                  }                  }
328  #ifdef IDA_BND_DEBUG  #ifdef IDA_BND_DEBUG
329                  char *n = bnd_make_name(integ->system,bnd);                  CONSOLE_DEBUG("Set boundary '%s' to %d (single cross)",name,bnd_ida_value(bnd)!=0);
                 CONSOLE_DEBUG("Set boundary '%s' to %d",n,bnd_ida_value(bnd)?1:0);  
                 ASC_FREE(n);  
330  #endif  #endif
331              }else{              }else{
332                  /* Boundary crossed twice in one direction. Very unlikey! */                  /* Boundary crossed twice in one direction. Very unlikey! */
# Line 344  int ida_cross_boundary(IntegratorSystem Line 349  int ida_cross_boundary(IntegratorSystem
349                  }                  }
350                  bnd_set_ida_value(bnd,bnd_cond_states[i]);                  bnd_set_ida_value(bnd,bnd_cond_states[i]);
351  #ifdef IDA_BND_DEBUG  #ifdef IDA_BND_DEBUG
352                  char *n = bnd_make_name(integ->system,bnd);                  CONSOLE_DEBUG("After double-cross, set boundary '%s' to %d",name,bnd_ida_value(bnd)?1:0);
                 CONSOLE_DEBUG("After double-cross, set boundary '%s' to %d",n,bnd_ida_value(bnd)?1:0);  
                 ASC_FREE(n);  
353  #endif  #endif
354              }              }
355              /* flag this boundary as having previously been crossed */              /* flag this boundary as having previously been crossed */
356              bnd_set_ida_first_cross(bnd,0);              bnd_set_ida_first_cross(bnd,0);
357              /* store this recent crossing-direction for future reference */              /* store this recent crossing-direction for future reference */
358              bnd_set_ida_incr(bnd,(rootsfound[i] > 0));              bnd_set_ida_incr(bnd,(rootsfound[i] > 0));
359    #ifdef IDA_BND_DEBUG
360                ASC_FREE(name);
361    #endif
362          }          }
363      }      }
364      if(!ida_log_solve(integ,lrslv_ind)) return -1;      if(!ida_log_solve(integ,lrslv_ind)) return -1;

Legend:
Removed from v.2881  
changed lines
  Added in v.2882

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