1 |
johnpye |
1194 |
/* ASCEND modelling environment |
2 |
|
|
Copyright (C) 2007 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 |
|
|
*//** @file |
19 |
|
|
Derivative chains for ASCEND solver systems. This structure holds a |
20 |
|
|
reorganised form of the solver lists as for example as follows: |
21 |
|
|
|
22 |
|
|
VARS: |
23 |
|
|
- y1 |
24 |
|
|
- y2 -> y2' |
25 |
|
|
- y3 |
26 |
|
|
- y4 -> y4' -> y4'' |
27 |
|
|
INDEPS: |
28 |
|
|
- t |
29 |
|
|
- x |
30 |
|
|
OBS: |
31 |
|
|
- y2 |
32 |
|
|
- y4' |
33 |
|
|
|
34 |
|
|
This structure will allow efficient construction of integration systems |
35 |
|
|
without any need for the integration engine to 'talk to' the compiler. |
36 |
|
|
It's important that the integration engine need not talk to the compiler, |
37 |
|
|
as we want all this solver-side stuff to work with other 'problem providers' |
38 |
|
|
one day off in the future. |
39 |
|
|
|
40 |
|
|
Note that this stuff is living here in the *solver* and not the *integrator* |
41 |
|
|
directory. This is because the integrator views the problem via a slv_system |
42 |
|
|
structure; in that sense the integrator deals with the ASCEND API through |
43 |
|
|
the solver API, although it interfaces back with the user through a different |
44 |
|
|
API that includes sample timesteps, different reporter mechanisms, etc. |
45 |
|
|
*/ |
46 |
|
|
|
47 |
|
|
#ifndef ASC_DIFFVARS_H |
48 |
|
|
#define ASC_DIFFVARS_H |
49 |
|
|
|
50 |
|
|
#include <utilities/config.h> |
51 |
|
|
#include "analyze.h" |
52 |
|
|
#include "slv_client.h" |
53 |
|
|
|
54 |
johnpye |
1202 |
/** @addtogroup analyse Analyse |
55 |
|
|
@{ |
56 |
|
|
*/ |
57 |
|
|
|
58 |
johnpye |
1194 |
/*------------------------------------------------------------------------------ |
59 |
|
|
Stuff for retrieving differential and derivative variables from the system |
60 |
|
|
*/ |
61 |
|
|
|
62 |
|
|
/** |
63 |
|
|
Structure that holds a differential variable and the sequence of |
64 |
|
|
its derivatives as found explicity in the model. |
65 |
|
|
|
66 |
|
|
For example, |
67 |
|
|
- x, dx/dt |
68 |
|
|
*/ |
69 |
|
|
typedef struct SolverDiffVarSequenceStruct{ |
70 |
|
|
long ode_id; |
71 |
|
|
short n; |
72 |
|
|
struct var_variable **vars; /* will be in order of ascending ode_type, starting from 1 */ |
73 |
|
|
} SolverDiffVarSequence; |
74 |
|
|
|
75 |
|
|
/** |
76 |
|
|
Array of diff var sequences. Once generated, this will hold all of the |
77 |
|
|
This would hold all of the differential and derivative variables found |
78 |
|
|
in the system. For example, with each row being a SolverDiffVarSequence: |
79 |
|
|
- y, dy/dt, d2y/dt2 |
80 |
|
|
- x, dx/dt |
81 |
|
|
- z, dz/dt |
82 |
|
|
*/ |
83 |
|
|
typedef struct SolverDiffVarCollectionStruct{ |
84 |
|
|
SolverDiffVarSequence *seqs; |
85 |
|
|
long nseqs; |
86 |
|
|
long nalg; |
87 |
|
|
long ndiff; |
88 |
|
|
struct var_variable **indep; |
89 |
|
|
long nindep; |
90 |
|
|
struct var_variable **obs; |
91 |
|
|
long nobs; |
92 |
|
|
long maxorder; |
93 |
|
|
} SolverDiffVarCollection; |
94 |
|
|
|
95 |
|
|
#ifdef ASC_IDA_NEW_ANALYSE |
96 |
|
|
/** |
97 |
|
|
Return the SolverDiffVarCollection for the system. You *don't* own the |
98 |
|
|
returned list -- it belongs to the slv_system_t. |
99 |
|
|
*/ |
100 |
|
|
extern const SolverDiffVarCollection *analyse_get_diffvars(slv_system_t sys); |
101 |
|
|
|
102 |
|
|
int analyse_generate_diffvars(slv_system_t sys, struct problem_t *prob); |
103 |
|
|
#endif |
104 |
|
|
|
105 |
|
|
#endif |