#! /usr/local/tk3.2/bin/wish -f
#
# Generate a menu for the known iterative accelerators
proc accel_menu w {
menubutton $w -text "Iterative Method" -menu $w.m
menu $w.m
$w.m add radio -label "GMRES" -command "setit gmres" \
	-variable itit -value gmres
$w.m add radio -label "CG"    -command "setit cg" \
	-variable itit -value cg
$w.m add radio -label "BCGS"  -command "setit bcgs" \
	-variable itit -value bcgs
$w.m add radio -label "TFQMR"  -command "setit tfqmr" \
	-variable itit -value tfqmr
$w.m add radio -label "TCQMR"  -command "setit tcqmr" \
	-variable itit -value tcqmr
$w.m add radio -label "Richardson"  -command "setit richardson" \
	-variable itit -value richardson
$w.m add radio -label "Chebychev"  -command "setit chebychev" \
	-variable itit -value chebychev
$w.m add radio -label "CGS"  -command "setit cgs" \
	-variable itit -value cgs
$w.m invoke 0
# gmres
}

# 
# Set up for the iterative methods; handle the special cases for each method
proc setit s {
    global itm itoptnames itoptvalues itoptvars
    set itm $s  
    set itoptnames {}
    set itoptvalues {}
    set itoptvars  {}
    # set iterative method specific options
    if {[ string compare $itm "gmres" ] == 0} {
	set itoptnames {Restart:}
	set itoptvalues {20}
	set itoptvars  {gmresrestart}
	}
}

