File: node63.html

package info (click to toggle)
dstooltk-doc 2.0-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 4,024 kB
  • ctags: 451
  • sloc: perl: 753; makefile: 49; sh: 8
file content (211 lines) | stat: -rw-r--r-- 8,802 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 98.1p1 release (March 2nd, 1998)
originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Installing a Defined Dynamical System</TITLE>
<META NAME="description" CONTENT="Installing a Defined Dynamical System">
<META NAME="keywords" CONTENT="userman">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="userman.css">
<LINK REL="previous" HREF="node57.html">
<LINK REL="up" HREF="node52.html">
<LINK REL="next" HREF="node64.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html1314"
 HREF="node64.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="/usr/lib/latex2html/icons.gif/next_motif.gif"></A> 
<A NAME="tex2html1311"
 HREF="node52.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="/usr/lib/latex2html/icons.gif/up_motif.gif"></A> 
<A NAME="tex2html1307"
 HREF="node62.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="/usr/lib/latex2html/icons.gif/previous_motif.gif"></A> 
<A NAME="tex2html1313"
 HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
 SRC="/usr/lib/latex2html/icons.gif/contents_motif.gif"></A>  
<BR>
<B> Next:</B> <A NAME="tex2html1315"
 HREF="node64.html">A Vector Field Example:</A>
<B> Up:</B> <A NAME="tex2html1312"
 HREF="node52.html">Installing a New Dynamical</A>
<B> Previous:</B> <A NAME="tex2html1308"
 HREF="node62.html">Numerical Algorithms</A>
<BR>
<BR>
<!--End of Navigation Panel-->

<H2><A NAME="SECTION00626000000000000000">&#160;</A><A NAME="install_sys">&#160;</A><A NAME="2144">&#160;</A><A NAME="2145">&#160;</A>
<BR>
Installing a Defined Dynamical System
</H2>
It is assumed that the reader has completed the steps in the preceding sections of this chapter.
In this section, we describe the installation of the dynamical system  defined using the
above  steps.  As an  illustration, we continue with the bouncing ball example.

<P>
Our first task is to modify the file user.c.  There are two steps to this process: 
<UL>
<LI>Inform DsTool about the name of the initialization routine for the dynamical system we
desire to install.  In our bouncing ball example, this function is  bball_init().
<LI>Enter this name into the DsTool list of dynamical systems, along with a title.
</UL>
<P>
During the execution of DsTool, the user may select one of several installed dynamical systems.
The program maintains a list of installed models, along with the procedures which initialize
and define them.  
The user-defined models are maintained in the 
file user.c of the user's local DsTool directory.  This file contains 
three relevant blocks of C code: the first block defines an array of categories used to collect dynamical systems
into related classes, the second consists of several lines beginning with the declaration
extern&nbsp;int, the last block is a C-language structure which contains titles for the 
models along with names of the models' initialization procedures.  The relevant pieces
of the file user.c
delivered with DsTool contain the following code:
<PRE>
/* ----------------------------------------------------------------
 * INCLUDE USER DYNAMICAL SYSTEMS CATEGORIES HERE
 *
 * ----------------------------------------------------------------
 */
char *USER_DS_Category[] = { "User models" /* Category 0 */
                           };
 
/* ----------------------------------------------------------------
 * INCLUDE USER DYNAMICAL SYSTEM NAMES HERE
 *
 * We have put in the Lorenz system as an example
 * ----------------------------------------------------------------
 */
 
/* declare the model initialization procedure here */
extern int lorenz_init();
 
 
/* list the category, a short model name, and the initialization proc here */
struct DS_DataS USER_DS_Sel[]= {
  { 0, "Lorenz system", lorenz_init }
};
</PRE>

<P>
To tell DsTool the name of the initialization routine which defines our bouncing ball model,
we need to add the line
<PRE>
extern int  bball_init();
</PRE>
to the second block of code in  user.c. 
To install our model, we replace the line of code
<PRE>
  { 0, "Lorenz system", lorenz_init }
</PRE>
with the line of code
<PRE>
  { 0, "Bouncing Ball", bball_init }
</PRE>
in the definition of the data structure USER_DS_Sel within the third block of code.  
The variable USER_DS_Sel is an array, each element of which is a 
data structure which defines a dynamical system.  The first element of the structure is 
a number which specifies the user category
to which the dynamical system belongs.  The category is
used to group together systems which share similar properties.  
These categories are defined in the first block of code.
Users cannot add dynamical systems to the standard list of categories.
However, they can create as many new categories as they wish, by modifying the category list like so:
<PRE>
char *USER_DS_Category[] = { "User models", /* Category 0 */
                             "Project with Bob", /* Category 1 */
                             "My favorite dynamical systems" /* Category 2 */
                           };
</PRE>
This array provides the title for each category.  For our example, the category index is 0, so our bouncing ball
model belongs to the category named ``User models.''  (Recall
that arrays in C are indexed from
0 so DS_Category[0] is not an invalid array index.)  Every dynamical 
system must belong to a valid category.  

<P>
The next element of the dynamical system data structure is the title of the system being defined.
We have chosen ``Bouncing Ball'' as the title of our system.  Any descriptive title will do, provided
that the length of the title is not larger than the global constant MAX_LEN_DS_TITLE.
The value of this constant is found in the  file $DSTOOL/src/include/constants.h.

<P>
The last element is the name of the function which contains the initialization routine
for the new dynamical system.  For our example, the name is bball_init.

<P>
Note that each dynamical system data structure must be enclosed by braces and followed
by a comma.  That is, all except the last.  The last element in the array of dynamical systems
(our new dynamical system ``Bouncing Ball'' in our example code) should not have a trailing comma.

<P>
We are now ready to compile the source code we have written.
To do this, edit the Makefile in your local DsTool directory.
Add the file bball_def.c to the USER_SRCS
list of files, and the file bball_def.o to the USER_OBJS list of files.
In the example described above, the corresponding Makefile entry would be:
<PRE>
        USER_SRCS = user.c bball_def.c
        USER_OBJS = user.o bball_def.o
</PRE>
Now save and exit the Makefile. 

<P>
If our model compiles without errors, we can create a custom version of DsTool
called my_dstool.  To do this, execute the command make in your
local DsTool directory.  

<P>
Once this is done, you can ensure that this version of DsTool is executed by settting
the UNIX environmental variable MY_DSTOOL to your local DsTool directory.  
When the script dstool_tk is run from any directory, it will execute the binary 
$MY_DSTOOL/bin/$ARCH/my_dstool.  A message will be printed confirming which binary
is being executed.
This version of DsTool will include the bouncing ball equations among its installed dynamical
systems.

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1314"
 HREF="node64.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="/usr/lib/latex2html/icons.gif/next_motif.gif"></A> 
<A NAME="tex2html1311"
 HREF="node52.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="/usr/lib/latex2html/icons.gif/up_motif.gif"></A> 
<A NAME="tex2html1307"
 HREF="node62.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="/usr/lib/latex2html/icons.gif/previous_motif.gif"></A> 
<A NAME="tex2html1313"
 HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
 SRC="/usr/lib/latex2html/icons.gif/contents_motif.gif"></A>  
<BR>
<B> Next:</B> <A NAME="tex2html1315"
 HREF="node64.html">A Vector Field Example:</A>
<B> Up:</B> <A NAME="tex2html1312"
 HREF="node52.html">Installing a New Dynamical</A>
<B> Previous:</B> <A NAME="tex2html1308"
 HREF="node62.html">Numerical Algorithms</A>
<!--End of Navigation Panel-->
<ADDRESS>
<I>John Lapeyre</I>
<BR><I>1998-09-04</I>
</ADDRESS>
</BODY>
</HTML>