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

proc tranair_write_input {} {
    global confname file_name tranair_output_path icem_powermesh
    global file_name
   
    set domains [domain_select $file_name(domains_dir) "Select structured domains." struct 0]
    if {$domains == {}} return

    get_boco_topo

    set outfile $file_name(transfer_dir)/tranair
   
    if {![dialog .tranair "TRANAIR" \
          "Please edit the following tranair options." {
               {topofile -type path -title "Topo file" -help "Topology file"}
               {bocofile -type path -title "Boco file" -help "Boundary condition file"}
               {outfile -type path -title "Output file" -help "Output file"}
           }]} return
   
    if {![file exists $topofile]} {
        errormsg "File $topofile doesn't exist"
        return
    }

    if {![file exists $bocofile]} {
        errormsg "File $bocofile doesn't exist"
        return
    }
    
    cmd_rm domain_list
    set text ""
    foreach d $domains { append text "$d\n" }
    ic_write_file domain_list $text

    set command "\"$tranair_output_path\" -dom_list domain_list \
                -t \"$topofile\" -f \"$ftopofile\" -b \"$bocofile\" -log"
    set command "$command \"$outfile\""

    runcom $command ""

}
