File: sciConfig.tcl

package info (click to toggle)
scilab 5.2.2-9
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 334,832 kB
  • ctags: 52,586
  • sloc: xml: 526,945; ansic: 223,590; fortran: 163,080; java: 56,934; cpp: 33,840; tcl: 27,936; sh: 20,397; makefile: 9,908; ml: 9,451; perl: 1,323; cs: 614; lisp: 30
file content (240 lines) | stat: -rw-r--r-- 11,658 bytes parent folder | download | duplicates (4)
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# sciConfig.tcl
# Configure scilab
# This file is part of sciGUI toolbox
# Copyright (C) 2004 Jaime Urzua Grez
# mailto:jaime_urzua@yahoo.com
# rev. 0.1 


# ----------------------------------------------------------------------------
# Function    : sciGUIConfigQuit
# Parameters  : winId 
# Description : 
# ----------------------------------------------------------------------------
proc sciGUIConfigQuit { winId } {
	global sciGUITable
	set name { ssize gsize ieee formatmode formatmode_wid lineslin linescol itask tcrit h0 hmax hmin jactype mxstep maxordn maxords ixpr ml mu }
	foreach q $name {
		unset sciGUITable(win,$winId,data,$q)
	}
	sciGUIDestroy $winId
	
}


# ----------------------------------------------------------------------------
# Function    : sciGUIConfigDo
# Parameters  : winId 
# Description : 
# ----------------------------------------------------------------------------
proc sciGUIConfigDo { winId } {
	global sciGUITable
	set cmd ""
	append cmd "stacksize($sciGUITable(win,$winId,data,ssize));"
	append cmd "gstacksize($sciGUITable(win,$winId,data,gsize));"
	append cmd "ieee([string range $sciGUITable(win,$winId,data,ieee) 0 0 ]);"
	append cmd "format(\'[string range $sciGUITable(win,$winId,data,formatmode) 0 0 ]\',$sciGUITable(win,$winId,data,formatmode_wid));"
	append cmd "lines($sciGUITable(win,$winId,data,lineslin),$sciGUITable(win,$winId,data,linescol));"
	            
	set defode "1 0 0 %inf 0 2 500 12 5 0 -1 -1"
	set newode ""
	append newode "[string range $sciGUITable(win,$winId,data,itask) 0 0] "
	append newode "$sciGUITable(win,$winId,data,tcrit) "
	append newode "$sciGUITable(win,$winId,data,h0) "
	append newode "$sciGUITable(win,$winId,data,hmax) "
	append newode "$sciGUITable(win,$winId,data,hmin) "
	append newode "[string range $sciGUITable(win,$winId,data,jactype) 0 0] "
	append newode "$sciGUITable(win,$winId,data,mxstep) "
	append newode "$sciGUITable(win,$winId,data,maxordn) "
	append newode "$sciGUITable(win,$winId,data,maxords) "
	append newode "[string range $sciGUITable(win,$winId,data,ixpr) 0 0] "
	append newode "$sciGUITable(win,$winId,data,ml) "
	append newode "$sciGUITable(win,$winId,data,mu)"
	if { "$newode"!="$defode" } {
		append cmd "\%ODEOPTIONS=\[" "$newode" "\];"		
	} else {
		append cmd "clear \%ODEOPTIONS;"
	}
	ScilabEval "$cmd"	
}
# ----------------------------------------------------------------------------
# Function    : sciGUIConfig
# Parameters  : winId parameters
# Description : Configure Scilab...
# ----------------------------------------------------------------------------
proc sciGUIConfig { {winId -1} {parameters "1000000 1240 0 v 10 28 72 1 0 0 %inf 0 2 500 12 5 0 -1 -1"} } {
	global sciGUITable
	set winId2 [sciGUICreate $winId "editvar" ]
	set w [sciGUIName $winId2]
	wm title $w "Scilab Configuration ($winId2)"
	wm protocol $w WM_DELETE_WINDOW "sciGUIConfigQuit $winId2"
	wm geometry $w 450x450
	$w configure -background white
	
	frame $w.top -bd 0 -background white
	label $w.top.logo -image sciGUITable(gif,scilab01) -bg white
	label $w.top.mes01 -text "Scilab Configuration" -font $sciGUITable(font,1) -bg white

	pack $w.top.logo -side left
	pack $w.top.mes01 -side right	
	pack $w.top -side top -fill x -expand 0
	
	frame $w.cen
	Rnotebook:create $w.cen.book -tabs {Display Stack "ODE options"} -borderwidth 2
	pack $w.cen -side top -fill both -expand 1
	pack $w.cen.book -fill both -expand 1 -padx 10 -pady 10
	
	frame $w.bot
	button $w.bot.apply  -text "Apply" -width 10 -command "sciGUIConfigDo $winId2"
	button $w.bot.cancel -text "Cancel" -width 10 -command "sciGUIConfigQuit $winId2"
	pack $w.bot -side top -fill x -expand 0
	pack $w.bot.apply $w.bot.cancel -side left -padx 10 -pady 5 -expand 0 -fill x
	
	###
	set sciGUITable(win,$winId2,data,ssize) [lindex $parameters 0]
	set sciGUITable(win,$winId2,data,gsize) [lindex $parameters 1]
	set ieemodes "{0: floating point exception produce an error} {1: floating point exception produce a warning} {2: floating point exception procudes Inf or Nan}"
	set sciGUITable(win,$winId2,data,ieee) [lindex $ieemodes [lindex $parameters 2]]
	set formatmodes "{v:variable format} {e:e-format}"
	if {[lindex $parameters 3]=="v"} { 
		set sciGUITable(win,$winId2,data,formatmode) [lindex $formatmodes 0]
	} else {
		set sciGUITable(win,$winId2,data,formatmode) [lindex $formatmodes 1]
	}
	set sciGUITable(win,$winId2,data,formatmode_wid) [lindex $parameters 4]
	set sciGUITable(win,$winId2,data,lineslin) [lindex $parameters 5]
	set sciGUITable(win,$winId2,data,linescol) [lindex $parameters 6]
	set itask "{1: normal computation at specified times} {2: computation at mesh points} {3: one step at one internal mesh point and return} {4: normal computation without overshooting tcrit} {5: one step, without passing  tcrit , and return}"
	set sciGUITable(win,$winId2,data,itask) [lindex $itask [expr [lindex $parameters 7] - 1] ]
	set sciGUITable(win,$winId2,data,tcrit) [lindex $parameters 8]
	set sciGUITable(win,$winId2,data,h0) [lindex $parameters 9]
	set sciGUITable(win,$winId2,data,hmax) [lindex $parameters 10]
	set sciGUITable(win,$winId2,data,hmin) [lindex $parameters 11]
	set jactype "{0: functional iterations, no jacobian used (adams or stiff only)} {1: user-supplied full jacobian} {2: internally generated full jacobian} {3: internally generated diagonal jacobian (adams or stiff only)} {4: user-supplied banded jacobian (see ml and mu below)} {5: internally generated banded jacobian (see ml and mu below)}"
	set sciGUITable(win,$winId2,data,jactype) [lindex $jactype [lindex $parameters 12]]
	set sciGUITable(win,$winId2,data,mxstep) [lindex $parameters 13]
	set sciGUITable(win,$winId2,data,maxordn) [lindex $parameters 14]
	set sciGUITable(win,$winId2,data,maxords) [lindex $parameters 15]
	set sciGUITable(win,$winId2,data,ixpr) [lindex $parameters 16]
	set sciGUITable(win,$winId2,data,ml) [lindex $parameters 17]
	set sciGUITable(win,$winId2,data,mu) [lindex $parameters 18]
	
	### DISPLAY
	set wt1 [Rnotebook:frame $w.cen.book 1]
	frame $wt1.f1
	label $wt1.f1.ieetxt -text "Floating point exception :"
	combobox::combobox $wt1.f1.ieee -borderwidth 1 -textvariable sciGUITable(win,$winId2,data,ieee) -editable false -highlightthickness 0 -width 40 	
	eval $wt1.f1.ieee list insert end $ieemodes
	pack $wt1.f1.ieetxt $wt1.f1.ieee -side left -fill x -expand 0
	pack $wt1.f1 -side top -expand 0 -fill both -pady 5

	frame $wt1.f2
	label $wt1.f2.formatmodetxt -text "Printing Format :"
	combobox::combobox $wt1.f2.formatmode -borderwidth 1 -textvariable sciGUITable(win,$winId2,data,formatmode) -editable false -highlightthickness 0 -width 15
	eval $wt1.f2.formatmode list insert end $formatmodes
	label $wt1.f2.formatmodewidthtxt -text "width :"
	entry $wt1.f2.formatmodewidth -width 5 -textvariable sciGUITable(win,$winId2,data,formatmode_wid)
	pack $wt1.f2.formatmodetxt $wt1.f2.formatmode $wt1.f2.formatmodewidthtxt $wt1.f2.formatmodewidth -side left -fill x -expand 0
	pack $wt1.f2 -side top -expand 0 -fill both -pady 5

	frame $wt1.f3
	label $wt1.f3.lineslintxt -text "Lines to display :"
	entry $wt1.f3.lineslin -textvariable sciGUITable(win,$winId2,data,lineslin) -width 5
	label $wt1.f3.linescoltxt -text "Columns to display :"
	entry $wt1.f3.linescol -textvariable sciGUITable(win,$winId2,data,linescol) -width 5
	pack $wt1.f3.lineslintxt $wt1.f3.lineslin $wt1.f3.linescoltxt $wt1.f3.linescol -side left -fill x -expand 0
	pack $wt1.f3 -side top -expand 0 -fill both -pady 5
	
	### STACK
	set wt2 [Rnotebook:frame $w.cen.book 2]	
	label $wt2.ssizetx -text "Stack Size :" 
	label $wt2.gsizetx -text "Global Stack Size :"
	entry $wt2.ssize -width 10 -textvariable sciGUITable(win,$winId2,data,ssize)
	entry $wt2.gsize -width 10 -textvariable sciGUITable(win,$winId2,data,gsize)
	grid config $wt2.ssizetx -column 0 -row 0 -sticky "e"
	grid config $wt2.ssize -column 1 -row 0 -sticky "w"
	grid config $wt2.gsizetx -column 0 -row 1 -sticky "e"
	grid config $wt2.gsize -column 1 -row 1 -sticky "w"

	### ODEOPTIONS
	set wt3 [Rnotebook:frame $w.cen.book 3]	
	frame $wt3.f1
	label $wt3.f1.itasktxt -text "itask :"
	combobox::combobox $wt3.f1.formatmode -borderwidth 1 -textvariable sciGUITable(win,$winId2,data,itask) -editable false -highlightthickness 0 -width 40
	eval $wt3.f1.formatmode list insert end $itask
	pack $wt3.f1.itasktxt $wt3.f1.formatmode -side left -fill x -expand 0
	pack $wt3.f1 -side top -expand 0 -fill both -pady 2

	frame $wt3.f2
	label $wt3.f2.tcrittxt -text "tcrit ( itask==4 | itask==5) :"
	entry $wt3.f2.tcrit -textvariable sciGUITable(win,$winId2,data,tcrit) -width 10
	pack $wt3.f2.tcrittxt $wt3.f2.tcrit -side left -fill x -expand 0
	pack $wt3.f2 -side top -expand 0 -fill both -pady 2

	frame $wt3.f3
	label $wt3.f3.h0txt -text "First step tried (h0):"
	entry $wt3.f3.h0 -textvariable sciGUITable(win,$winId2,data,h0) -width 10
	pack $wt3.f3.h0txt $wt3.f3.h0 -side left -fill x -expand 0
	pack $wt3.f3 -side top -expand 0 -fill both -pady 2

	frame $wt3.f4
	label $wt3.f4.hmaxtxt -text "Max step size (hmax):"
	entry $wt3.f4.hmax -textvariable sciGUITable(win,$winId2,data,hmax) -width 10
	pack $wt3.f4.hmaxtxt $wt3.f4.hmax -side left -fill x -expand 0
	pack $wt3.f4 -side top -expand 0 -fill both -pady 2

	frame $wt3.f5
	label $wt3.f5.hmintxt -text "Min step size (hmin):"
	entry $wt3.f5.hmin -textvariable sciGUITable(win,$winId2,data,hmin) -width 10
	pack $wt3.f5.hmintxt $wt3.f5.hmin -side left -fill x -expand 0
	pack $wt3.f5 -side top -expand 0 -fill both -pady 2

	frame $wt3.f6
	label $wt3.f6.jactypetxt -text "jactype:"
	combobox::combobox $wt3.f6.jactype -borderwidth 1 -textvariable sciGUITable(win,$winId2,data,jactype) -editable false -highlightthickness 0 -width 50
	eval $wt3.f6.jactype list insert end $jactype
	pack $wt3.f6.jactypetxt $wt3.f6.jactype -side left -fill x -expand 0
	pack $wt3.f6 -side top -expand 0 -fill both -pady 2
	
	frame $wt3.f7
	label $wt3.f7.mxsteptxt -text "Max number of steps allowed (mxstep):"
	entry $wt3.f7.mxstep -textvariable sciGUITable(win,$winId2,data,mxstep) -width 10
	pack  $wt3.f7.mxsteptxt $wt3.f7.mxstep -side left -fill x -expand 0
	pack $wt3.f7 -side top -expand 0 -fill both -pady 2

	frame $wt3.f8
	label $wt3.f8.maxordntxt -text "Maximum non-stiff order allowed, at most 12 (maxordn):"
	entry $wt3.f8.maxordn -textvariable sciGUITable(win,$winId2,data,maxordn) -width 10
	pack  $wt3.f8.maxordntxt $wt3.f8.maxordn -side left -fill x -expand 0
	pack $wt3.f8 -side top -expand 0 -fill both -pady 2


	frame $wt3.f9
	label $wt3.f9.maxordstxt -text "Maximum stiff order allowed, at most 5 (maxords):"
	entry $wt3.f9.maxords -textvariable sciGUITable(win,$winId2,data,maxords) -width 10
	pack  $wt3.f9.maxordstxt $wt3.f9.maxords -side left -fill x -expand 0
	pack $wt3.f9 -side top -expand 0 -fill both -pady 2

	frame $wt3.f10
	label $wt3.f10.ixprtxt -text "Print level (ixpr):"
	combobox::combobox $wt3.f10.ixpr -borderwidth 1 -textvariable sciGUITable(win,$winId2,data,ixpr) -editable false -highlightthickness 0 -width 2
	eval $wt3.f10.ixpr list insert end "0 1"
	pack  $wt3.f10.ixprtxt $wt3.f10.ixpr -side left -fill x -expand 0
	pack $wt3.f10 -side top -expand 0 -fill both -pady 2

	frame $wt3.f11
	label $wt3.f11.mltxt -text "ml:"
	entry $wt3.f11.ml -textvariable sciGUITable(win,$winId2,data,ml) -width 10
	pack  $wt3.f11.mltxt $wt3.f11.ml -side left -fill x -expand 0
	pack $wt3.f11 -side top -expand 0 -fill both -pady 2

	frame $wt3.f12
	label $wt3.f12.mutxt -text "mu:"
	entry $wt3.f12.mu -textvariable sciGUITable(win,$winId2,data,mu) -width 10
	pack  $wt3.f12.mutxt $wt3.f12.mu -side left -fill x -expand 0
	pack $wt3.f12 -side top -expand 0 -fill both -pady 2

	
}