/usr/share/elmerpost/tcl/vectors.tcl is in elmer-common 6.1.0.svn.5396.dfsg2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | #/*****************************************************************************
# *
# * Elmer, A Finite Element Software for Multiphysical Problems
# *
# * Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland
# *
# * This program is free software; you can redistribute it and/or
# * modify it under the terms of the GNU General Public License
# * as published by the Free Software Foundation; either version 2
# * of the License, or (at your option) any later version.
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program (in file fem/GPL-2); if not, write to the
# * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# * Boston, MA 02110-1301, USA.
# *
# *****************************************************************************/
#*******************************************************************************
#*
#* Vectors display parameter settings
#*
#*******************************************************************************
#*
#* Author: Juha Ruokolainen
#*
#* Address: CSC - IT Center for Science Ltd.
#* Keilaranta 14, P.O. BOX 405
#* 02101 Espoo, Finland
#* Tel. +358 0 457 2723
#* Telefax: +358 0 457 2302
#* EMail: Juha.Ruokolainen@csc.fi
#*
#* Date: 26 Sep 1995
#*
#* Modified by:
#*
#* Date of modification:
#*
#*******************************************************************************
#
#
#
# 23 Apr 1996
#
set VectorLineStyle 0
set VectorQuality 1
set VectorRadius 1
set VectorLength "none"
set VectorColor "none"
set VectorArrow "none"
set VectorThreshold "none"
set VectorFloor "0.0"
set VectorCeiling "1.0"
set VectorLengthScale 1.0
set VectorThresholdMin 0.0
set VectorThresholdMax 1.0
set VectorVariableNames(0) "none"
set NumberOfVectorVariables 1
set scalar "none"
set vector "none"
set vceil 100.0
set vfloor 0.0
proc get_scalar_variable { w } {
global scalar
set scalar [$w get [$w curselection]]
}
proc get_vector_variable { w } {
global vector
set vector [$w get [$w curselection]]
}
proc vector_set_ceil { vceil } {
global VectorCeiling VectorThresholdMin VectorThresholdMax
set a [@ ($VectorThresholdMax-$VectorThresholdMin)*$vceil/100.0+$VectorThresholdMin]
set VectorCeiling $a
}
proc vector_set_floor { vfloor } {
global VectorFloor VectorThresholdMin VectorThresholdMax
set a [@ ($VectorThresholdMax-$VectorThresholdMin)*$vfloor/100.0+$VectorThresholdMin]
set VectorFloor $a
}
proc vector_set_vceil { } {
global VectorCeiling VectorThresholdMin VectorThresholdMax vceil
set vceil [@ 100*($VectorCeiling-$VectorThresholdMin)/($VectorThresholdMax-$VectorThresholdMin)]
set vceil [@ $vceil<0.0?0.0:$vceil]
set vceil [@ $vceil>100.0?100.0:$vceil]
}
proc vector_set_vfloor { } {
global VectorFloor VectorThresholdMin VectorThresholdMax vfloor
set vfloor [@ 100*($VectorFloor-$VectorThresholdMin)/($VectorThresholdMax-$VectorThresholdMin)]
set vfloor [@ $vfloor<0.0?0.0:$vfloor]
set vfloor [@ $vfloor>100.0?100.0:$vfloor]
}
#
# List box containing scalar variable names
#
proc make_scalar_list { } {
global ScalarVariableNames NumberOfScalarVariables scalar savescalar
if { ![info exists ScalarVariableNames] } { return }
set savescalar $scalar
toplevel .vlist
place_window .vlist
frame .vlist.vari -relief sunken -bg lightblue
listbox .vlist.vari.list -yscroll ".vlist.vari.scroll set"
scrollbar .vlist.vari.scroll -command ".vlist.vari.list yview"
pack .vlist.vari.list -side left -fill y
pack .vlist.vari.scroll -side left -expand 1 -fill both
pack .vlist.vari -side top -expand 1 -fill both
bind .vlist.vari.list <Double-1> { set scalar [get_scalar_variable %W] }
frame .vlist.equ
label .vlist.equ.label -text "math: "
entry .vlist.equ.entry -width 20 -relief sunken -textvariable mathcmd
pack .vlist.equ -side top
pack .vlist.equ.label -side left
pack .vlist.equ.entry -side left -fill x
bind .vlist.equ.entry <Return> { math $mathcmd; set scalar "tryagain"; }
frame .vlist.close
button .vlist.close.ok -text "OK" -command { set scalar [get_scalar_variable .vlist.vari.list] }
button .vlist.close.cancel -text "Cancel" -command { set scalar $savescalar; }
pack .vlist.close -side top
pack .vlist.close.ok -side right
pack .vlist.close.cancel -side right
set oldfocus [focus]
set scalar "tryagain"
while { $scalar == "tryagain" } {
.vlist.vari.list delete 0 end
.vlist.vari.list insert end none
do i 0 [@ $NumberOfScalarVariables-1] {
set val $ScalarVariableNames($i)
.vlist.vari.list insert end $val
}
vwait scalar
}
focus $oldfocus
destroy .vlist
return $scalar
}
#
# List box containing vector variable names
#
proc make_vector_list { } {
global VectorVariableNames NumberOfVectorVariables vector savevector
if { ![info exists VectorVariableNames] } { return }
set savevector $vector
toplevel .vlist
place_window .vlist
frame .vlist.vari -relief sunken -bg lightblue
listbox .vlist.vari.list -yscroll ".vlist.vari.scroll set"
scrollbar .vlist.vari.scroll -command ".vlist.vari.list yview"
pack .vlist.vari.list -side left -fill y
pack .vlist.vari.scroll -side left -expand 1 -fill both
pack .vlist.vari -side top -expand 1 -fill both
bind .vlist.vari.list <Double-1> { get_vector_variable %W }
frame .vlist.equ
label .vlist.equ.label -text "math: "
entry .vlist.equ.entry -width 20 -relief sunken -textvariable mathcmd
pack .vlist.equ -side top
pack .vlist.equ.label -side left
pack .vlist.equ.entry -side left -fill x
bind .vlist.equ.entry <Return> { math $mathcmd; set vector "tryagain" }
frame .vlist.close
button .vlist.close.ok -text "OK" -command { set vector [get_vector_variable .vlist.vari.list] }
button .vlist.close.cancel -text "Cancel" -command { set vector $savevector; }
pack .vlist.close -side top
pack .vlist.close.ok -side right
pack .vlist.close.cancel -side right
set oldfocus [focus]
set vector "tryagain"
while { $vector == "tryagain" } {
.vlist.vari.list delete 0 end
.vlist.vari.list insert end none
do i 0 [@ $NumberOfVectorVariables-1] {
set val $VectorVariableNames($i)
.vlist.vari.list insert end $val
}
vwait vector
}
focus $oldfocus
destroy .vlist
return $vector
}
proc vector_edit { } {
global VectorLines VectorLineStyle VectorQuality VectorRadius
global VectorColor VectorArrow VectorLength VectorLengthScale
global VectorThreshold VectorFloor VectorCeiling
global vceil vfloor
if { [winfo exists .vector] } {
wm iconify .vector
wm deiconify .vector
return
}
toplevel .vector
place_window .vector
#
# length style
#
frame .vector.scale
label .vector.scale.label -text "Vector Length Scale: "
slider .vector.scale.slider -relief raised -bd 2 -orient horizontal \
-from 0.0 -to 10.0 -resol 0.02 -digits 4 -variable VectorLengthScale
pack .vector.scale -side top
pack .vector.scale.label -side left
pack .vector.scale.slider -side left -fill x
#
# line style
#
frame .vector.line
label .vector.line.label -text "Line Style: "
radiobutton .vector.line.line -value 0 -variable VectorLineStyle -text "Line"
radiobutton .vector.line.cyli -value 1 -variable VectorLineStyle -text "Solid"
pack .vector.line -side top
pack .vector.line.label -side left
pack .vector.line.line -side left -fill x
pack .vector.line.cyli -side left -fill x
#
# cyl qual
#
frame .vector.qual
label .vector.qual.label -text "Line Quality: "
entry .vector.qual.entry -relief sunken -width 5 -textvariable VectorQuality
pack .vector.qual -side top
pack .vector.qual.label -side left
pack .vector.qual.entry -side left -fill x
#
# cyl rad
#
frame .vector.radi
label .vector.radi.label -text "Width Scale: "
entry .vector.radi.entry -relief sunken -width 5 -textvariable VectorRadius
pack .vector.radi -side top
pack .vector.radi.label -side left
pack .vector.radi.entry -side left -fill x
#
# threshold
#
frame .vector.thres
label .vector.thres.label -text "Threshold Variable: "
button .vector.thres.but -textvariable VectorThreshold \
-command { set VectorThreshold [make_scalar_list]; \
UpdateVariable "VectorThreshold"; \
vector_set_floor $vfloor; vector_set_ceil $vceil }
UpdateVariable "VectorThreshold"
vector_set_floor $vfloor;
vector_set_ceil $vceil
pack .vector.thres -side top
pack .vector.thres.label -side left -fill x
pack .vector.thres.but -side left -fill x
frame .vector.floor
label .vector.floor.floorlab -text "Min: "
entry .vector.floor.floor -relief sunken -width 12 -textvariable VectorFloor
bind .vector.floor.floor <Return> { vector_set_vfloor }
slider .vector.floor.slider -relief raised -bd 2 -orient horizontal \
-from 0.0 -to 100.0 -resol 0.5 -digits 4 \
-variable vfloor -command { vector_set_floor }
frame .vector.ceil
label .vector.ceil.ceillab -text "Max: "
entry .vector.ceil.ceil -relief sunken -width 12 -textvariable VectorCeiling
bind .vector.ceil.ceil <Return> { vector_set_vceil }
slider .vector.ceil.slider -relief raised -bd 2 -orient horizontal \
-from 0.0 -to 100.0 -resol 0.5 -digits 4 \
-variable vceil -command { vector_set_ceil }
pack .vector.floor -side top
pack .vector.floor.floorlab -side left -fill x
pack .vector.floor.floor -side left -fill x
pack .vector.floor.slider -side left
pack .vector.ceil -side top
pack .vector.ceil.ceillab -side left -fill x
pack .vector.ceil.ceil -side left -fill x
pack .vector.ceil.slider -side left
#
# color
#
frame .vector.color
label .vector.color.label -text "Color Variable: "
button .vector.color.but -textvariable VectorColor \
-command { set VectorColor [make_scalar_list]; UpdateVariable "VectorColor" }
UpdateVariable "VectorColor"
pack .vector.color -side top
pack .vector.color.label -side left
pack .vector.color.but -side left -fill x
#
# length
#
frame .vector.length
label .vector.length.label -text "Length Variable: "
button .vector.length.but -textvariable VectorLength \
-command { set VectorLength [make_scalar_list]; UpdateVariable "VectorLength" }
UpdateVariable "VectorLength"
pack .vector.length -side top
pack .vector.length.label -side left
pack .vector.length.but -side left -fill x
#
# arrow
#
frame .vector.arrow
label .vector.arrow.label -text "Arrow Variable: "
button .vector.arrow.but -textvariable VectorArrow \
-command { set VectorArrow [make_vector_list]; }
pack .vector.arrow -side top
pack .vector.arrow.label -side left
pack .vector.arrow.but -side left -fill x
#
# close & apply
#
frame .vector.buttons
button .vector.buttons.apply -text "Apply" -command "UpdateObject; play"
button .vector.buttons.close -text "Close" -command "destroy .vector"
pack .vector.buttons -side top
pack .vector.buttons.apply -side left
pack .vector.buttons.close -side left -fill x
}
|