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

proc fensap_write_input {} {
    global confname file_name fensap_output_path icem_powermesh
    global file_name

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

    set gridfile $file_name(transfer_dir)/fensap.grd
    set solfile $file_name(transfer_dir)/fensap.sol

    if {![dialog .fensap "Fensap" \
          "Please edit the following fensap options." {
               {bocofile -type path -title "Boco file" \
                   -help "Boundary condition file"}
	       {gridfile -type path -title "Output grid file" -help "Output grid file"}
	       {solfile -type path -title "Output solution file" -help "Output solution 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 "\"$fensap_output_path\" \"$domain\" \"$gridfile\" \"$bocofile\" \"$solfile\""

    runcom $command ""
}
