netgen/ng/ngvisual.tcl

1673 lines
51 KiB
Tcl
Raw Normal View History

2009-01-18 01:52:26 +05:00
Ng_Vis_Set parameters
set viscnt 0
proc snapshottimer { } {
after 2000 { snapshottimer }
global viscnt
set viscnt [expr $viscnt+1]
set s1 0000$viscnt
# puts $s1
set cnt [string range $s1 [expr [string length $s1]-4] end]
set filename "p$cnt.jpg"
# puts "cnt = $cnt"
# puts "filename = $filename"
# .ndraw Ng_SnapShot pictures/$filename
}
snapshottimer
proc redrawtimer { } {
global visoptions.autoredraw
global visoptions.autoredrawtime
set delay [expr int(${visoptions.autoredrawtime}*1000)]
if { ${visoptions.autoredraw} == 1 } { redraw; }
after $delay { redrawtimer }
}
redrawtimer
set perstarttime [clock clicks -millisecond]
proc redrawperiodic { } {
global visoptions.redrawperiodic
global perstarttime
set curtime [clock clicks -millisecond]
# puts "redraw periodic, time = $curtime"
Ng_Vis_Set time [expr ($curtime - $perstarttime) / 5]
redraw
if { ${visoptions.redrawperiodic} == 1 } { after 30 { redrawperiodic } };
}
proc addplotline { identifier datax datay plotinfo {color black}} {
set c $identifier.c
set xstart [lindex $plotinfo 0]
set ystart [lindex $plotinfo 1]
set xmin [lindex $plotinfo 2]
set ymin [lindex $plotinfo 3]
set unitx [lindex $plotinfo 4]
set unity [lindex $plotinfo 5]
set latestx [expr ([lindex $datax 0]-$xmin)*$unitx + $xstart]
set latesty [expr ([lindex $datay 0]-$ymin)*$unity + $ystart]
for {set i 1} {$i < [llength $datax]} {incr i} {
set xpos [expr ([lindex $datax $i]-$xmin)*$unitx + $xstart]
set ypos [expr ([lindex $datay $i]-$ymin)*$unity + $ystart]
$c create line $latestx $latesty $xpos $ypos -width 1 -fill $color
set latestx $xpos
set latesty $ypos
}
}
proc createlineplot { width height identifier title xmin xmax ymin ymax plotinfo} {
set thiswidth $width
set thisheight $height
if { $thiswidth < 275 } { set thiswidth 275 }
if { $thisheight < 225 } { seth thisheight 225 }
set w $identifier
if {[winfo exists $w] == 1} {
wm withdraw $w
wm deiconify $w
focus $w
} {
toplevel $w
set c $w.c
canvas $c -relief raised -width $thiswidth -height $thisheight
pack $w.c -side top -fill x
set titleFont {Helvetica 18}
set smallFont {Helvetica 12}
set xstart 100
set xend [expr $thiswidth-75]
set ystart [expr $thisheight-75]
set yend 75
$c create line $xstart $ystart $xstart $yend -width 2
$c create line $xstart $ystart $xend $ystart -width 2
set unitx [expr double($xend-$xstart)/($xmax-$xmin)]
set unity [expr double($yend-$ystart)/($ymax-$ymin)]
for {set i 0} {$i <= 1} {set i [expr $i+0.2]} {
$c create line [expr $xstart+$i*($xend-$xstart)] [expr $ystart] [expr $xstart+$i*($xend-$xstart)] [expr $ystart+5] -width 2
$c create text [expr $xstart+$i*($xend-$xstart)] [expr $ystart+7] -anchor n -font $smallFont \
-text [format "%.3g" [expr $xmin+$i*($xmax-$xmin)]]
$c create line [expr $xstart] [expr $ystart+$i*($yend-$ystart)] [expr $xstart-7] [expr $ystart+$i*($yend-$ystart)] -width 2
$c create text [expr $xstart-9] [expr $ystart+$i*($yend-$ystart)] -anchor e -font $smallFont \
-text [format "%.3g" [expr $ymin+$i*($ymax-$ymin)]]
}
upvar $plotinfo ploti
set ploti "$xstart $ystart $xmin $ymin $unitx $unity"
button $w.close -text "Close" -command "destroy $w"
pack $w.close
wm withdraw $w
wm geom $w +100+100
wm deiconify $w
wm title $w $title
focus $w
}
}
proc getlineplotdata { datax datay xmini xmaxi ymini ymaxi} {
upvar $datax datx
upvar $datay daty
upvar $xmini xmin
upvar $xmaxi xmax
upvar $ymini ymin
upvar $ymaxi ymax
global visoptions.lineplotusingx
global visoptions.lineplotusingy
global visoptions.lineplotsource
global visoptions.lineplotfile
set datx ""
set daty ""
set xmin 1e20
set xmax -1e20
set ymin 1e20
set ymax -1e20
if {${visoptions.lineplotsource} == "file"} {
set fileId [open ${visoptions.lineplotfile} r]
set line ""
while {[gets $fileId line] >= 0} {
if { [string index [lindex $line 0] 0] != "\#" } {
if { ${visoptions.lineplotusingx} < [llength $line] } {
lappend datx [lindex $line ${visoptions.lineplotusingx}]
if { [lindex $datx end] < $xmin } {set xmin [lindex $datx end]}
if { [lindex $datx end] > $xmax } {set xmax [lindex $datx end]}
} {
lappend datx 0
}
if { ${visoptions.lineplotusingy} < [llength $line] } {
lappend daty [lindex $line ${visoptions.lineplotusingy}]
if { [lindex $daty end] < $ymin } {set ymin [lindex $daty end]}
if { [lindex $daty end] > $ymax } {set ymax [lindex $daty end]}
} {
lappend daty 0
}
}
}
close $fileId
}
}
proc lineplotdialog { } {
set w .lineplot_dlg
if {[winfo exists .lineplot_dlg] == 1} {
wm withdraw $w
wm deiconify $w
focus $w
} {
toplevel $w
2016-02-26 16:19:26 +05:00
ttk::frame $w.filesettings -relief groove -borderwidth 3
ttk::frame $w.filesettings.title
ttk::radiobutton $w.filesettings.title.choose -variable visoptions.lineplotsource \
2009-01-18 01:52:26 +05:00
-value file -text "Data from File"
pack $w.filesettings.title.choose -side left
pack $w.filesettings.title
global visoptions.lineplotselectedeval
global visoptions.lineplotfile
global visoptions.evaluatefilenames
global visoptions.evaluatefiledescriptions
set evdata [NGS_GetData evaluatefiles]
set visoptions.evaluatefilenames none
set visoptions.evaluatefiledescriptions none
for {set i 0} {[expr $i+1] < [llength $evdata]} {incr i 2} {
lappend visoptions.evaluatefilenames [lindex $evdata $i]
lappend visoptions.evaluatefiledescriptions [lindex $evdata [expr $i+1]]
}
tixOptionMenu $w.filesettings.latestevals -label "Use Evaluate Results: " \
-options {
label.width 25
label.anchor e
menubutton.width 40
}
for {set i 0} {$i < [llength ${visoptions.evaluatefilenames}]} {incr i} {
$w.filesettings.latestevals add command $i \
-label "[lindex ${visoptions.evaluatefiledescriptions} $i] ([lindex ${visoptions.evaluatefilenames} $i])"
}
$w.filesettings.latestevals config -variable visoptions.lineplotselectedeval
pack $w.filesettings.latestevals
frame $w.filesettings.sfn
button $w.filesettings.sfn.bb -text "Browse" \
-command { set visoptions.lineplotfile [tk_getOpenFile] }
entry $w.filesettings.sfn.fn -width 50 -relief sunken \
-textvariable visoptions.lineplotfile
pack $w.filesettings.sfn.bb $w.filesettings.sfn.fn -side left
pack $w.filesettings.sfn
button $w.filesettings.refresh -text "Refresh" -command {
if { ${visoptions.lineplotselectedeval} != 0} {
set visoptions.lineplotfile [lindex ${visoptions.evaluatefilenames} ${visoptions.lineplotselectedeval}]
}
set saveusingx ${visoptions.lineplotusingx}
set saveusingy ${visoptions.lineplotusingy}
for { set i 0 } { $i < [llength ${visoptions.lineplotdatadescr}] } { incr i } {
${visoptions.lineplotxcoordselector} delete $i
}
for { set i 0 } { $i < [llength ${visoptions.lineplotdatadescr}] } { incr i } {
${visoptions.lineplotycoordselector} delete $i
}
set fileId [open ${visoptions.lineplotfile} r]
set line ""
gets $fileId line
close $fileId
if { [lindex $line 0] == "\#nglineplotinfo" } {
set visoptions.lineplotdatadescr [lrange $line 1 end]
} {
set visoptions.lineplotdatadescr ""
for { set i 0 } { $i < [llength $line] } { incr i } {
lappend visoptions.lineplotdatadescr "data[expr $i+1]"
}
}
for { set i 0 } { $i < [llength ${visoptions.lineplotdatadescr}] } { incr i } {
${visoptions.lineplotxcoordselector} add command $i -label [lindex ${visoptions.lineplotdatadescr} $i]
}
for { set i 0 } { $i < [llength ${visoptions.lineplotdatadescr}] } { incr i } {
${visoptions.lineplotycoordselector} add command $i -label [lindex ${visoptions.lineplotdatadescr} $i]
}
if { $saveusingx < [llength ${visoptions.lineplotdatadescr}] } {
set visoptions.lineplotusingx $saveusingx
} {
set visoptions.lineplotusingx 0
}
if { $saveusingy < [llength ${visoptions.lineplotdatadescr}] } {
set visoptions.lineplotusingy $saveusingy
} {
set visoptions.lineplotusingy 1
}
}
pack $w.filesettings.refresh
frame $w.filesettings.using
global visoptions.lineplotdatadescr
tixOptionMenu $w.filesettings.using.xco -label "X-Coord:"\
-options {
label.width 8
label.anchor e
menubutton.width 15
}
for { set i 0 } { $i < [llength ${visoptions.lineplotdatadescr}] } { incr i } {
$w.filesettings.using.xco add command $i -label [lindex ${visoptions.lineplotdatadescr} $i]
}
$w.filesettings.using.xco config -variable visoptions.lineplotusingx
tixOptionMenu $w.filesettings.using.yco -label "Y-Coord:"\
-options {
label.width 8
label.anchor e
menubutton.width 15
}
for { set i 0 } { $i < [llength ${visoptions.lineplotdatadescr}] } { incr i } {
$w.filesettings.using.yco add command $i -label [lindex ${visoptions.lineplotdatadescr} $i]
}
$w.filesettings.using.yco config -variable visoptions.lineplotusingy
global visoptions.lineplotxcoordselector
global visoptions.lineplotycoordselector
set visoptions.lineplotxcoordselector $w.filesettings.using.xco
set visoptions.lineplotycoordselector $w.filesettings.using.yco
pack $w.filesettings.using.xco $w.filesettings.using.yco -side left
pack $w.filesettings.using
pack $w.filesettings -fill x -ipady 3
2016-02-08 19:53:16 +05:00
ttk::frame $w.settings -relief groove -borderwidth 3
ttk::label $w.settings.title -text "\nSettings\n"
2009-01-18 01:52:26 +05:00
pack $w.settings.title
2016-02-08 19:53:16 +05:00
ttk::frame $w.settings.minmax
ttk::checkbutton $w.settings.minmax.autoscale -text "Autoscale" -variable visoptions.lineplotautoscale
2009-01-18 01:52:26 +05:00
tixControl $w.settings.minmax.xmin -label "Min. x: " \
-integer false -variable visoptions.lineplotxmin \
-options {
entry.width 6
label.width 8
label.anchor e
}
tixControl $w.settings.minmax.xmax -label "Max. x: " \
-integer false -variable visoptions.lineplotxmax \
-options {
entry.width 6
label.width 8
label.anchor e
}
tixControl $w.settings.minmax.ymin -label "Min. y: " \
-integer false -variable visoptions.lineplotymin \
-options {
entry.width 6
label.width 8
label.anchor e
}
tixControl $w.settings.minmax.ymax -label "Max. y: " \
-integer false -variable visoptions.lineplotymax \
-options {
entry.width 6
label.width 8
label.anchor e
}
pack $w.settings.minmax.autoscale $w.settings.minmax.xmin $w.settings.minmax.xmax \
$w.settings.minmax.ymin $w.settings.minmax.ymax -side left
pack $w.settings.minmax
label $w.settings.empty1 -text ""
pack $w.settings.empty1
frame $w.settings.plotsize
tixControl $w.settings.plotsize.xsize -label "Plotsize x: "\
-integer true -variable visoptions.lineplotsizex \
-options {
entry.width 6
label.width 13
label.anchor e
}
tixControl $w.settings.plotsize.ysize -label "y: "\
-integer true -variable visoptions.lineplotsizey \
-options {
entry.width 6
label.width 3
label.anchor e
}
pack $w.settings.plotsize.xsize $w.settings.plotsize.ysize -side left
pack $w.settings.plotsize
label $w.settings.empty2 -text ""
pack $w.settings.empty2
tixOptionMenu $w.settings.color -label "Linecolor: " \
-options {
label.width 19
label.anchor e
menubutton.width 15
}
foreach step { red black blue green yellow } {
$w.settings.color add command $step -label $step
}
$w.settings.color config -variable visoptions.lineplotcolor
pack $w.settings.color
pack $w.settings
set datax ""
set datay ""
set xmin 0
set xmax 0
set ymin 0
set ymax 0
frame $w.plots -relief groove -borderwidth 3
tixOptionMenu $w.plots.selplot -label "Selected Plot: " \
-options {
label.width 19
label.anchor e
menubutton.width 15
}
$w.plots.selplot add command none -label "None"
$w.plots.selplot config -variable visoptions.lineplotselected
global visoptions.lineplotselector
set visoptions.lineplotselector $w.plots.selplot
button $w.plots.new -text "Generate New Plot" -command {
if { ${visoptions.lineplotselectedeval} != 0} {
set visoptions.lineplotfile [lindex ${visoptions.evaluatefilenames} ${visoptions.lineplotselectedeval}]
}
getlineplotdata datax datay xmin xmax ymin ymax
puts stdout "xmin $xmin xmax $xmax ymin $ymin ymax $ymax"
global visoptions.lineplotautoscale
if {! ${visoptions.lineplotautoscale}} {
puts "using set min/max values"
set xmin ${visoptions.lineplotxmin}
set xmax ${visoptions.lineplotxmax}
set ymin ${visoptions.lineplotymin}
set ymax ${visoptions.lineplotymax}
}
incr visoptions.lineplotcurrentnum
set ident .newplot${visoptions.lineplotcurrentnum}
set plotinfo ""
createlineplot ${visoptions.lineplotsizex} ${visoptions.lineplotsizey} \
$ident "Lineplot ${visoptions.lineplotcurrentnum}" \
$xmin $xmax $ymin $ymax plotinfo
lappend visoptions.lineplotinfos $plotinfo
${visoptions.lineplotselector} add command ${visoptions.lineplotcurrentnum} -label "Lineplot ${visoptions.lineplotcurrentnum}"
addplotline $ident $datax $datay $plotinfo ${visoptions.lineplotcolor}
}
button $w.plots.addto -text "Add to Selected Plot" -command {
if { ${visoptions.lineplotselectedeval} != 0} {
set visoptions.lineplotfile [lindex ${visoptions.evaluatefilenames} ${visoptions.lineplotselectedeval}]
}
if { ${visoptions.lineplotselected} != "none" } {
getlineplotdata datax datay xmin xmax ymin ymax
set ident .newplot${visoptions.lineplotselected}
set plotinfo [lindex ${visoptions.lineplotinfos} ${visoptions.lineplotselected}]
addplotline $ident $datax $datay $plotinfo ${visoptions.lineplotcolor}
}
}
pack $w.plots.new $w.plots.addto $w.plots.selplot
pack $w.plots -fill x -ipady 3
button $w.close -text "Close" -command "destroy $w"
pack $w.close
wm withdraw $w
wm geom $w +200+100
wm deiconify $w
wm title $w "2D Lineplots"
focus $w
}
}
set fieldlinesdialog_pop1 0
proc fieldlinesdialog { } {
set w .fieldlines_dlg
global fieldlinesdialog_pop1
set fieldlinesdialog_pop1 1
if {[winfo exists .fieldlines_dlg] == 1} {
wm withdraw $w
wm deiconify $w
focus $w
} {
toplevel $w
2016-02-26 16:19:26 +05:00
#tixNoteBook $w.nb -ipadx 6 -ipady 6
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
pack [ttk::notebook $w.nb] -fill both -side top -ipadx 6 -ipady 6
$w.nb add [ttk::frame $w.nb.draw] -text "Draw" -underline 0
$w.nb add [ttk::frame $w.nb.settings] -text "Settings" -underline 0
#$w.nb add draw -label "Draw"
#$w.nb add settings -label "Settings"
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
#pack $w.nb -expand yes -fill both -padx 5 -pady 5 -side top
2009-01-18 01:52:26 +05:00
# Main Window
2016-02-26 16:19:26 +05:00
set f $w.nb.draw
2009-01-18 01:52:26 +05:00
ttk::labelframe $f.general -text "General settings" -relief groove -borderwidth 3
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
ttk::checkbutton $f.general.enable -text "Enable Fieldlines" \
2009-01-18 01:52:26 +05:00
-variable visoptions.drawfieldlines \
-command {
# set visoptions.redrawperiodic ${visoptions.drawfieldlines}
# redrawperiodic
# redrawperiodic # sonst
Ng_Vis_Set parameters;
redraw
}
2016-02-26 16:19:26 +05:00
ttk::label $f.general.numl -text "num:"
ttk::spinbox $f.general.num -from 0 -to 100 -increment 1 \
-textvariable visoptions.numfieldlines -width 4
#tixControl $f.general.num -label "Num: " -integer true \
2009-01-18 01:52:26 +05:00
-variable visoptions.numfieldlines \
-command { Ng_Vis_Set parameters; redraw } \
-options {
2016-02-26 16:19:26 +05:00
# entry.width 6
# label.width 12
# label.anchor e
# }
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
grid $f.general.enable -sticky nw -padx 4 -pady 2
grid x $f.general.numl $f.general.num -rowspan 3 -sticky w -padx 4 -row 0 -pady 2
grid anchor $f.general center
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
pack $f.general -pady 15 -fill x -ipady 3
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
ttk::label $f.labe0 -text " "
2009-01-18 01:52:26 +05:00
pack $f.labe0
2016-02-26 16:19:26 +05:00
#ttk::frame $f.general1
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
ttk::checkbutton $f.general.randomstart -text "Field dependent density " \
2009-01-18 01:52:26 +05:00
-variable visoptions.fieldlinesrandomstart \
-command { Ng_Vis_Set parameters; redraw}
2016-02-26 16:19:26 +05:00
ttk::checkbutton $f.general.redrawperiodic -text "Animate periodic" \
2009-01-18 01:52:26 +05:00
-variable visoptions.redrawperiodic \
-command {
redrawperiodic
Ng_Vis_Set parameters;
redraw
}
2016-02-26 16:19:26 +05:00
grid $f.general.randomstart -sticky nw -padx 4 -row 1
grid $f.general.redrawperiodic -sticky nw -padx 4 -row 2
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
#pack $f.general1
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
ttk::label $f.lab0 -text " "
2009-01-18 01:52:26 +05:00
pack $f.lab0
tixOptionMenu $f.vecfun -label "Vector Function: " \
-options {
label.width 18
label.anchor e
menubutton.width 12
}
$f.vecfun add command none -label None
for { set i 1 } { $i <= [Ng_Vis_Field getnfieldnames] } { incr i } {
set fname [Ng_Vis_Field getfieldname $i]
set fcomp [Ng_Vis_Field getfieldcomponents $i]
set iscomplex [Ng_Vis_Field iscomplex $i]
set sdim [Ng_Vis_Field getdimension]
if { $iscomplex == 1 } { set fcomp [expr $fcomp / 2] }
if { ($fcomp == $sdim) || ($fcomp == 3) } {
$f.vecfun add command $fname -label $fname
}
}
$f.vecfun configure -variable visoptions.fieldlinesvecfunction
$f.vecfun configure -command { Ng_Vis_Set parameters; redraw }
pack $f.vecfun
2016-02-26 16:19:26 +05:00
ttk::label $f.lab00 -text " "
2009-01-18 01:52:26 +05:00
pack $f.lab00
2016-02-26 16:19:26 +05:00
ttk::frame $f.phasesettings
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
ttk::checkbutton $f.phasesettings.onephase -text "Fix Phase" -variable visoptions.fieldlinesonlyonephase
2009-01-18 01:52:26 +05:00
scale $f.phasesettings.phase -orient horizontal -length 300 -from 0 -to 360 \
-label "phi" \
-resolution 1 \
-variable visoptions.fieldlinesphase \
-command { popupcheckredraw3 fieldlinesdialog_pop1 }
pack $f.phasesettings.onephase $f.phasesettings.phase -side left
pack $f.phasesettings
2016-02-26 16:19:26 +05:00
ttk::label $f.lab1 -text " "
2009-01-18 01:52:26 +05:00
pack $f.lab1
2016-02-26 16:19:26 +05:00
ttk::frame $f.boxsettings -relief groove -borderwidth 3
ttk::frame $f.boxsettings.title
ttk::radiobutton $f.boxsettings.title.choose -variable visoptions.fieldlinesstartarea \
2009-01-18 01:52:26 +05:00
-value box -text "Startpoints in Box"
pack $f.boxsettings.title.choose -side left
pack $f.boxsettings.title
2016-02-26 16:19:26 +05:00
ttk::frame $f.boxsettings.points
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
ttk::label $f.boxsettings.points.lab2 -text "Pmin";
ttk::entry $f.boxsettings.points.ent1x -width 8 \
2009-01-18 01:52:26 +05:00
-textvariable visoptions.fieldlinesstartareap1x
2016-02-26 16:19:26 +05:00
ttk::entry $f.boxsettings.points.ent1y -width 8 \
2009-01-18 01:52:26 +05:00
-textvariable visoptions.fieldlinesstartareap1y
2016-02-26 16:19:26 +05:00
ttk::entry $f.boxsettings.points.ent1z -width 8 \
2009-01-18 01:52:26 +05:00
-textvariable visoptions.fieldlinesstartareap1z
2016-02-26 16:19:26 +05:00
ttk::label $f.boxsettings.points.lab3 -text " Pmax";
ttk::entry $f.boxsettings.points.ent2x -width 8 \
2009-01-18 01:52:26 +05:00
-textvariable visoptions.fieldlinesstartareap2x
2016-02-26 16:19:26 +05:00
ttk::entry $f.boxsettings.points.ent2y -width 8 \
2009-01-18 01:52:26 +05:00
-textvariable visoptions.fieldlinesstartareap2y
2016-02-26 16:19:26 +05:00
ttk::entry $f.boxsettings.points.ent2z -width 8 \
2009-01-18 01:52:26 +05:00
-textvariable visoptions.fieldlinesstartareap2z
pack $f.boxsettings.points
pack $f.boxsettings.points.lab2 $f.boxsettings.points.ent1x $f.boxsettings.points.ent1y $f.boxsettings.points.ent1z -side left
pack $f.boxsettings.points.lab3 $f.boxsettings.points.ent2x $f.boxsettings.points.ent2y $f.boxsettings.points.ent2z -side left
2016-02-26 16:19:26 +05:00
ttk::button $f.boxsettings.settobb -text "Bounding Box" -command {
2009-01-18 01:52:26 +05:00
set bbox [Ng_MeshInfo bbox]
set visoptions.fieldlinesstartareap1x [lindex $bbox 0]
set visoptions.fieldlinesstartareap2x [lindex $bbox 1]
set visoptions.fieldlinesstartareap1y [lindex $bbox 2]
set visoptions.fieldlinesstartareap2y [lindex $bbox 3]
set visoptions.fieldlinesstartareap1z [lindex $bbox 4]
set visoptions.fieldlinesstartareap2z [lindex $bbox 5]
}
pack $f.boxsettings.settobb
pack $f.boxsettings -fill x -ipady 3
2016-02-26 16:19:26 +05:00
ttk::frame $f.facesettings -relief groove -borderwidth 3
ttk::frame $f.facesettings.title
ttk::radiobutton $f.facesettings.title.choose -variable visoptions.fieldlinesstartarea \
2009-01-18 01:52:26 +05:00
-value face -text "Startpoints on Face"
pack $f.facesettings.title.choose -side left
pack $f.facesettings.title
2016-02-26 16:19:26 +05:00
ttk::frame $f.facesettings.index
ttk::label $f.facesettings.index.lab -text "face index:"
ttk::label $f.facesettings.index.ent -text 1;# -padx 4
2009-01-18 01:52:26 +05:00
pack $f.facesettings.index.lab $f.facesettings.index.ent -side left
pack $f.facesettings.index
pack $f.facesettings -fill x -ipady 3
global visoptions.fieldlinesfilename
2016-02-26 16:19:26 +05:00
ttk::frame $f.filesettings -relief groove -borderwidth 3
ttk::frame $f.filesettings.title
ttk::radiobutton $f.filesettings.title.choose -variable visoptions.fieldlinesstartarea \
2009-01-18 01:52:26 +05:00
-value file -text "Startpoints from File"
pack $f.filesettings.title.choose -side left
pack $f.filesettings.title
2016-02-26 16:19:26 +05:00
ttk::frame $f.filesettings.sfn
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
ttk::button $f.filesettings.sfn.bb -text "Browse" \
2009-01-18 01:52:26 +05:00
-command {
set types {
{ "Netgen Fieldlines" {.nef} }
}
set visoptions.fieldlinesfilename [tk_getOpenFile -filetypes $types -defaultextension ".nef"]
}
2016-02-26 16:19:26 +05:00
ttk::entry $f.filesettings.sfn.fn -width 50 \
2009-01-18 01:52:26 +05:00
-textvariable visoptions.fieldlinesfilename
pack $f.filesettings.sfn.bb $f.filesettings.sfn.fn -side left
pack $f.filesettings.sfn
pack $f.filesettings -fill x -ipady 3
# Settings
2016-02-26 16:19:26 +05:00
set g $w.nb.settings
2009-01-18 01:52:26 +05:00
frame $g.linesettings -relief groove -borderwidth 3
label $g.linesettings.title -text "\nLine Settings\n"
tixControl $g.linesettings.length -label "rel. Length: " -integer false \
-variable visoptions.fieldlineslength -min 0.00001 -max 10000 -step 0.1 \
-options {
entry.width 6
label.width 25
label.anchor e
}
tixControl $g.linesettings.maxpoints -label "max. Points: " -integer true \
-variable visoptions.fieldlinesmaxpoints -min 0 -max 10000 -step 1 \
-options {
entry.width 6
label.width 25
label.anchor e
}
tixControl $g.linesettings.thick -label "rel. Thickness: " -integer false \
-variable visoptions.fieldlinesthickness -min 1e-10 -max 0.5 -step 0.001 \
-options {
entry.width 6
label.width 25
label.anchor e
}
pack $g.linesettings.title $g.linesettings.length $g.linesettings.maxpoints $g.linesettings.thick
pack $g.linesettings -fill x -ipady 3
global visoptions.fieldlinestolerance
frame $g.odesettings -relief groove -borderwidth 3
label $g.odesettings.title -text "\nODE Settings\n"
tixControl $g.odesettings.tol -label "rel. Tolerance: " -integer false \
-variable visoptions.fieldlinestolerance -min 0.00001 -max 1 -step 0.01 \
-options {
entry.width 6
label.width 25
label.anchor e
}
tixOptionMenu $g.odesettings.rktype -label "RK-Type " \
-options {
label.width 20
label.anchor e
menubutton.width 25
}
$g.odesettings.rktype add command euler -label "Euler, order 1"
$g.odesettings.rktype add command eulercauchy -label "Euler-Cauchy, order 2"
$g.odesettings.rktype add command simpson -label "Simpson, order 3"
$g.odesettings.rktype add command crungekutta -label "classical Runge-Kutta, order 4"
$g.odesettings.rktype configure -variable visoptions.fieldlinesrktype
$g.odesettings.rktype configure -command { Ng_Vis_Set parameters; redraw }
pack $g.odesettings.title $g.odesettings.tol $g.odesettings.rktype
pack $g.odesettings -fill x -ipady 3
# buttons
2016-02-26 16:19:26 +05:00
ttk::frame $w.bu
pack $w.bu -fill x -ipady 3
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
ttk::button $w.bu.calc -text "Build Fieldlines" -command {
2009-01-18 01:52:26 +05:00
if { ${visoptions.fieldlinesvecfunction} == "none" } {
bgerror "Please select the vector function first!"
} {
set visoptions.drawfieldlines 1
Ng_Vis_Set parameters
Ng_BuildFieldLines
redraw
}
}
2016-02-26 16:19:26 +05:00
ttk::button $w.bu.help -text "Help" -command {
2009-01-18 01:52:26 +05:00
if {[winfo exists .fieldlines_help] == 1} {
wm withdraw .fieldlines_help
wm deiconify .fieldlines_help
focus .fieldlines_help
} {
toplevel .fieldlines_help
tixScrolledText .fieldlines_help.ht -scrollbar y
2016-02-26 16:19:26 +05:00
set text .fieldlines_help.ht.text
2009-01-18 01:52:26 +05:00
$text configure -setgrid true -wrap word
$text tag configure bold -font *-*-bold-*-*-*-*
$text insert end \
"Draw menu\n \n" bold
$text insert end \
"Enable Fieldlines\n To turn on and off the calculated fieldlines. (Has to be turned on to start the calculation)\n"
$text insert end \
"Num\n Number of fieldlines to calculate. (May not be used exactly.)"
$text insert end \
"Field dependent density\n There will be more fieldline startpoints where the field is stronger\n\n"
$text insert end \
"Animate periodic\n (for quasistationary fields) The fieldlines of the different phase angles are animated.\n ATTENTION: \"Fix Phase\" has to be turned off\n\n"
$text insert end \
"Vector Function\n The function fixing the direction of the lines\n\n"
$text insert end \
"Fix Phase\n (for quasistationary fields) Only calculate and draw fieldlines for one special phase angle.\n\n"
$text insert end \
"Startpoints in Box\n Set the startpoints inside the box \[Pmin1,Pmax1\] x \[Pmin2,Pmax2\] x \[Pmin3,Pmax3\]\n"
$text insert end \
" With the button \"Bounding Box\" the whole bounding box of the geometry is selected.\n\n"
$text insert end \
"Startpoints on Face\n All startpoints will be set on one face. This face is selected by double-clicking with the mouse.\n\n"
$text insert end \
"Startpoints from File\n The startpoint information will be read from the selected file.\n The entries in the file can be as follows:\n"
$text insert end \
" point <x> <y> <z>\n set a (potential) startpoint\n"
$text insert end \
" line <x1> <y1> <z1> <x2> <y2> <z2> <n>\n set n (potential) startpoints on the line from (x1,y1,z1) to (x2,y2,z2)\n"
$text insert end \
" box <x1> <y1> <z1> <x2> <y2> <z2> <n>\n set n (potential) startpoints inside the box \[x1,x2\] x \[y1,y2\] x \[z1,z2\]\n"
$text insert end \
" ATTENTION: These are potential startpoints.\n The total number of startpoints will be bounded by the \"Num\"-parameter.\n \n \n \n"
$text insert end \
"Settings Menu\n \n" bold
$text insert end \
"rel. Length\n The maximal length of a fieldline relative to the diameter of the geometry.\n\n"
$text insert end \
"max. Points\n The maximum number of Runge-Kutta steps.\n\n"
$text insert end \
"rel. Thickness\n The thickness of the fieldlines relative to the diameter of the geometry.\n\n"
$text insert end \
"rel. Tolerance\n The tolerance for the step-length control of the Runge-Kutta method.\n\n"
$text insert end \
"RK-Type\n Which Runge-Kutta scheme to use\n \n \n \n"
$text insert end \
"Button \"Build Fieldlines\"\n" bold
$text insert end \
" Build the fieldlines."
$text configure -state disabled
pack .fieldlines_help.ht -expand yes -fill both
wm withdraw .fieldlines_help
wm geom .fieldlines_help +300+200
wm deiconify .fieldlines_help
wm title .fieldlines_help "Fieldlines Help"
focus .fieldlines_help
}
}
2016-02-26 16:19:26 +05:00
ttk::button $w.bu.cancel -text "Done" -command "destroy $w"
grid $w.bu.calc $w.bu.help $w.bu.cancel -sticky nw -padx 4
grid anchor $w.bu center
2009-01-18 01:52:26 +05:00
wm withdraw $w
wm geom $w +200+100
wm deiconify $w
wm title $w "Fieldlines"
# grab $w
focus $w
}
global visoptions.fieldlinesstartface
2016-02-26 16:19:26 +05:00
set f $w.nb.draw
2009-01-18 01:52:26 +05:00
set visoptions.fieldlinesstartface [Ng_BCProp getactive]
$f.facesettings.index.ent configure -text ${visoptions.fieldlinesstartface}
}
#proc popupcheckredraw { vari { x 0 } } {
# upvar $vari varname
# if { $varname == 1 } {
# set varname 0
# } {
# Ng_Vis_Set parameters
# redraw
# }
#}
set visual_dialog_pop1 0
set visual_dialog_pop2 0
set visual_dialog_pop3 0
set visual_dialog_pop4 0
set visual_dialog_pop5 0
set visual_dialog_pop6 0
set visual_dialog_pop7 0
proc visual_dialog { } {
set w .visoptions_dlg
global visual_dialog_pop1
global visual_dialog_pop2
global visual_dialog_pop3
global visual_dialog_pop4
global visual_dialog_pop5
global visual_dialog_pop6
global visual_dialog_pop7
set visual_dialog_pop1 1
set visual_dialog_pop2 1
set visual_dialog_pop3 1
set visual_dialog_pop4 1
set visual_dialog_pop5 1
set visual_dialog_pop6 1
set visual_dialog_pop7 1
if {[winfo exists .visoptions_dlg] == 1} {
wm withdraw $w
wm deiconify $w
focus $w
} {
2016-02-08 19:53:16 +05:00
toplevel $w
2016-02-26 16:19:26 +05:00
#ttk::frame $w.grid -relief groove -borderwidth 0
2009-01-18 01:52:26 +05:00
# change to: max gridsize 200
2016-02-26 16:19:26 +05:00
#scale $w.grid.size -orient horizontal -length 100 -from 1 -to 200 \
2009-01-18 01:52:26 +05:00
-label "Grid" \
-resolution 1 \
-variable visoptions.gridsize \
-command { popupcheckredraw visual_dialog_pop2 }
2016-02-08 19:53:16 +05:00
2009-01-18 01:52:26 +05:00
# x- and y- offset
2016-02-26 16:19:26 +05:00
#scale $w.grid.xoffset -orient horizontal -length 80 -from 0 -to 1 \
2009-01-18 01:52:26 +05:00
-label "x-Offset" \
-resolution 0.05 \
-variable visoptions.xoffset \
-command { popupcheckredraw visual_dialog_pop3 }
2016-02-26 16:19:26 +05:00
ttk::frame $w.main
pack $w.main -fill x
set w $w.main
ttk::frame $w.upperfr ;# -relief groove -borderwidth 3 -height 10
pack $w.upperfr -fill x;# -ipady 8
ttk::labelframe $w.upperfr.size -text "Grid" -relief groove -borderwidth 3
2016-02-26 16:19:26 +05:00
ttk::entry $w.upperfr.size.ent -width 3 -textvariable visoptions.gridsize -validate focus -takefocus 0 -validatecommand "popupcheckredraw visual_dialog_pop2;my_validate %W 0 200 %P 0" \
-invalidcommand "my_invalid %W;popupcheckredraw visual_dialog_pop2"
ttk::scale $w.upperfr.size.sc -orient horizontal -length 100 -from 1 -to 200 -variable visoptions.gridsize\
-command "roundscale $w.upperfr.size.sc 0;popupcheckredraw visual_dialog_pop2"
ttk::labelframe $w.upperfr.offsets -text "x / y offsets" -relief groove -borderwidth 3
2016-02-26 16:19:26 +05:00
ttk::label $w.upperfr.offsets.xlab -text "x"
ttk::label $w.upperfr.offsets.ylab -text "y"
ttk::scale $w.upperfr.offsets.xoffset -orient horizontal -length 100 -from 0 -to 1 -variable visoptions.xoffset \
-command "roundscale $w.upperfr.offsets.xoffset 2; popupcheckredraw visual_dialog_pop3"
ttk::scale $w.upperfr.offsets.yoffset -orient horizontal -length 100 -from 0 -to 1 -variable visoptions.yoffset \
-command "roundscale $w.upperfr.offsets.yoffset 2; popupcheckredraw visual_dialog_pop4"
ttk::entry $w.upperfr.offsets.entx -width 4 -textvariable visoptions.xoffset -validate focus -takefocus 0 \
-validatecommand "popupcheckredraw visual_dialog_pop3;my_validate %W 0 1 %P 2" \
-invalidcommand "my_invalid %W;popupcheckredraw visual_dialog_pop3"
ttk::entry $w.upperfr.offsets.enty -width 4 -textvariable visoptions.yoffset -validate focus -takefocus 0 \
-validatecommand "popupcheckredraw visual_dialog_pop4;my_validate %W 0 1 %P 2" \
-invalidcommand "my_invalid %W;popupcheckredraw visual_dialog_pop4"
2009-01-18 01:52:26 +05:00
# pack $w.showclipsolution
2016-02-26 16:19:26 +05:00
pack $w.upperfr.size.sc $w.upperfr.size.ent -padx 4 -pady 12 -side left
grid $w.upperfr.offsets.xoffset $w.upperfr.offsets.entx $w.upperfr.offsets.xlab -sticky nw -padx 4
grid $w.upperfr.offsets.yoffset $w.upperfr.offsets.enty $w.upperfr.offsets.ylab -sticky nw -padx 4
grid $w.upperfr.size $w.upperfr.offsets -sticky nw -pady 7 -padx 10
grid anchor $w.upperfr center
2009-01-18 01:52:26 +05:00
# pack $w.lineartexture $w.numcols
2016-02-26 16:19:26 +05:00
ttk::labelframe $w.deform -relief groove -borderwidth 3 -text "Deformation settings"
2016-02-08 19:53:16 +05:00
ttk::checkbutton $w.deform.cb -text "Deformation" \
2009-01-18 01:52:26 +05:00
-variable visoptions.deformation \
-command { Ng_Vis_Set parameters; redraw }
2016-02-08 19:53:16 +05:00
ttk::label $w.deform.l -text "Scale: "
ttk::spinbox $w.deform.sc1 -from 0 -to 1e99 -textvariable visoptions.scaledeform1 -width 5 \
-command { Ng_Vis_Set parameters; redraw } \
-validate focusout -validatecommand { Ng_Vis_Set parameters; redraw; string is double %P } \
-invalidcommand { puts "invalid value, %P %s"; set visoptions.scaledeform1 1; }
# tixControl $w.deform.sc1 -label "Scale: " -integer false \
# -variable visoptions.scaledeform1 \
# -command { Ng_Vis_Set parameters; redraw } \
# -options {
# entry.width 6
# label.width 7
# label.anchor e
# }
ttk::scale $w.deform.sc2 -orient horizontal -length 100 -from 0 -to 1 \
2009-01-18 01:52:26 +05:00
-variable visoptions.scaledeform2 \
-command { popupcheckredraw visual_dialog_pop5 }
2016-02-26 16:19:26 +05:00
pack $w.deform -fill x -ipady 2 -pady 4 -ipady 3
grid $w.deform.cb $w.deform.l $w.deform.sc1 $w.deform.sc2 -sticky nw -padx 4;# -side left -expand yes -anchor center -padx 4
grid anchor $w.deform center
grid columnconfigure $w.deform 0 -pad 20
grid columnconfigure $w.deform 2 -pad 20
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
ttk::labelframe $w.as -relief groove -borderwidth 3 -text "Scaling options"
ttk::checkbutton $w.as.autoscale -text "Autoscale" \
2009-01-18 01:52:26 +05:00
-variable visoptions.autoscale \
-command { Ng_Vis_Set parameters; redraw }
2016-02-26 16:19:26 +05:00
ttk::label $w.as.lmin -text "Min-value"
ttk::spinbox $w.as.smin -textvariable visoptions.mminval -width 5 -validate focus \
-validatecommand "my_validatespinbox %W %P 10" \
-command "Ng_Vis_Set parameters; redraw;" \
-invalidcommand "my_invalidspinbox %W" -from -1e10 -to 1e10 -increment 0.001
ttk::label $w.as.lmax -text "Max-value"
ttk::spinbox $w.as.smax -textvariable visoptions.mmaxval -width 5 -validate focus \
-validatecommand "Ng_Vis_Set parameters; redraw;my_validatespinbox %W %P 10" \
-command "Ng_Vis_Set parameters; redraw;" \
-invalidcommand "my_invalidspinbox %W;Ng_Vis_Set parameters; redraw" -from -1e10 -to 1e10 -increment 0.001
#tixControl $w.as.minval -label "Min-value: " -integer false \
2009-01-18 01:52:26 +05:00
-variable visoptions.mminval \
-command { Ng_Vis_Set parametersrange; redraw } \
-options {
2016-02-26 16:19:26 +05:00
# entry.width 6
# label.width 12
# label.anchor e
# }
#tixControl $w.as.maxval -label "Max-value: " -integer false \
2009-01-18 01:52:26 +05:00
-variable visoptions.mmaxval \
-command { Ng_Vis_Set parametersrange; redraw } \
-options {
2016-02-26 16:19:26 +05:00
# entry.width 6
# label.width 12
# label.anchor e
# }
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
pack $w.as -fill x -pady 5 -ipady 3
grid $w.as.autoscale $w.as.lmin $w.as.smin $w.as.lmax $w.as.smax -sticky nw -padx 4
grid columnconfigure $w.as 0 -pad 20
grid columnconfigure $w.as 2 -pad 20
grid anchor $w.as center
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
ttk::frame $w.iso; #-relief groove -borderwidth 0
pack $w.iso -anchor center;# -ipady 3
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
ttk::labelframe $w.iso.cb -relief groove -borderwidth 3 -text "Iso lines / surfaces"
pack $w.iso.cb -side left -pady 7 -fill y
2009-01-18 01:52:26 +05:00
2016-02-08 19:53:16 +05:00
ttk::checkbutton $w.iso.cb.isolines -text "Iso-lines" \
2009-01-18 01:52:26 +05:00
-variable visoptions.isolines \
-command { Ng_Vis_Set parameters; redraw }
2016-02-26 16:19:26 +05:00
#pack $w.iso.cb.isolines -side top -anchor w
2009-01-18 01:52:26 +05:00
2016-02-08 19:53:16 +05:00
ttk::checkbutton $w.iso.cb.isosurf -text "Iso-Surface" \
2009-01-18 01:52:26 +05:00
-variable visoptions.isosurf \
-command { Ng_Vis_Set parameters; redraw }
2016-02-26 16:19:26 +05:00
#pack $w.iso.cb.isosurf -side top -anchor w
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
ttk::label $w.iso.cb.numisol -text "amount"
ttk::scale $w.iso.cb.numiso -orient horizontal -length 100 -from 2 -to 50 \
2009-01-18 01:52:26 +05:00
-variable visoptions.numiso \
2016-02-26 16:19:26 +05:00
-command "roundscale $w.iso.cb.numiso 0;popupcheckredraw visual_dialog_pop6"
ttk::entry $w.iso.cb.entry -textvariable visoptions.numiso -width 3 \
-validate focus -validatecommand "popupcheckredraw visual_dialog_pop6;\
my_validate %W [$w.iso.cb.numiso cget -from] [$w.iso.cb.numiso cget -to] %P 0" \
-invalidcommand "my_invalid %W;popupcheckredraw visual_dialog_pop6"
2016-02-08 19:53:16 +05:00
# -resolution 1 \
# -label "" \
2016-02-26 16:19:26 +05:00
grid $w.iso.cb.isolines $w.iso.cb.numisol $w.iso.cb.entry -sticky nw -padx 4
grid $w.iso.cb.isosurf -sticky nw -padx 4
grid $w.iso.cb.numiso -sticky nw -padx 4 -columnspan 2 -column 1 -row 1
#pack $w.iso.cb.numisol $w.iso.cb.numiso -anchor n
2009-01-18 01:52:26 +05:00
# scale $w.iso.subdiv -orient horizontal -length 100 -from 0 -to 5 \
# -label "subdivision" \
# -resolution 1 \
# -variable visoptions.subdivisions \
# -command { popupcheckredraw visual_dialog_pop7 }
# # -command { puts "subdiv-vis"; Ng_Vis_Set parameters; puts "cal redraw"; redraw }
ttk::labelframe $w.iso.subdiv -text "Subdivision" -relief groove -borderwidth 3
2016-02-08 19:53:16 +05:00
ttk::radiobutton $w.iso.subdiv.zero -text "0" -variable visoptions.subdivisions -value 0 \
2009-01-18 01:52:26 +05:00
-command {
#set visoptions.subdivisions 1;
Ng_Vis_Set parameters; redraw;
}
2016-02-08 19:53:16 +05:00
ttk::radiobutton $w.iso.subdiv.one -text "1" -variable visoptions.subdivisions -value 1 \
2009-01-18 01:52:26 +05:00
-command {
#set visoptions.subdivisions 1;
Ng_Vis_Set parameters; redraw;
}
2016-02-08 19:53:16 +05:00
ttk::radiobutton $w.iso.subdiv.two -text "2" -variable visoptions.subdivisions -value 2 \
2009-01-18 01:52:26 +05:00
-command {
#set visoptions.subdivisions 2;
Ng_Vis_Set parameters; redraw;
}
2016-02-08 19:53:16 +05:00
ttk::radiobutton $w.iso.subdiv.three -text "3" -variable visoptions.subdivisions -value 3 \
2009-01-18 01:52:26 +05:00
-command {
#set visoptions.subdivisions 3;
Ng_Vis_Set parameters; redraw;
}
2016-02-08 19:53:16 +05:00
ttk::radiobutton $w.iso.subdiv.four -text "4" -variable visoptions.subdivisions -value 4 \
2009-01-18 01:52:26 +05:00
-command {
#set visoptions.subdivisions 4;
Ng_Vis_Set parameters; redraw;
}
2016-02-08 19:53:16 +05:00
ttk::radiobutton $w.iso.subdiv.five -text "5" -variable visoptions.subdivisions -value 5 \
2009-01-18 01:52:26 +05:00
-command {
#set visoptions.subdivisions 5;
Ng_Vis_Set parameters; redraw;
}
2016-02-08 19:53:16 +05:00
ttk::label $w.iso.subdiv.text -text "subdivision"
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
pack $w.iso.subdiv -side right -fill y -padx 4 -pady 7
2009-01-18 01:52:26 +05:00
# ; Ng_SetNextTimeStamp
2016-02-26 16:19:26 +05:00
#pack $w.iso.subdiv.text -side top
#pack $w.iso.subdiv.zero -side left
#pack $w.iso.subdiv.one -side left
#pack $w.iso.subdiv.two -side left
#pack $w.iso.subdiv.three -side left
#pack $w.iso.subdiv.four -side left
#pack $w.iso.subdiv.five -side left
grid $w.iso.subdiv.zero $w.iso.subdiv.one $w.iso.subdiv.two $w.iso.subdiv.three $w.iso.subdiv.four $w.iso.subdiv.five
grid anchor $w.iso.subdiv center
2009-01-18 01:52:26 +05:00
# scale $w.iso.zpos -orient horizontal -length 100 -from 0 -to 1 \
# -label "z-position" \
# -resolution 0.01 \
# -variable visoptions.zposition \
# -command {
# catch {NGS_Set zpos ${visoptions.zposition};}
# redraw }
# pack $w.iso.zpos -side right
2016-02-26 16:19:26 +05:00
ttk::labelframe $w.redraw -relief groove -borderwidth 3 -text "Auto-redraw"
2016-02-08 19:53:16 +05:00
ttk::checkbutton $w.redraw.auto -text "Auto-redraw after (sec)" \
2009-01-18 01:52:26 +05:00
-variable visoptions.autoredraw
2016-02-08 19:53:16 +05:00
# tixControl $w.redraw.val -integer false \
# -variable visoptions.autoredrawtime \
# -options {
# entry.width 6
# label.width 0
# label.anchor w
# }
ttk::spinbox $w.redraw.val -textvariable visoptions.autoredrawtime -from 0 -to 100 -width 3
2016-02-26 16:19:26 +05:00
pack $w.redraw -fill x -ipady 3 -pady 7
grid $w.redraw.auto $w.redraw.val -sticky nw
grid anchor $w.redraw center
2009-01-18 01:52:26 +05:00
ttk::labelframe $w.lowerframe -text "Additional viewing options" -relief groove -borderwidth 3
2016-02-26 16:19:26 +05:00
pack $w.lowerframe -fill x
set w $w.lowerframe
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
#pack [frame $w.f] -fill x
#pack [ttk::frame $w.f1] -expand yes
ttk::frame $w.f1
set f [ttk::frame $w.f1.clipsol]
pack $f -anchor e
2016-02-08 19:53:16 +05:00
menu $f.m
ttk::menubutton $f.b -menu $f.m -width 12
ttk::label $f.l -text "Clipping Plane Sol: "
global visoptions.clipsolution
set clipsollabs(none) "None"
set clipsollabs(scal) "Scalar Function"
set clipsollabs(vec) "Vector Function"
foreach i { none scal vec } {
set textval $clipsollabs($i)
$f.m add command -label "$textval" -command \
"$f.b configure -text \"$textval\" ; set visoptions.clipsolution $i ; Ng_Vis_Set parameters ; redraw ; puts \"call redraw\" "
2016-02-08 19:53:16 +05:00
}
pack $f.b $f.l -side right
$f.m invoke $clipsollabs(${visoptions.clipsolution})
# pack [ttk::frame $w.f1.scalfun] -anchor e
2016-02-26 16:19:26 +05:00
set f [ttk::frame $w.f1.scalfun]
2016-02-08 19:53:16 +05:00
pack $f -anchor e
menu $f.m
ttk::menubutton $f.b -menu $f.m -width 12
ttk::label $f.l -text "Scalar Function: "
set scalentries [list none None]
2009-01-18 01:52:26 +05:00
2016-02-08 19:53:16 +05:00
for { set i 1 } { $i <= [Ng_Vis_Field getnfieldnames] } { incr i } {
set fname [Ng_Vis_Field getfieldname $i]
set fcomp [Ng_Vis_Field getfieldcomponents $i]
if { $fcomp == 1 } {
lappend scalentries $fname:1 $fname
} {
for { set j 1 } { $j <= $fcomp } { incr j } {
lappend scalentries $fname:$j "$fname ($j)"
}
lappend scalentries $fname:0 "func ($fname)"
}
}
global visoptions.scalfunction
foreach { name textval } $scalentries {
$f.m add command -label "$textval" -command \
"$f.b configure -text \"$textval\" ; set visoptions.scalfunction $name ; Ng_Vis_Set parameters ; redraw ; "
}
pack $f.b $f.l -side right
foreach { name textval } $scalentries {
if { ${visoptions.scalfunction} == $name } {
$f.m invoke $textval
}
}
2016-02-26 16:19:26 +05:00
set f [ttk::frame $w.f1.vecfun]
2016-02-08 19:53:16 +05:00
pack $f -anchor e
menu $f.m
ttk::menubutton $f.b -menu $f.m -width 12
ttk::label $f.l -text "Vector Function: "
set vecentries [list none None]
2009-01-18 01:52:26 +05:00
2016-02-08 19:53:16 +05:00
for { set i 1 } { $i <= [Ng_Vis_Field getnfieldnames] } { incr i } {
set fname [Ng_Vis_Field getfieldname $i]
set fcomp [Ng_Vis_Field getfieldcomponents $i]
set iscomplex [Ng_Vis_Field iscomplex $i]
set sdim [Ng_Vis_Field getdimension]
if { $iscomplex == 1 } { set fcomp [expr $fcomp / 2] }
if { ($fcomp == $sdim) || ($fcomp == 3) } {
lappend vecentries $fname $fname
}
}
global visoptions.vecfunction
foreach { name textval } $vecentries {
$f.m add command -label "$textval" -command \
"$f.b configure -text \"$textval\" ; set visoptions.vecfunction $name ; Ng_Vis_Set parameters ; redraw ; "
}
pack $f.b $f.l -side right
foreach { name textval } $vecentries {
if { ${visoptions.vecfunction} == $name } {
$f.m invoke $textval
}
}
2016-02-26 16:19:26 +05:00
set f [ttk::frame $w.f1.evaluate]
2016-02-08 19:53:16 +05:00
pack $f -anchor e
menu $f.m
ttk::menubutton $f.b -menu $f.m -width 12
ttk::label $f.l -text "Evaluate: "
global visoptions.evaluate
set evallabs(abs) "| |"
set evallabs(abstens) "|tensor|"
set evallabs(mises) "Mises"
set evallabs(main) "Main"
foreach i { abs abstens mises main } {
set textval $evallabs($i)
$f.m add command -label "$textval" -command \
"$f.b configure -text \"$textval\" ; set visoptions.evaluate $i ; "
}
pack $f.b $f.l -side right
$f.m invoke $evallabs(${visoptions.evaluate})
2016-02-26 16:19:26 +05:00
pack [ttk::frame $w.f1.multidim] -fill x
set f [ttk::frame $w.f1.multidim.f]
pack $f -anchor e
2016-02-08 19:53:16 +05:00
ttk::label $f.l1 -text "multidim-component: "
ttk::spinbox $f.sb1 -from 0 -to 1e99 -textvariable visoptions.multidimcomponent -width 3 \
-command { Ng_Vis_Set parameters; redraw }
pack $f.l1 $f.sb1 -side left
2009-01-18 01:52:26 +05:00
2016-02-26 16:19:26 +05:00
ttk::frame $w.fcb
# the 2 main frames
grid $w.f1 $w.fcb -sticky nw -padx 7 -ipady 3
grid anchor $w center
2016-02-08 19:53:16 +05:00
2016-02-26 16:19:26 +05:00
#pack $w.fcb
2016-02-08 19:53:16 +05:00
ttk::frame $w.fcb.cb
pack $w.fcb.cb
ttk::checkbutton $w.fcb.cb.showsurfsolution -text "Draw Surface Vectors" \
2010-04-04 12:25:23 +06:00
-variable visoptions.showsurfacesolution \
-command { Ng_Vis_Set parameters; redraw }
2016-02-08 19:53:16 +05:00
ttk::checkbutton $w.fcb.cb.showcurves -text "Show Curves" \
2010-04-04 12:25:23 +06:00
-variable visoptions.drawpointcurves \
-command { Ng_Vis_Set parameters; redraw }
2016-02-08 19:53:16 +05:00
ttk::checkbutton $w.fcb.cb.imaginary -text "Imaginary Part" \
2010-04-04 12:25:23 +06:00
-variable visoptions.imaginary \
-command { Ng_Vis_Set parameters; redraw }
2016-02-08 19:53:16 +05:00
ttk::checkbutton $w.fcb.cb.logscale -text "Log Scale" \
2010-04-04 12:25:23 +06:00
-variable visoptions.logscale \
-command { Ng_Vis_Set parameters; redraw }
2016-02-08 19:53:16 +05:00
ttk::checkbutton $w.fcb.cb.invcolor -text "Inverse Color" \
2010-04-04 12:25:23 +06:00
-variable visoptions.invcolor \
-command { Ng_Vis_Set parametersrange; redraw }
2016-02-08 19:53:16 +05:00
ttk::frame $w.fcb.cb.texframe
2010-04-04 12:25:23 +06:00
2016-02-08 19:53:16 +05:00
ttk::checkbutton $w.fcb.cb.texframe.usetexture -text "Use Textures (" \
2010-04-04 12:25:23 +06:00
-variable visoptions.usetexture \
-command { Ng_Vis_Set parameters; redraw }
2016-02-08 19:53:16 +05:00
ttk::checkbutton $w.fcb.cb.texframe.lintexture -text "Linear )" \
2010-04-04 12:25:23 +06:00
-variable visoptions.lineartexture \
-command { Ng_Vis_Set parametersrange; redraw }
2016-02-08 19:53:16 +05:00
ttk::checkbutton $w.fcb.cb.lineartexture -text "Use Linear Texture" \
2010-04-04 12:25:23 +06:00
-variable visoptions.lineartexture \
-command { Ng_Vis_Set parameters; redraw }
scale $w.numcols -orient horizontal -length 100 -from 0 -to 50 \
-resolution 1 \
-variable visoptions.numtexturecols \
-command { popupcheckredraw visual_dialog_pop1 }
2016-02-08 19:53:16 +05:00
ttk::checkbutton $w.fcb.cb.showclipsolution -text "Draw Clipping Plane Solution" \
2010-04-04 12:25:23 +06:00
-variable visoptions.showclipsolution \
-command { Ng_Vis_Set parameters; redraw }
2016-02-08 19:53:16 +05:00
ttk::checkbutton $w.fcb.cb.redrawperiodic -text "Animate periodic" \
2010-04-04 12:25:23 +06:00
-variable visoptions.redrawperiodic \
-command {
redrawperiodic
Ng_Vis_Set parameters;
redraw
}
2016-02-26 16:19:26 +05:00
#pack $w.fcb.cb.showsurfsolution $w.fcb.cb.showcurves -anchor w
#pack $w.fcb.cb.imaginary $w.fcb.cb.logscale $w.fcb.cb.texframe $w.fcb.cb.invcolor $w.fcb.cb.redrawperiodic -side top -anchor w
#pack $w.fcb.cb.texframe.usetexture $w.fcb.cb.texframe.lintexture -side left -expand yes
grid $w.fcb.cb.showsurfsolution -sticky nw
grid $w.fcb.cb.showcurves -sticky nw
grid $w.fcb.cb.imaginary -sticky nw
grid $w.fcb.cb.logscale -sticky nw
grid $w.fcb.cb.texframe -sticky nw
grid $w.fcb.cb.invcolor -sticky nw
grid $w.fcb.cb.redrawperiodic -sticky nw
2016-02-08 19:53:16 +05:00
pack $w.fcb.cb.texframe.usetexture $w.fcb.cb.texframe.lintexture -side left -expand yes
2009-01-18 01:52:26 +05:00
2010-04-04 12:25:23 +06:00
2016-02-26 16:19:26 +05:00
set w .visoptions_dlg.main
ttk::frame $w.bu;# -relief groove -borderwidth 3
pack $w.bu -pady 5 -padx 4
ttk::button $w.bu.showsol -text "Show Solution" -command {
2009-01-18 01:52:26 +05:00
set selectvisual solution
Ng_SetVisParameters
redraw
}
2016-02-26 16:19:26 +05:00
ttk::button $w.bu.clipping -text "Clipping" -command {
2009-01-18 01:52:26 +05:00
clippingdialog;
}
2016-02-26 16:19:26 +05:00
ttk::button $w.bu.fieldlines -text "Fieldlines" -command {
2009-01-18 01:52:26 +05:00
fieldlinesdialog;
}
2016-02-26 16:19:26 +05:00
ttk::button $w.bu.lineplot -text "2D Lineplot" -command {
2009-01-18 01:52:26 +05:00
lineplotdialog;
}
2016-02-26 16:19:26 +05:00
ttk::button $w.bu.done -text "Close" -command {
2009-01-18 01:52:26 +05:00
destroy .visoptions_dlg
}
2016-02-26 16:19:26 +05:00
pack $w.bu.showsol $w.bu.clipping $w.bu.fieldlines $w.bu.lineplot $w.bu.done -side left -expand yes
set w .visoptions_dlg
2009-01-18 01:52:26 +05:00
wm withdraw $w
wm geom $w +100+100
wm deiconify $w
wm title $w "Visualization"
}
}
proc reset_visual_dialog { } {
set w .visoptions_dlg
if {[winfo exists .visoptions_dlg] == 1} {
destroy $w.scalfun $w.vecfun $w.evaluate $w.multidimcomp
destroy $w.imaginary $w.logscale $w.texframe.usetexture $w.texframe.lintexture
destroy $w.texframe
destroy $w.invcolor $w.redrawperiodic
destroy $w.bu -pady 5
destroy $w.bu.showsol $w.bu.clipping $w.bu.fieldlines $w.bu.lineplot $w.bu.done -side left -expand yes
checkbutton $w.imaginary -text "Imaginary Part" \
-variable visoptions.imaginary \
-command { Ng_Vis_Set parameters; redraw }
frame $w.texframe
checkbutton $w.texframe.usetexture -text "Use Textures (" \
-variable visoptions.usetexture \
-command { Ng_Vis_Set parameters; redraw }
checkbutton $w.texframe.lintexture -text "Linear )" \
-variable visoptions.lineartexture \
-command { Ng_Vis_Set parameters; redraw }
checkbutton $w.invcolor -text "Inverse Color" \
-variable visoptions.invcolor \
-command { Ng_Vis_Set parameters; redraw }
2010-04-04 12:25:23 +06:00
checkbutton $w.logscale -text "Log Scale" \
-variable visoptions.logscale \
-command { Ng_Vis_Set parameters; redraw }
2009-01-18 01:52:26 +05:00
checkbutton $w.redrawperiodic -text "Animate periodic" \
-variable visoptions.redrawperiodic \
-command {
redrawperiodic
Ng_Vis_Set parameters;
redraw
}
tixOptionMenu $w.scalfun -label "Scalar Function: " \
-options {
label.width 18
label.anchor e
menubutton.width 12
}
tixOptionMenu $w.vecfun -label "Vector Function: " \
-options {
label.width 18
label.anchor e
menubutton.width 12
}
$w.scalfun add command none -label None
for { set i 1 } { $i <= [Ng_Vis_Field getnfieldnames] } { incr i } {
set fname [Ng_Vis_Field getfieldname $i]
set fcomp [Ng_Vis_Field getfieldcomponents $i]
if { $fcomp == 1 } {
$w.scalfun add command $fname.1 -label $fname
} {
for { set j 1 } { $j <= $fcomp } { incr j } {
$w.scalfun add command $fname.$j -label "$fname ($j)"
}
$w.scalfun add command $fname.0 -label "func ($fname)"
}
}
$w.vecfun add command none -label None
for { set i 1 } { $i <= [Ng_Vis_Field getnfieldnames] } { incr i } {
set fname [Ng_Vis_Field getfieldname $i]
set fcomp [Ng_Vis_Field getfieldcomponents $i]
set iscomplex [Ng_Vis_Field iscomplex $i]
set sdim [Ng_Vis_Field getdimension]
if { $iscomplex == 1 } { set fcomp [expr $fcomp / 2] }
if { ($fcomp == $sdim) || ($fcomp == 3) } {
$w.vecfun add command $fname -label $fname
}
}
$w.scalfun configure -variable visoptions.scalfunction
$w.scalfun configure -command { Ng_Vis_Set parameters; redraw }
$w.vecfun configure -variable visoptions.vecfunction
$w.vecfun configure -command { Ng_Vis_Set parameters; redraw }
# puts "sclfunction = ${visoptions.scalfunction}"
tixOptionMenu $w.evaluate -label "Evaluate: " \
-options {
label.width 18
label.anchor e
menubutton.width 12
}
$w.evaluate add command abs -label "|.|"
$w.evaluate add command abstens -label "|tensor|"
$w.evaluate add command mises -label "Mises"
$w.evaluate add command main -label "Main"
$w.evaluate configure -variable visoptions.evaluate
$w.evaluate configure -command {
Ng_Vis_Set parameters;
redraw
}
pack $w.scalfun $w.vecfun $w.evaluate
tixControl $w.multidimcomp -label "multidim-component: " -integer true \
-variable visoptions.multidimcomponent -min 0 \
-command { Ng_Vis_Set parameters; redraw } \
-options {
entry.width 6
label.width 18
label.anchor e
}
pack $w.multidimcomp
pack $w.imaginary $w.logscale $w.texframe $w.invcolor $w.redrawperiodic
pack $w.texframe.usetexture $w.texframe.lintexture -side left -expand yes
frame $w.bu
pack $w.bu -pady 5
button $w.bu.showsol -text "Show Solution" -command {
set selectvisual solution
Ng_SetVisParameters
redraw
}
button $w.bu.clipping -text "Clipping" -command {
clippingdialog;
}
button $w.bu.fieldlines -text "Fieldlines" -command {
fieldlinesdialog;
}
button $w.bu.lineplot -text "2D Lineplot" -command {
lineplotdialog;
}
button $w.bu.done -text "Close" -command {
destroy .visoptions_dlg
}
pack $w.bu.showsol $w.bu.clipping $w.bu.fieldlines $w.bu.lineplot $w.bu.done -side left -expand yes
wm withdraw $w
wm deiconify $w
}
}