
# ICEM CFD solver interface routine for the manager.
#
# Copyright (c) 1993-1995 ICEM Systems.

proc ugrid_write_input {} {
    global file_name ugrid_output_path file_name 

    set domain [domain_select $file_name(domains_dir) "Select an unstructured domain." \
        unstruct 0]
    if {$domain == {}} return
    
    get_boco_topo

# set outputfile to prefix of .prj file
    set outputfile [file root [file tail $file_name(settings)]]

    set msg "Please edit the following UGRID options."
    if {![dialog .ugrid "UGRID" $msg {
	{bocofile -type path -title "Boundary condition file"}
	{outputfile -type path -title "Prefix of output files"}
    }]} return
	
    if {![file exists $bocofile]} {
	errormsg "Boundary condition file doesn't exist!"
	return
    }

    set command "\"$ugrid_output_path\""

    set command "$command -dom \"$domain\" -b \"$bocofile\" -o \"$outputfile\""

    runcom $command ""
}
