
# This code is shared by all the ICEM CFD GUI's.
#
# Copyright (c) 1996 Pacific Marketing and Consulting, Inc,
#       and ICEM Systems, GmbH.  All rights reserved.
# Author:  Wayne A. Christopher, wayne@icemcfd.com
#
# Usage: famboco_edit.tcl [ bocos | mparams ] file solver

proc meshparam_edit {} {
    global famboco_data meshparam_data
    
    array set ismp { maxsize 1 height 1 ratio 1 width 1 minsize 1 }
    set family_list [lsort [array names famboco_data]]
    set param_list [lsort [array names ismp]]
    
    foreach f $family_list {
	foreach bc $famboco_data($f) {
	    set n [lindex $bc 1]
	    set v [lindex $bc 2]
	    if [info exists ismp($n)] {
		set meshparam_data($f,$n) $v
	    } else {
		lappend otherbcs($f) $bc
	    }
	}
    }
    set d [form_init .meshparams "Meshing params"]
    set scr $d; #[form_scroller .meshparams.s 400 {0 0}]
    set r 0; set c 1
    foreach p $param_list {
	form_label $scr.l$p $p "$r $c"
	incr c
    }
    incr r; set c 0
    foreach f $family_list {
	form_label $scr.f$f $f "$r $c"
	incr c
	foreach p $param_list {
	    form_entry $scr.v$f$p meshparam_data($f,$p) string "$r $c"
	    incr c
	}
	incr r; set c 0
    }
    form_finish +300+300

    if ![form_wait .meshparams] { return 0 }
    
    foreach f $family_list {
	foreach p $param_list {
	    if {[string trim $meshparam_data($f,$p)] != ""} {
		lappend otherbcs($f) [list 1 $p $meshparam_data($f,$p)]
	    }
	}
	set famboco_data($f) $otherbcs($f)
    }
    
    return 1
}
