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

proc datex_write_input {} {
    global confname file_name datex_output_path icem_powermesh
    global file_name

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

    get_boco_topo

    set outfile $file_name(transfer_dir)/datex

    if {![dialog .datex "Datex" \
          "Please edit the following datex options." {
               {bocofile -type path -title "Boco file" \
                   -help "Boundary condition file"}
               {outfile -type path -title "Output file" -help "Output file"}
           }]} return

    if {![file exists $domain]} {
        errormsg "Domain file $domain doesn't exist"
        return
    }

    if {![file exists $bocofile]} {
        errormsg "File $bocofile doesn't exist"
        return
    }

    set command "\"$datex_output_path\" -dom \"$domain\" \
                -b \"$bocofile\" \"$outfile\""

    runcom $command ""
}
