1 |
/* 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 |
#include "system.h" |
54 |
|
55 |
/** @addtogroup analyse Analyse |
56 |
@{ |
57 |
*/ |
58 |
|
59 |
struct SolverDiffVarCollectionStruct; |
60 |
/**< |
61 |
This is the structure that contains the 'derivative chains'. It's opaque |
62 |
when viewed at this level (implementation is in system_impl.h) |
63 |
*/ |
64 |
|
65 |
typedef struct SolverDiffVarCollectionStruct SolverDiffVarCollection; |
66 |
/** |
67 |
ditto, @see SolverDiffVarCollectionStruct |
68 |
*/ |
69 |
|
70 |
/*------------------------------------------------------------------------------ |
71 |
Stuff for retrieving differential and derivative variables from the system |
72 |
*/ |
73 |
|
74 |
#ifdef ASC_IDA_NEW_ANALYSE |
75 |
/** |
76 |
Return the SolverDiffVarCollection for the system. You *don't* own the |
77 |
returned list -- it belongs to the slv_system_t. |
78 |
*/ |
79 |
extern SolverDiffVarCollection *system_get_diffvars(slv_system_t sys); |
80 |
|
81 |
int system_diffvars_build(slv_system_t sys, struct problem_t *prob); |
82 |
|
83 |
void system_diffvars_destroy(slv_system_t sys); |
84 |
/** |
85 |
Write contents of diffvars struct to stream fp |
86 |
*/ |
87 |
int system_diffvars_debug(slv_system_t sys,FILE *fp); |
88 |
|
89 |
|
90 |
/** |
91 |
Reorder the diffvars list to match the var_sindex values of the first |
92 |
var in each chain. |
93 |
*/ |
94 |
int system_diffvars_sort(slv_system_t sys); |
95 |
|
96 |
#endif |
97 |
|
98 |
#endif |