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

proc coliseum_write_input {} {
    global confname coliseum_output_path icem_powermesh st_el st_nod
    global file_name

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

    set outfile $file_name(transfer_dir)/coliseum

    get_boco_topo

    set quadratic 0
    set quad8 0
    set penta15 0
    set hexa20 0
    set st_el 1
    set st_nod 1
    set scale 1
    set x 1.0
    set y 1.0
    set z 1.0

    if {![dialog .coliseum "COLISEUM" \
          "Please edit the following COLISEUM options." {
               {bocofile -type path -title "bocofile" \
                        -help "Boundary Conditions File"}
               {outfile -type path -title "Output file" -help "Output File"}
	       {quadratic -opt {{On 1} {Off 0}} \
			-title "Option to remove the mid-face nodes for quadratic mesh"}
               {quad8 -opt {{"QUAD_8" 1} {"QUAD_9" 0}} -active {$quadratic} \
                        -title "Set number of nodes for 2D QUAD elements" }
               {penta15 -opt {{"WEDGE_15" 1} {"WEDGE_18" 0}} -active {$quadratic} \
                        -title "Set number of nodes for 3D WEDGE elements" }
               {hexa20 -opt {{"HEXA_20" 1} {"HEXA_27" 0}} -active {$quadratic} \
                        -title "Set number of nodes for 3D HEXA elements" }
               {st_el -type string  -title "Starting element number"}
               {st_nod -type string  -title "Starting node number"}
	       {scale -opt {{"Yes" 1} {"No" 0}} -title "Scaling"}
               {x -type string -active {$scale} -title "x scaling factor" }
               {y -type string -active {$scale} -title "y scaling factor" }
               {z -type string -active {$scale} -title "z scaling factor" }
           }]} return
  
    if {![file exists $domain]} {
        errormsg "Domain file $domain doesn't exist"
        return
    }

    set command "\"$coliseum_output_path\" -dom \"$domain\" -b \"$bocofile\"" 
    if $quad8   {set command "$command -quad8"}
    if $penta15 {set command "$command -penta15"}
    if $hexa20  {set command "$command -hexa20"}
    set command "$command -ste $st_el -stn $st_nod"
    if $scale   {set command "$command -scale $x,$y,$z"}
    set command "$command \"$outfile\""

    runxcom ICEM-CFD/COLISEUM-Interface $command "" 1 0
}
