/[ascend]/trunk/tcltk/generic/interface/Integrators.h
ViewVC logotype

Diff of /trunk/tcltk/generic/interface/Integrators.h

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

revision 571 by johnpye, Tue May 9 00:14:59 2006 UTC revision 670 by johnpye, Wed Jun 21 07:57:19 2006 UTC
# Line 1  Line 1 
1    /*  ASCEND modelling environment
2        Copyright 1997, Carnegie Mellon University
3        Copyright (C) 2006 Carnegie Mellon University
4    
5        This program is free software; you can redistribute it and/or modify
6        it under the terms of the GNU General Public License as published by
7        the Free Software Foundation; either version 2, or (at your option)
8        any later version.
9    
10        This program is distributed in the hope that it will be useful,
11        but WITHOUT ANY WARRANTY; without even the implied warranty of
12        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13        GNU General Public License for more details.
14    
15        You should have received a copy of the GNU General Public License
16        along with this program; if not, write to the Free Software
17        Foundation, Inc., 59 Temple Place - Suite 330,
18        Boston, MA 02111-1307, USA.
19    *//** @file
20        Implementation of the Integration Interface.
21    
22        This module defines the general integration auxillaries for Ascend.
23    
24        Requires
25        #include "tcl.h"
26        #include "utilities/ascConfig.h
27        #include "general/list.h"
28        #include "compiler/instance_enum.h"
29        #include "compiler/dimen.h"
30        #include "solver/slv_client.h"
31        #include "compiler/interface.h"
32        #include <stdio.h>   (for current INTEG_DEBUG functions)
33    *//*
34        Author:       Boyd T. Safrit
35        by Kirk Abbott and Ben Allan
36        Created: 1/94
37        Version: $Revision: 1.16 $
38        Version control file: $RCSfile: Integrators.h,v $
39        Date last modified: $Date: 2003/08/23 18:43:06 $
40        Last modified by: $Author: ballan $
41    
42        Changes:  8/95  Added support code for BLSODE, an
43                        experimental user interface
44                        which identifies states, derivatives,
45                        observations, and tolerances by flags.
46                        Interface redesign (ASCEND side) by
47                        Jennifer Stokes and (C side) Ben Allan.
48                        The only required vector left is that
49                        defining the time steps to calculate
50                        results at. All state and observation
51                        data are (optionally) logged to files.
52                  5/96  Removed old lsode interface routines.
53                        The Piela version of lsode is dead.
54                  8/96  Removed the var == instance assumption from
55                        the implementation.
56    */
57    
58    
59    #ifndef ASCTK_INTEGRATORS_H
60    #define ASCTK_INTEGRATORS_H
61    
62    #include <solver/integrator.h>
63    
64    extern int Asc_IntegSetYFileCmd(ClientData cdata, Tcl_Interp *interp,
65                                    int argc, CONST84 char *argv[]);
66    /**<
67     *  Set the next filename to be used for integration state variable
68     *  logging. Does not check the filesystem sanity of the given name.<br><br>
69     *
70     *  Registered as: integrate_set_y_file filename
71     */
72    
73    extern int Asc_IntegSetObsFileCmd(ClientData cdata, Tcl_Interp *interp,
74                                      int argc, CONST84 char *argv[]);
75    /**<
76     *  Set the next filename to be used for integration observation variable
77     *  logging. Does not check the filesystem sanity of the given name.<br><br>
78     *
79     *  Registered as: integrate_set_obs_file filename
80     */
81    
82    extern int Asc_IntegSetFileUnitsCmd(ClientData cdata, Tcl_Interp *interp,
83                                        int argc, CONST84 char *argv[]);
84    /**<
85     *  Sets output to be in SI (internal) units or in the user set display
86     *  units. If display is selected and the variable to be printed cannot
87     *  be displayed in the display units because of floating point errors
88     *  in conversion, the value will be printed in SI units and a warning
89     *  issued to stderr. The user is then expected to deal with the problem
90     *  of inconsistency in his output.
91     *  Only the first letter of the argument is significant.<br><br>
92     *
93     *  Registered as: integrate_logunits <display,si>
94     */
95    
96    extern int Asc_IntegSetFileFormatCmd(ClientData cdata, Tcl_Interp *interp,
97                                         int argc, CONST84 char *argv[]);
98    /**<
99     *  Sets output data to be in fixed column width (with extra white) or in
100     *  space separated columns whose width is variable from line to line.
101     *  Only the first letter of the argument is significant.<br><br>
102     *
103     *  Registered as: integrate_logformat <fixed,variable>
104     */
105    
106    
107    
108    extern int Asc_IntegGetXSamplesCmd(ClientData cdata, Tcl_Interp *interp,
109                                       int argc, CONST84 char *argv[]);
110    /**<
111     *  Returns the current vector of independent variable samples as fed to
112     *  smarter integrators such as lsode. Returns 2 element list:
113     *  {units of x} {list of doubles in the units indicated in the first
114     *  element}. In the event that display is given but the sample values
115     *  (which are stored in si) cannot be converted to display units, the
116     *  units of x in the first element will change and the SI values will
117     *  be returned in the second element. If display is not given, samples
118     *  will be returned in SI units.
119     *  The units used will be dimensionally consistent with those specified
120     *  when integrate_set_samples was called.
121     *  Only the first letter of the optional argument display is significant.<br><br>
122     *
123     *  Registered as: integrate_get_samples [display]
124     */
125    
126    extern int Asc_IntegSetXSamplesCmd(ClientData data, Tcl_Interp *interp,
127                                       int argc, CONST84 char *argv[]);
128    /**<
129     *  Takes the values given and sets the intervals for smarter
130     *  integrators accordingly. Values will be converted to SI values
131     *  using the units given. ?,* is a legal unit, in which case the
132     *  values will be assumed to be SI requiring no conversion.
133     *  If no arguments are given, we will free memory allocated for storage
134     *  of the list, otherwise at least 2 values are required.<br><br>
135     *
136     *  Note: It is the users responsibility to make sure that the dimens/
137     *  units this is called with match the independent variable in the ivp.
138     *  C clients are given the power to verify this.
139     *  Also, the units given must already exist: we do not create them.<br><br>
140     *
141     *  Registered as:  integrate_set_samples <units> <value [value...] value>
142     */
143    
144    extern int Asc_IntegInstIntegrableCmd(ClientData cdata, Tcl_Interp *interp,
145                                          int argc, CONST84 char *argv[]);
146    /**<
147     *  Returns "1" if instance is integrable by the named integrator, "0"
148     *  otherwise. Currently valid names are: lsode
149     *  The instance examined is "current", "search", or "solver".<br><br>
150     *
151     *  Registered as:  integrate_able <instance> <NAME>
152     */
153    
154    
155    extern int Asc_IntegSetupCmd(ClientData cdata,Tcl_Interp *interp,
156                                 int argc, CONST84 char *argv[]);
157    /**<
158     *  Set up the integrator.
159     *  itype is one of the supported integrator types (currently:
160     *  BLSODE)
161     *  n1 is the start index to run the integrator from.
162     *  n2 is the end index to stop at.
163     *
164     *  Registered as:  integrateSetup itype n1 n2
165     */
166    
167    extern int Asc_IntegCleanupCmd(ClientData cdata, Tcl_Interp *interp,
168                                   int argc, CONST84 char *argv[]);
169    /**<
170     *  Do any C level housekeeping need after calling integration.
171     *  Always use integrate_setup/integrate_cleanup in pairs.<br><br>
172     *
173     *  Registered as:  integrate_cleanup
174     */
175    
176    /*  functions affecting the logging of data during integration */
177    extern FILE *Asc_IntegOpenYFile(void);
178    /**<
179     *  Returns the pointer to a file to which state
180     *  variables should be written at each recorded time interval. Other
181     *  info may be written here as well, but that is up to the designer
182     *  of the specific integrator interface. The filename used will be
183     *  the one most recently set via Asc_IntegSetYFileCmd().  If no
184     *  name (or an empty name) has been set via Asc_IntegSetYFileCmd(),
185     *  the file returned will be NULL.<br><br>
186     *
187     *  This function may return NULL, in which case do not write to
188     *  them as there was some problem opening the file.
189     *  If opened successfully, the file returned will have DATASET and
190     *  the open time stamped at the bottom. This will separate multiple
191     *  runs or changes in the same run.<br><br>
192     *
193     *  Closing the files is your job.  When finished with the file, you
194     *  should call Asc_IntegReleaseYFile() before closing it.
195     */
196    extern FILE *Asc_IntegOpenObsFile(void);
197    /**<
198     *  Returns the pointer to a file to which observation
199     *  variables should be written at each recorded time interval. Other
200     *  info may be written here as well, but that is up to the designer
201     *  of the specific integrator interface. The filename used will be
202     *  the one most recently set via Asc_IntegSetObsFileCmd().  If no
203     *  name (or an empty name) has been set via Asc_IntegSetObsFileCmd(),
204     *  the file returned will be NULL.<br><br>
205     *
206     *  This function may return NULL, in which case do not write to
207     *  them as there was some problem opening the file.
208     *  If opened successfully, the file returned will have DATASET and
209     *  the open time stamped at the bottom. This will separate multiple
210     *  runs or changes in the same run.<br><br>
211     *
212     *  Closing the files is your job.  When finished with the file, you
213     *  should call Asc_IntegReleaseObsFile() before closing it.
214     */
215    
216    /**
217        these functions don't involve Tcl/Tk but they do implement stuff
218        in a way that might not be useful to other interfaces.
219    */
220    
221    extern FILE *Asc_IntegGetYFile(void);
222    /**<
223     *  Returns the current FILE * for writing state variables,
224     *  or NULL if none.
225     */
226    extern FILE *Asc_IntegGetObsFile(void);
227    /**<
228     *  Returns the current FILE * for writing observation variables,
229     *  or NULL if none.
230     */
231    extern void Asc_IntegReleaseYFile(void);
232    extern void Asc_IntegReleaseObsFile(void);
233    /**<
234     *  Releases the internally-stored FILE * for observation variables.
235     *  This does not close the file (which you still need to do).
236     *  This function should be called just before closing the files,
237     *  though it may be called sooner if you want to keep the file pointer
238     *  returned all to yourself.
239     */
240    
241    
242    extern void Asc_IntegPrintYHeader(FILE *fp, IntegratorSystem *blsys);
243    /**<
244     *  Prints Y header info to the file given.
245     *  If FILE is NULL, returns immediately.
246     *  If FILE ok, but blsys NULL prints warning to stderr and returns.
247     *  At the moment, the written header info is:
248     *      A vertical listing of
249     *      ode_id/obs_id instance_name_as_seen_in_solver.d UNITS
250     *      then a row (which will line up with printed values)
251     *      of the ode_id/obs_id.
252     */
253    extern void Asc_IntegPrintObsHeader(FILE *fp, IntegratorSystem *blsys);
254    /**<
255     *  Prints observation header info to the file given.
256     *  If FILE is NULL, returns immediately.
257     *  If FILE ok, but blsys NULL prints warning to stderr and returns.
258     *  At the moment header info is:
259     *      A vertical listing of
260     *      ode_id/obs_id instance_name_as_seen_in_solver.d UNITS
261     *      then a row (which will line up with printed values)
262     *      of the ode_id/obs_id.
263     */
264    
265    extern void Asc_IntegPrintYLine(FILE *fp, IntegratorSystem *blsys);
266    /**<
267     *  Prints a Y line to the file given.
268     *  If FILE is NULL, returns immediately.
269     *  If FILE ok, but blsys NULL prints warning to stderr and returns.
270     *  Each line is a set of values, identified by the header, following
271     *  the value of the independent variable. These lines are of arbitrary
272     *  length since it is expected that some other program will be
273     *  reading the output, not a human.
274     */
275    extern void Asc_IntegPrintObsLine(FILE *fp, IntegratorSystem *blsys);
276    /**<
277     *  Prints an observation line to the file given.
278     *  If FILE is NULL, returns immediately.
279     *  If FILE ok, but blsys NULL prints warning to stderr and returns.
280     *  Each line is a set of values, identified by the header, following
281     *  the value of the independent variable. These lines are of arbitrary
282     *  length since it is expected that some other program will be
283     *  reading the output, not a human.
284     */
285    
286    /*---------------------------------------
287      Output reporting interface
288    */
289    
290    /**
291        Returns an IntegratorReporter struct. You are responsible for destroying
292        this struct when you're finished with it.
293    */
294    IntegratorReporter *Asc_GetIntegReporter();
295    int Asc_IntegReporterInit(IntegratorSystem *blsys);
296    int Asc_IntegReporterWrite(IntegratorSystem *blsys);
297    int Asc_IntegReporterWriteObs(IntegratorSystem *blsys);
298    int Asc_IntegReporterClose(IntegratorSystem *blsys);
299    
300    #endif  /* ASCTK_INTEGRATORS_H */
301    
302  /*  /*
303   *  Integrators.h   *  Integrators.h
304   *  by Kirk Abbott and Ben Allan   *  by Kirk Abbott and Ben Allan
# Line 30  Line 331 
331  /** @file  /** @file
332   *  Implementation of the Integration Interface.   *  Implementation of the Integration Interface.
333   *  <pre>   *  <pre>
334   *  Author:       Boyd T. Safrit                                           *  Author:       Boyd T. Safrit
335   *   *
336   *  Changes:  8/95  Added support code for blsode, an   *  Changes:  8/95  Added support code for blsode, an
337   *                  experimental user interface   *                  experimental user interface
# Line 61  Line 362 
362   *  </pre>   *  </pre>
363   */   */
364    
365    <<<<<<< .working
366    =======
367        This program is distributed in the hope that it will be useful,
368        but WITHOUT ANY WARRANTY; without even the implied warranty of
369        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
370        GNU General Public License for more details.
371    
372        You should have received a copy of the GNU General Public License
373        along with this program; if not, write to the Free Software
374        Foundation, Inc., 59 Temple Place - Suite 330,
375        Boston, MA 02111-1307, USA.
376    *//** @file
377        Implementation of the Integration Interface.
378    
379        This module defines the general integration auxillaries for Ascend.
380    
381        Requires
382        #include "tcl.h"
383        #include "utilities/ascConfig.h
384        #include "general/list.h"
385        #include "compiler/instance_enum.h"
386        #include "compiler/dimen.h"
387        #include "solver/slv_client.h"
388        #include "compiler/interface.h"
389        #include <stdio.h>   (for current INTEG_DEBUG functions)
390    *//*
391        Author:       Boyd T. Safrit
392        by Kirk Abbott and Ben Allan
393        Created: 1/94
394        Version: $Revision: 1.16 $
395        Version control file: $RCSfile: Integrators.h,v $
396        Date last modified: $Date: 2003/08/23 18:43:06 $
397        Last modified by: $Author: ballan $
398    
399        Changes:  8/95  Added support code for BLSODE, an
400                        experimental user interface
401                        which identifies states, derivatives,
402                        observations, and tolerances by flags.
403                        Interface redesign (ASCEND side) by
404                        Jennifer Stokes and (C side) Ben Allan.
405                        The only required vector left is that
406                        defining the time steps to calculate
407                        results at. All state and observation
408                        data are (optionally) logged to files.
409                  5/96  Removed old lsode interface routines.
410                        The Piela version of lsode is dead.
411                  8/96  Removed the var == instance assumption from
412                        the implementation.
413    */
414    
415    
416    >>>>>>> .merge-right.r820
417  #ifndef ASCTK_INTEGRATORS_H  #ifndef ASCTK_INTEGRATORS_H
418  #define ASCTK_INTEGRATORS_H  #define ASCTK_INTEGRATORS_H
419    
420  /**  <<<<<<< .working
421    /**
422   *  Define as TRUE to enable debug message printing.   *  Define as TRUE to enable debug message printing.
423   *  @todo this needs to go away.   *  @todo this needs to go away.
424   */   */
425  #define INTEG_DEBUG FALSE  #define INTEG_DEBUG FALSE
426    =======
427    #include <solver/integrator.h>
428    >>>>>>> .merge-right.r820
429  #define print_debug(msg, value) if (INTEG_DEBUG) FPRINTF(stdout, msg, value)  #define print_debug(msg, value) if (INTEG_DEBUG) FPRINTF(stdout, msg, value)
430  /**<  Print a debug message with value if INTEG_DEBUG is TRUE. */  /**<  Print a debug message with value if INTEG_DEBUG is TRUE. */
431  #define print_debugstring(msg) if (INTEG_DEBUG) FPRINTF(stdout, msg)  #define print_debugstring(msg) if (INTEG_DEBUG) FPRINTF(stdout, msg)
432  /**<  Print a debug message string if INTEG_DEBUG is TRUE. */  /**<  Print a debug message string if INTEG_DEBUG is TRUE. */
433    
434    <<<<<<< .working
435  /** The integrators that are supported */  /** The integrators that are supported */
436  enum Integrator_type {  enum Integrator_type {
437    BLSODE,    BLSODE,
# Line 152  extern FILE *Asc_IntegOpenYFile(void); Line 510  extern FILE *Asc_IntegOpenYFile(void);
510   *  variables should be written at each recorded time interval. Other   *  variables should be written at each recorded time interval. Other
511   *  info may be written here as well, but that is up to the designer   *  info may be written here as well, but that is up to the designer
512   *  of the specific integrator interface. The filename used will be   *  of the specific integrator interface. The filename used will be
513   *  the one most recently set via Asc_IntegSetYFileCmd().  If no   *  the one most recently set via Asc_IntegSetYFileCmd().  If no
514   *  name (or an empty name) has been set via Asc_IntegSetYFileCmd(),   *  name (or an empty name) has been set via Asc_IntegSetYFileCmd(),
515   *  the file returned will be NULL.<br><br>   *  the file returned will be NULL.<br><br>
516   *   *
# Line 162  extern FILE *Asc_IntegOpenYFile(void); Line 520  extern FILE *Asc_IntegOpenYFile(void);
520   *  the open time stamped at the bottom. This will separate multiple   *  the open time stamped at the bottom. This will separate multiple
521   *  runs or changes in the same run.<br><br>   *  runs or changes in the same run.<br><br>
522   *   *
523   *  Closing the files is your job.  When finished with the file, you   *  Closing the files is your job.  When finished with the file, you
524   *  should call Asc_IntegReleaseYFile() before closing it.   *  should call Asc_IntegReleaseYFile() before closing it.
525   */   */
526  extern FILE *Asc_IntegOpenObsFile(void);  extern FILE *Asc_IntegOpenObsFile(void);
# Line 171  extern FILE *Asc_IntegOpenObsFile(void); Line 529  extern FILE *Asc_IntegOpenObsFile(void);
529   *  variables should be written at each recorded time interval. Other   *  variables should be written at each recorded time interval. Other
530   *  info may be written here as well, but that is up to the designer   *  info may be written here as well, but that is up to the designer
531   *  of the specific integrator interface. The filename used will be   *  of the specific integrator interface. The filename used will be
532   *  the one most recently set via Asc_IntegSetObsFileCmd().  If no   *  the one most recently set via Asc_IntegSetObsFileCmd().  If no
533   *  name (or an empty name) has been set via Asc_IntegSetObsFileCmd(),   *  name (or an empty name) has been set via Asc_IntegSetObsFileCmd(),
534   *  the file returned will be NULL.<br><br>   *  the file returned will be NULL.<br><br>
535   *   *
# Line 181  extern FILE *Asc_IntegOpenObsFile(void); Line 539  extern FILE *Asc_IntegOpenObsFile(void);
539   *  the open time stamped at the bottom. This will separate multiple   *  the open time stamped at the bottom. This will separate multiple
540   *  runs or changes in the same run.<br><br>   *  runs or changes in the same run.<br><br>
541   *   *
542   *  Closing the files is your job.  When finished with the file, you   *  Closing the files is your job.  When finished with the file, you
543   *  should call Asc_IntegReleaseObsFile() before closing it.   *  should call Asc_IntegReleaseObsFile() before closing it.
544   */   */
545  extern FILE *Asc_IntegGetYFile(void);  extern FILE *Asc_IntegGetYFile(void);
# Line 248  extern void Asc_IntegPrintObsLine(FILE * Line 606  extern void Asc_IntegPrintObsLine(FILE *
606   *  reading the output, not a human.   *  reading the output, not a human.
607   */   */
608    
609    =======
610    >>>>>>> .merge-right.r820
611  extern int Asc_IntegSetYFileCmd(ClientData cdata, Tcl_Interp *interp,  extern int Asc_IntegSetYFileCmd(ClientData cdata, Tcl_Interp *interp,
612                                  int argc, CONST84 char *argv[]);                                  int argc, CONST84 char *argv[]);
613  /**<  /**<
# Line 290  extern int Asc_IntegSetFileFormatCmd(Cli Line 650  extern int Asc_IntegSetFileFormatCmd(Cli
650   *  Registered as: integrate_logformat <fixed,variable>   *  Registered as: integrate_logformat <fixed,variable>
651   */   */
652    
 extern int Asc_IntegSetXSamples(long ns, double *values, dim_type *dimp);  
 /**<  
  *  <!--  Asc_IntegSetXSamples(ns, values, dimp);                      -->  
  *  Sets values of time samples to the values given (ns of them) and  
  *  keeps both the dim pointer and vector given. The vector and dimp  
  *  given may be freed by calling this again, but xsamples owns  
  *  them until then. If called with ns<1 or values==NULL, will free any  
  *  previously captured values/dimp. If called with dimp==NULL, will  
  *  assume WildDimension. Don't call this with a dimp we can't free later.  
  *  Return is 1 if for some reason we can't set as expected, 0 otherwise.  
  */  
   
 extern double Asc_IntegGetStepZero(struct Integ_system_t *sys);  
 /**<  
  *  Returns the length of the initial step user specified,  
  *  or 0.0 if none was set.  
  */  
   
 extern double Asc_IntegGetStepMin(struct Integ_system_t *sys);  
 /**<  
  *  Returns the length of the longest allowable step.  
  *  or 0.0 if none was set by user.  
  */  
   
 extern double Asc_IntegGetStepMax(struct Integ_system_t *sys);  
 /**<  
  *  Returns the length of the shortest allowable step.  
  *  or 0.0 if none was set by user.  
  */  
   
 extern int Asc_IntegGetMaxSteps(struct Integ_system_t *sys);  
 /**<  
  *  Returns the most internal steps allowed between  
  *  two time samples,  or 0 if none was set by user.  
  */  
   
 extern long Asc_IntegGetNSamples(void);  
 /**<  
  *  Returns the number of values currently stored in xsamples.  
  */  
   
 extern double Asc_IntegGetXSamplei(long i);  
 /**<  
  *  Returns the value stored in xsamples[i].  Will whine if  
  *  if xsample[i] does not exist.   No, there is no way to get  
  *  back the pointer to the xsamples vector.  
  */  
 extern void Asc_IntegSetXSamplei(long i, double val);  
 /**<  
  *  Sets the value stored in xsamples[i] to val.  Will whine if  
  *  if xsample[i] does not exist.   No, there is no way to get  
  *  back the pointer to the xsamples vector.  
  */  
653    
 extern dim_type *Asc_IntegGetXSamplesDim(void);  
 /**<  
  *  Returns a pointer to the dimensionality of the samples currently  
  *  stored, or NULL if none are stored. Do not free this pointer: we  
  *  own it.  
  */  
654    
655  extern int Asc_IntegGetXSamplesCmd(ClientData cdata, Tcl_Interp *interp,  extern int Asc_IntegGetXSamplesCmd(ClientData cdata, Tcl_Interp *interp,
656                                     int argc, CONST84 char *argv[]);                                     int argc, CONST84 char *argv[]);
# Line 397  extern int Asc_IntegInstIntegrableCmd(Cl Line 698  extern int Asc_IntegInstIntegrableCmd(Cl
698   *  Registered as:  integrate_able <instance> <NAME>   *  Registered as:  integrate_able <instance> <NAME>
699   */   */
700    
 /*  
  *  The following functions fetch and set parts with names specific to  
  *  the type definitions in ivp.lib, the ASCEND initial value problem  
  *  model file. They are for use by any ivp solver interface.  
  *  All names are given at the scope of ivp.  
  */  
701    
702  /*  extern int Asc_IntegSetupCmd(ClientData cdata,Tcl_Interp *interp,
703   * Problem size parameters.                               int argc, CONST84 char *argv[]);
704   */  /**<
705     *  Set up the integrator.
706  /*   *  itype is one of the supported integrator types (currently:
707   * Parts of type definition derivatives refinements.   *  BLSODE)
708     *  n1 is the start index to run the integrator from.
709     *  n2 is the end index to stop at.
710     *
711     *  Registered as:  integrateSetup itype n1 n2
712   */   */
713    
714  extern double Asc_IntegGetDX(void);  extern int Asc_IntegCleanupCmd(ClientData cdata, Tcl_Interp *interp,
715                                   int argc, CONST84 char *argv[]);
716  /**<  /**<
717   *  <!--  IntegGet_d_x(value)                                          -->   *  Do any C level housekeeping need after calling integration.
718   *  Gets d.x  value.   *  Always use integrate_setup/integrate_cleanup in pairs.<br><br>
719     *
720     *  Registered as:  integrate_cleanup
721   */   */
722    
723  extern void Asc_IntegSetDX(double value);  /*  functions affecting the logging of data during integration */
724    extern FILE *Asc_IntegOpenYFile(void);
725  /**<  /**<
726   *  <!--  IntegSet_d_x(value)                                          -->   *  Returns the pointer to a file to which state
727   *  Sets d.x to value.   *  variables should be written at each recorded time interval. Other
728     *  info may be written here as well, but that is up to the designer
729     *  of the specific integrator interface. The filename used will be
730     *  the one most recently set via Asc_IntegSetYFileCmd().  If no
731     *  name (or an empty name) has been set via Asc_IntegSetYFileCmd(),
732     *  the file returned will be NULL.<br><br>
733     *
734     *  This function may return NULL, in which case do not write to
735     *  them as there was some problem opening the file.
736     *  If opened successfully, the file returned will have DATASET and
737     *  the open time stamped at the bottom. This will separate multiple
738     *  runs or changes in the same run.<br><br>
739     *
740     *  Closing the files is your job.  When finished with the file, you
741     *  should call Asc_IntegReleaseYFile() before closing it.
742   */   */
743    extern FILE *Asc_IntegOpenObsFile(void);
 extern double *Asc_IntegGetDY(double *vector);  
744  /**<  /**<
745   *  <!--  vector=IntegGetDY(vector)                                    -->   *  Returns the pointer to a file to which observation
746   *  Return the vector d.y.   *  variables should be written at each recorded time interval. Other
747   *  If vector given is NULL, allocates vector, which the caller then owns.   *  info may be written here as well, but that is up to the designer
748   *  Vector, if given, should be IntegGet_d_neq()+1 long.   *  of the specific integrator interface. The filename used will be
749     *  the one most recently set via Asc_IntegSetObsFileCmd().  If no
750     *  name (or an empty name) has been set via Asc_IntegSetObsFileCmd(),
751     *  the file returned will be NULL.<br><br>
752     *
753     *  This function may return NULL, in which case do not write to
754     *  them as there was some problem opening the file.
755     *  If opened successfully, the file returned will have DATASET and
756     *  the open time stamped at the bottom. This will separate multiple
757     *  runs or changes in the same run.<br><br>
758     *
759     *  Closing the files is your job.  When finished with the file, you
760     *  should call Asc_IntegReleaseObsFile() before closing it.
761   */   */
762    
763  extern void Asc_IntegSetDY(double *vector);  /**
764        these functions don't involve Tcl/Tk but they do implement stuff
765        in a way that might not be useful to other interfaces.
766    */
767    
768    extern FILE *Asc_IntegGetYFile(void);
769  /**<  /**<
770   *  <!--  IntegSet_d_y(vector)                                         -->   *  Returns the current FILE * for writing state variables,
771   *  Sets d.y[] to values in vector.   *  or NULL if none.
772   */   */
773    extern FILE *Asc_IntegGetObsFile(void);
 extern double *Asc_IntegGetDDydx(double *vector);  
774  /**<  /**<
775   *  <!--  IntegGet_d_dydx(vector)                                      -->   *  Returns the current FILE * for writing observation variables,
776   *  Returns the vector d.dydx.   *  or NULL if none.
  *  If vector given is NULL, allocates vector, which the caller then owns.  
  *  Vector, if given, should be IntegGet_d_neq()+1 long.  
777   */   */
778    extern void Asc_IntegReleaseYFile(void);
779  extern void Asc_IntegSetDDydx(double *vector);  extern void Asc_IntegReleaseObsFile(void);
780  /**<  /**<
781   *  <!--  IntegSet_d_dydx(vector)                                      -->   *  Releases the internally-stored FILE * for observation variables.
782   *  Sets d.dydx[] to values in vector.   *  This does not close the file (which you still need to do).
783     *  This function should be called just before closing the files,
784     *  though it may be called sooner if you want to keep the file pointer
785     *  returned all to yourself.
786   */   */
787    
788  extern double *Asc_IntegGetDObs(double *vector);  
789    extern void Asc_IntegPrintYHeader(FILE *fp, IntegratorSystem *blsys);
790  /**<  /**<
791   *  <!--  IntegGet_d_obs(vector)                                       -->   *  Prints Y header info to the file given.
792   *  Returns the vector d.obs.   *  If FILE is NULL, returns immediately.
793   *  Vector should be of sufficient length (g_intginst_d_n_obs+1).   *  If FILE ok, but blsys NULL prints warning to stderr and returns.
794   *  If NULL is given a vector is allocated and is the caller's   *  At the moment, the written header info is:
795   *  responsibility to deallocate.   *      A vertical listing of
796     *      ode_id/obs_id instance_name_as_seen_in_solver.d UNITS
797     *      then a row (which will line up with printed values)
798     *      of the ode_id/obs_id.
799   */   */
800    extern void Asc_IntegPrintObsHeader(FILE *fp, IntegratorSystem *blsys);
801  /*  /**<
802   *  END of the general ivp type utilities.   *  Prints observation header info to the file given.
803     *  If FILE is NULL, returns immediately.
804     *  If FILE ok, but blsys NULL prints warning to stderr and returns.
805     *  At the moment header info is:
806     *      A vertical listing of
807     *      ode_id/obs_id instance_name_as_seen_in_solver.d UNITS
808     *      then a row (which will line up with printed values)
809     *      of the ode_id/obs_id.
810   */   */
811    
812  extern int Asc_IntegSetupCmd(ClientData cdata,Tcl_Interp *interp,  extern void Asc_IntegPrintYLine(FILE *fp, IntegratorSystem *blsys);
                              int argc, CONST84 char *argv[]);  
813  /**<  /**<
814   *  Set up the integrator.   *  Prints a Y line to the file given.
815   *  itype is one of the supported integrator types (currently:   *  If FILE is NULL, returns immediately.
816   *  BLSODE)   *  If FILE ok, but blsys NULL prints warning to stderr and returns.
817   *  n1 is the start index to run the integrator from.   *  Each line is a set of values, identified by the header, following
818   *  n2 is the end index to stop at.   *  the value of the independent variable. These lines are of arbitrary
819   *   *  length since it is expected that some other program will be
820   *  Registered as:  integrateSetup itype n1 n2   *  reading the output, not a human.
821   */   */
822    extern void Asc_IntegPrintObsLine(FILE *fp, IntegratorSystem *blsys);
 extern int Asc_IntegCleanupCmd(ClientData cdata, Tcl_Interp *interp,  
                                int argc, CONST84 char *argv[]);  
823  /**<  /**<
824   *  Do any C level housekeeping need after calling integration.   *  Prints an observation line to the file given.
825   *  Always use integrate_setup/integrate_cleanup in pairs.<br><br>   *  If FILE is NULL, returns immediately.
826   *   *  If FILE ok, but blsys NULL prints warning to stderr and returns.
827   *  Registered as:  integrate_cleanup   *  Each line is a set of values, identified by the header, following
828     *  the value of the independent variable. These lines are of arbitrary
829     *  length since it is expected that some other program will be
830     *  reading the output, not a human.
831   */   */
832    
833    /*---------------------------------------
834      Output reporting interface
835    */
836    
837    /**
838        Returns an IntegratorReporter struct. You are responsible for destroying
839        this struct when you're finished with it.
840    */
841    IntegratorReporter *Asc_GetIntegReporter();
842    int Asc_IntegReporterInit(IntegratorSystem *blsys);
843    int Asc_IntegReporterWrite(IntegratorSystem *blsys);
844    int Asc_IntegReporterWriteObs(IntegratorSystem *blsys);
845    int Asc_IntegReporterClose(IntegratorSystem *blsys);
846    
847  #endif  /* ASCTK_INTEGRATORS_H */  #endif  /* ASCTK_INTEGRATORS_H */
848    

Legend:
Removed from v.571  
changed lines
  Added in v.670

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