/[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 1128 by johnpye, Wed Jan 10 05:41:38 2007 UTC revision 1129 by johnpye, Sat Jan 13 11:40:59 2007 UTC
# Line 187  void integrator_free(IntegratorSystem *s Line 187  void integrator_free(IntegratorSystem *s
187      in the instance hierarchy.      in the instance hierarchy.
188  */  */
189  static void IntegInitSymbols(void){  static void IntegInitSymbols(void){
190    STATEFLAG = AddSymbol("ode_type");      STATEFLAG = AddSymbol("ode_type");
191    STATEINDEX = AddSymbol("ode_id");      STATEINDEX = AddSymbol("ode_id");
192    OBSINDEX = AddSymbol("obs_id");      OBSINDEX = AddSymbol("obs_id");
193  }  }
194    
195  /*------------------------------------------------------------------------------  /*------------------------------------------------------------------------------
# Line 1518  double *integrator_get_observations(Inte Line 1518  double *integrator_get_observations(Inte
1518  }  }
1519    
1520  struct var_variable *integrator_get_observed_var(IntegratorSystem *sys, const long i){  struct var_variable *integrator_get_observed_var(IntegratorSystem *sys, const long i){
1521      assert(i>=0);      asc_assert(i>=0);
1522      assert(i<sys->n_obs);      asc_assert(i<sys->n_obs);
1523      return sys->obs[i];      return sys->obs[i];
1524  }  }
1525    
# Line 1531  struct var_variable *integrator_get_inde Line 1531  struct var_variable *integrator_get_inde
1531      return sys->x;      return sys->x;
1532  }  }
1533    
1534    int integrator_write_matrix(const IntegratorSystem *sys, FILE *fp){
1535        asc_assert(sys);
1536        asc_assert(sys->enginedata);
1537        asc_assert(sys->internals);
1538        asc_assert(sys->internals->name);
1539        if(sys->internals->writematrixfn){
1540            return (sys->internals->writematrixfn)(sys,fp);
1541        }else{
1542            ERROR_REPORTER_HERE(ASC_PROG_NOTE,"Integrator '%s' defines no write_matrix function.",sys->internals->name);
1543            return -1;
1544        }
1545    }
1546    
1547  /*----------------------------------------------------  /*----------------------------------------------------
1548      Build an analytic jacobian for solving the state system      Build an analytic jacobian for solving the state system
# Line 1558  struct var_variable *integrator_get_inde Line 1570  struct var_variable *integrator_get_inde
1570  static void Integ_SetObsId(struct var_variable *v, long index){  static void Integ_SetObsId(struct var_variable *v, long index){
1571    struct Instance *c, *i;    struct Instance *c, *i;
1572    i = var_instance(v);    i = var_instance(v);
1573    assert(i!=NULL);    asc_assert(i!=NULL);
1574    c = ChildByChar(i,OBSINDEX);    c = ChildByChar(i,OBSINDEX);
1575    if( c == NULL || InstanceKind(c) != INTEGER_INST || !AtomAssigned(c)) {    if( c == NULL || InstanceKind(c) != INTEGER_INST || !AtomAssigned(c)) {
1576      return;      return;
# Line 1597  static int Integ_CmpDynVars(struct Integ Line 1609  static int Integ_CmpDynVars(struct Integ
1609  int integrator_set_reporter(IntegratorSystem *sys  int integrator_set_reporter(IntegratorSystem *sys
1610      , IntegratorReporter *reporter      , IntegratorReporter *reporter
1611  ){  ){
1612      assert(sys!=NULL);      asc_assert(sys!=NULL);
1613      sys->reporter = reporter;      sys->reporter = reporter;
1614      /* ERROR_REPORTER_HERE(ASC_PROG_NOTE,"INTEGRATOR REPORTER HOOKS HAVE BEEN SET\n"); */      /* ERROR_REPORTER_HERE(ASC_PROG_NOTE,"INTEGRATOR REPORTER HOOKS HAVE BEEN SET\n"); */
1615      return 1;      return 1;
1616  }  }
1617    
1618  int integrator_output_init(IntegratorSystem *sys){  int integrator_output_init(IntegratorSystem *sys){
1619      assert(sys!=NULL);      asc_assert(sys!=NULL);
1620      assert(sys->reporter!=NULL);      asc_assert(sys->reporter!=NULL);
1621      if(sys->reporter->init!=NULL){      if(sys->reporter->init!=NULL){
1622          /* call the specified output function */          /* call the specified output function */
1623          return (*(sys->reporter->init))(sys);          return (*(sys->reporter->init))(sys);
# Line 1616  int integrator_output_init(IntegratorSys Line 1628  int integrator_output_init(IntegratorSys
1628    
1629  int integrator_output_write(IntegratorSystem *sys){  int integrator_output_write(IntegratorSystem *sys){
1630      static int reported_already=0;      static int reported_already=0;
1631      assert(sys!=NULL);      asc_assert(sys!=NULL);
1632      if(sys->reporter->write!=NULL){      if(sys->reporter->write!=NULL){
1633          return (*(sys->reporter->write))(sys);          return (*(sys->reporter->write))(sys);
1634      }      }
# Line 1629  int integrator_output_write(IntegratorSy Line 1641  int integrator_output_write(IntegratorSy
1641    
1642  int integrator_output_write_obs(IntegratorSystem *sys){  int integrator_output_write_obs(IntegratorSystem *sys){
1643      static int reported_already=0;      static int reported_already=0;
1644      assert(sys!=NULL);      asc_assert(sys!=NULL);
1645      if(sys->reporter->write_obs!=NULL){      if(sys->reporter->write_obs!=NULL){
1646          return (*(sys->reporter->write_obs))(sys);          return (*(sys->reporter->write_obs))(sys);
1647      }      }
# Line 1641  int integrator_output_write_obs(Integrat Line 1653  int integrator_output_write_obs(Integrat
1653  }  }
1654    
1655  int integrator_output_close(IntegratorSystem *sys){  int integrator_output_close(IntegratorSystem *sys){
1656      assert(sys!=NULL);      asc_assert(sys!=NULL);
1657      if(sys->reporter->close!=NULL){      if(sys->reporter->close!=NULL){
1658          return (*(sys->reporter->close))(sys);          return (*(sys->reporter->close))(sys);
1659      }      }

Legend:
Removed from v.1128  
changed lines
  Added in v.1129

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