/[ascend]/trunk/base/generic/solver/integrator.h
ViewVC logotype

Diff of /trunk/base/generic/solver/integrator.h

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

revision 976 by johnpye, Tue Dec 19 00:57:26 2006 UTC revision 977 by johnpye, Wed Dec 20 00:39:52 2006 UTC
# Line 82  Line 82 
82    
83  /*---------------------------*/  /*---------------------------*/
84    
85  #define I(N) INTEG_##N  #ifdef ASC_WITH_IDA
86  #define S ,  # define IDA_OPTIONAL S I(IDA,integrator_ida_internals)
87    #else
88    # define IDA_OPTIONAL
89    #endif
90    
91    /* we add IDA to the list of integrators at build time, if it is selected */
92  #define INTEG_LIST \  #define INTEG_LIST \
93      I(LSODE) S \      I(LSODE       ,integrator_lsode_internals) \
94      I(IDA) S \      IDA_OPTIONAL \
95      I(AWW)      S I(AWW       ,integrator_aww_internals)
96    
97  /**  /**
98      Struct containin the list of supported integrators      Struct containin the list of supported integrators
99  */  */
100  typedef enum{  typedef enum{
101      INTEG_UNKNOWN  #define I(N,P) INTEG_##N
102      ,INTEG_LIST  #define S ,
103  } IntegratorEngine;      INTEG_LIST
   
104  #undef I  #undef I
105  #undef S  #undef S
106        ,INTEG_UNKNOWN /* must be last in the list*/
107    } IntegratorEngine;
108    
109    
110  typedef struct{  typedef struct{
111      IntegratorEngine id;      IntegratorEngine id;
# Line 150  typedef struct{ Line 157  typedef struct{
157  } IntegratorReporter;  } IntegratorReporter;
158    
159  /*------------------------------------*/  /*------------------------------------*/
160    /* INTEGRATOR INTERNALS - define the routines that consitute a specific integrator */
161    
162    /* forward decl */
163    struct IntegratorSystemStruct;
164    
165    typedef void IntegratorCreateFn(struct IntegratorSystemStruct *blsys);
166    /**< Integrators must provide a routine here that allocates the necessary
167        data structures.
168    */
169    
170    typedef int IntegratorParamsDefaultFn(struct IntegratorSystemStruct *blsys);
171    /**<
172        Integrators must provide a function like this that can be used to retrieve
173        the default set of parameters.
174    */
175    
176    typedef int IntegratorAnalyseFn(struct IntegratorSystemStruct *blsys);
177    
178    
179    typedef int IntegratorSolveFn(struct IntegratorSystemStruct *blsys
180            , unsigned long start_index, unsigned long finish_index);
181    /**<
182        Integrators must provide a function like this that actually runs the
183        integration.
184    */
185    
186    typedef void IntegratorFreeFn(void *enginedata);
187    /**<
188        Integrators must provide a function like this that frees internal
189        data that they have allocated in their 'enginedata' structure.
190    */
191    
192    typedef struct{
193        IntegratorCreateFn *createfn;
194        IntegratorParamsDefaultFn *paramsdefaultfn;
195        IntegratorAnalyseFn *analysefn;
196        IntegratorSolveFn *solvefn;
197        IntegratorFreeFn *freefn;
198        IntegratorEngine engine;
199        const char name[];
200    } IntegratorInternals;
201    
202    /*------------------------------------*/
203  /**  /**
204      Initial Value Problem description struct. Anyone making a copy of      Initial Value Problem description struct. Anyone making a copy of
205      the y, ydot, or obs pointers who plans to free that pointer later      the y, ydot, or obs pointers who plans to free that pointer later
# Line 165  struct IntegratorSystemStruct{ Line 215  struct IntegratorSystemStruct{
215    struct Instance *instance;  /**< not sure if this one is really necessary... -- JP */    struct Instance *instance;  /**< not sure if this one is really necessary... -- JP */
216    slv_system_t system;        /**< the system that we're integrating in ASCEND */    slv_system_t system;        /**< the system that we're integrating in ASCEND */
217    IntegratorEngine engine;    /**< enum containing the ID of the integrator engine we're using */    IntegratorEngine engine;    /**< enum containing the ID of the integrator engine we're using */
218      const IntegratorInternals *internals;/**< pointers to the various functions belonging to this integrator */
219    IntegratorReporter *reporter;/**< functions for reporting integration results */    IntegratorReporter *reporter;/**< functions for reporting integration results */
220    SampleList *samples;        /**< pointer to the list of samples. we *don't own* this **/    SampleList *samples;        /**< pointer to the list of samples. we *don't own* this **/
221    void *enginedata;           /**< space where the integrator engine can store stuff */    void *enginedata;           /**< space where the integrator engine can store stuff */
# Line 214  ASC_DLLSPEC(IntegratorSystem *) integrat Line 265  ASC_DLLSPEC(IntegratorSystem *) integrat
265    
266  ASC_DLLSPEC(int) integrator_analyse(IntegratorSystem *blsys);  ASC_DLLSPEC(int) integrator_analyse(IntegratorSystem *blsys);
267    
268    /**
269        These routines will hopefully be sharable by different Integrator engines.
270        The idea is that if we change from the 'ode_id' and 'ode_type' syntax,
271        the only place in the Integrator code that would be affected is here.
272        However for the moment, we allow Integrators to specify how they would
273        like to analyse the system, and for that, we export these routines so that
274        they can be referred to in lsode.h, ida.h, etc.
275    */  
276    ASC_DLLSPEC(int) integrator_analyse_ode(IntegratorSystem *blsys);
277    ASC_DLLSPEC(int) integrator_analyse_dae(IntegratorSystem *blsys);
278    /**< see integrator_analyse_ode */
279    
280  ASC_DLLSPEC(int) integrator_solve(IntegratorSystem *blsys, long i0, long i1);  ASC_DLLSPEC(int) integrator_solve(IntegratorSystem *blsys, long i0, long i1);
281  /**<  /**<
282      Takes the type of integrator and sets up the global variables into the      Takes the type of integrator and sets up the global variables into the
# Line 227  ASC_DLLSPEC(void) integrator_free(Integr Line 290  ASC_DLLSPEC(void) integrator_free(Integr
290      Deallocates any memory used and sets all integration global points to NULL.      Deallocates any memory used and sets all integration global points to NULL.
291  */  */
292    
293  ASC_DLLSPEC(void) integrator_get_engines(IntegratorLookup **listptr);  ASC_DLLSPEC(const IntegratorLookup *) integrator_get_engines();
294  /**<  /**<
295      Return a {INTEG_UNKNOWN,NULL} terminated list of integrator currently      Return a {INTEG_UNKNOWN,NULL} terminated list of integrator currently
296      available. At present this is determined at compile time but will be      available. At present this is determined at compile time but will be
# Line 250  ASC_DLLSPEC(IntegratorEngine) integrator Line 313  ASC_DLLSPEC(IntegratorEngine) integrator
313      INTEG_UNKNOWN if none or invalid setting).      INTEG_UNKNOWN if none or invalid setting).
314  */  */
315    
 typedef int IntegratorParamsDefaultFn(IntegratorSystem *blsys);  
 /**<  
     Integrators must provide a function like this that can be used to retrieve  
     the default set of parameters.  
 */  
   
316  ASC_DLLSPEC(int) integrator_params_get(const IntegratorSystem *blsys, slv_parameters_t *parameters);  ASC_DLLSPEC(int) integrator_params_get(const IntegratorSystem *blsys, slv_parameters_t *parameters);
317  /**<  /**<
318      Copies the current set of Integrator parameters into the indicated parameter set, 'parameters'.      Copies the current set of Integrator parameters into the indicated parameter set, 'parameters'.

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

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