1 |
/* ASCEND modelling environment |
2 |
Copyright (C) 2006 Carnegie Mellon University |
3 |
|
4 |
This program is free software; you can redistribute it and/or modify |
5 |
it under the terms of the GNU General Public License as published by |
6 |
the Free Software Foundation; either version 2, or (at your option) |
7 |
any later version. |
8 |
|
9 |
This program is distributed in the hope that it will be useful, |
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
GNU General Public License for more details. |
13 |
|
14 |
You should have received a copy of the GNU General Public License |
15 |
along with this program; if not, write to the Free Software |
16 |
Foundation, Inc., 59 Temple Place - Suite 330, |
17 |
Boston, MA 02111-1307, USA. |
18 |
*//** |
19 |
@file |
20 |
Sample list for ASCEND integrator. Keeps a list of sample times |
21 |
for which model data will be computed during the integration. |
22 |
|
23 |
Will include functions to initialise various kinds of sample |
24 |
vectors, from linear-spaced to log-spaced, etc. |
25 |
|
26 |
This is a nicely self-contained 'class' that can be wrapped up and |
27 |
interfaced with SWIG/C++ for the PyGTK interface, and interfaced via |
28 |
the current functions in Integrators.c for the needs of the Tcl/Tk GUI. |
29 |
*//* |
30 |
by John Pye, May 2006. |
31 |
*/ |
32 |
|
33 |
#ifndef ASC_SAMPLELIST_H |
34 |
#define ASC_SAMPLELIST_H |
35 |
|
36 |
/** @addtogroup integrator Integrator |
37 |
@{ |
38 |
*/ |
39 |
|
40 |
#include <ascend/utilities/ascConfig.h> |
41 |
#include <ascend/compiler/fractions.h> |
42 |
#include <ascend/compiler/compiler.h> |
43 |
#include <ascend/compiler/dimen.h> |
44 |
|
45 |
/** An array of sample 'times' for reference during integration */ |
46 |
struct SampleList_struct { |
47 |
long ns; |
48 |
double *x; |
49 |
const dim_type *d; |
50 |
}; |
51 |
|
52 |
typedef struct SampleList_struct SampleList; |
53 |
|
54 |
ASC_DLLSPEC void samplelist_free(SampleList *); |
55 |
|
56 |
ASC_DLLSPEC SampleList *samplelist_new(unsigned long n, const dim_type *d); |
57 |
|
58 |
/* assign to a SampleList, freeing stuff if there's some there. */ |
59 |
|
60 |
ASC_DLLSPEC int samplelist_assign(SampleList *l, unsigned long n, double *values, const dim_type *d); |
61 |
|
62 |
ASC_DLLSPEC long samplelist_length(CONST SampleList *l); |
63 |
ASC_DLLSPEC const dim_type *samplelist_dim(CONST SampleList *l); |
64 |
|
65 |
/** |
66 |
Get an element from the samplelist. Value of the index i should be in [0,ns). |
67 |
*/ |
68 |
ASC_DLLSPEC double samplelist_get(CONST SampleList *l, CONST long i); |
69 |
ASC_DLLSPEC void samplelist_set(CONST SampleList *l, CONST long i, CONST double x); |
70 |
|
71 |
void samplelist_debug(CONST SampleList *l); |
72 |
|
73 |
/* @} */ |
74 |
|
75 |
#endif |