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

proc tsar_write_input {} {
    global confname file_name tsar_output_path 
    global file_name

    set cart_file $file_name(mesh_dir)/[file root [file tail $file_name(settings)]].crt
    set mat_file $file_name(mesh_dir)/[file root [file tail $file_name(settings)]].cartmesh
    set outputfile $file_name(transfer_dir)/[file root [file tail $file_name(settings)]].tsar
    get_boco_topo
    set ascii 1
    set bocoflag 1

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

    if {![dialog .tsar "TSAR" \
      "Please edit the following TSAR options." {
	{mat_file -type path -title "Cartesian Material File from Global"}
	{bocofile -type path -title "Boundary conditions file"}
	{ascii -opt {{ASCII 1} {binary 0}} -title "Specify output type"}
        {outputfile -type path -title "Output TSAR File"}
    }]} return

#   {ascii -opt {{ASCII 1} {binary 0}} -title "Specify output type"}
#   set command "\"$tsar_output_path\" -dom \"$domain\" -cart \"$cart_file\" \"$outputfile\""
    set command "\"$tsar_output_path\" -mat \"$mat_file\" -b \"$bocofile\" \"$outputfile\""
    if $ascii {set command "$command -fmt"}
#   if $bocoflag {set command "$command -b \"$bocofile\""}
    runxcom ICEM-CFD/TSAR-Interface $command "" 1 0
}
