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

proc ll_dyna3d_write_input {} {
    global confname file_name ll_dyna3d_output_path icem_powermesh
    global file_name

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

    set pname [file rootname [file rootname [file tail $file_name(settings)]]]
	if {$pname==""} {set pname lldyna}
    
    set outfile $pname
#	set bocofile $file_name(mesh_dir)/family_boco.fbc
    set paramfile $file_name(solver_params)
    set no_bar 0
    set no_shell 0

    if {![dialog .ll_dyna3d "ll_dyna3d" \
		"Please edit the following ll_dyna3d options." {
			{bocofile -type path -title "Boco file" \
				-help "Boundary Conditions File"}
			{outfile -type path -title "Output file" 
				-help "Output File"}
			{paramfile -type path -title "Params file" 
				-help "Solver Parameters File"}
			{no_bar -opt {{"yes" 1} {"no" 0}} 
		      -title "Ignore BAR elements"}
			{no_shell -opt {{"yes" 1} {"no" 0}}
		      -title "Ignore TRI & QUAD elements"}
		}]} return
  
    if {![file exists $bocofile]} {
        errormsg "Bound. Cond. file $bocofile doesn't exist"
        return
    }

    if {![file exists $paramfile]} {
	    errormsg "Parameter file $paramfile doesn't exist"
	    return
    }
 
    set command "\"$ll_dyna3d_output_path\" -dom \"$domain\" -b \"$bocofile\" -par \"$paramfile\""
    #if $large   {set command "$command -large"}
    set command "$command \"$outfile\""
    if $no_bar   {set command "$command -no_bar"}
    if $no_shell {set command "$command -no_shell"}

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