
# FIXME: this is dumb to have a proc for this - just put the set statements at the
# toplevel -Wayne

proc InitializeMedGlobals {} {
    global geom_visible str_option
    global black_and_white please_wait_font toplevel
    global use_xwindows use_xwindows_set
    global icon_size1 icon_size2
    global boldfont
    global options disp_options
    global file_name file_save saved_params_reset_cmd saved_params
    global saved_params_no_reset_defaults
    global bandwidth
    global smooth unstruct_diag unstruct_diag_maps
    global diagnostic_data diag_options
    global aie_select_options
    global auto_raise_forms
    global custom_metric_keys custom_metric
    global load_tetin_triangle_tolerance tetin_keep_model_params
    global catia_trans gems_trans step_trans iges_trans proe_trans ug_trans idi_trans
    global med_index_base smoothTypes smoothTypesSOE
    global hardcopy has_fromppm job_title job_name tool_name
    global auto_pick_mode savedview histo_small_layout
    global batch_mode
    global options option_subtype prev_use_xwindows use_xwindows
    global undo_save_whole_mesh undo_max_memory gsys_display_list_max_size
    global geom_fast_dynamics med_fast_dynamics tdv_dynamics_speed_thresh
    global med_float_precision tdv_quadratic_accuracy med_index_base
    global mesh_min_moving_element_aspect tdv_background_color tdv_lighting
    global smooth_do_map smooth_show_map tdv_rubbox_overlay tdv_start_spaceball
    global tdv_control_display_lists tdv_use_opengl_feedback
    global tdv_use_opengl_lighting tdv_home_shrink tdv_enable_smooth_move
    global tdv_use_dual_lighting tdv_auto_simplify_geom tdv_opengl_renormalizing
    global tdv_skip_visible_check tdv_show_ansys_logo tdv_geom_simp
    global disable_overlay
    global uns_use_subset
    global uns_select_for take_first_press
    global solver_setup solver_type solver_setup_global
    global aie_meshStyle
    global fam_active
    global select_geo_0d select_mesh_1d select_mesh_2d select_mesh_3d
    global select_mesh_0d select_mesh_1d  select_mesh_2d  select_mesh_3d
    global toolBarInfo
    global busy_cur
    global env guibase_dir
    global aie_temp_uns_map
    global aie_subents
    global or_type
    global is_win
    global use_local_select
    global icem_fluent
    global thickness_defined
    global fam_visible
    global select_in_dynamics
    global layers_data cross_section_data
    global table_data
    global toptol_userset
    global map_tetin_sizes import_model_options
    global aie_meshDisplay
    global product_mode vis3_off_mode cart3d_mode beta_mode gui_style_mode
    global v3p_interp_data
    global lcs_data
    global prompt_for_bld_topo prompt_for_bld_topo_opts named_sels_as_parts 
    global globalCache
    global cartfile_visible
    global geo_params_blank_done
    global hexa_sel
    global curve_properties
    global file_save  file_save_type file_save_fam
    global tdv_picked
    global hexa_corners_selected
    global load_only_prism_params
    global aie_current_flavor
    global chmhelp chmhelpfile
    global global_mesh_params
    global savedTreeVisibility last_view
    global cut_info
    global bc_name_list mat_name_list tbl_name_list param_name_list lcs_name_list
    global modify_material modify_material_tbl modify_param
    global ptsetup
    global saved_views volume_select surface_select
    global mesh_subset_shading aie_ShowParametrized
    global geom_off_mode mesh_off_mode meshedit_off_mode hexa_off_mode preprocessing_off_mode output_off_mode

    if ![info exists aie_current_flavor] { set aie_current_flavor "" }

    if ![info exists savedTreeVisibility] { set savedTreeVisibility "" }
    if ![info exists last_view] { set last_view "" }
    if ![info exists cut_info] {
         array set cut_info {
              active 0
         }
    }

    if ![info exists bc_name_list] { set bc_name_list "" }
    if ![info exists mat_name_list] { set mat_name_list "" }
    if ![info exists tbl_name_list] { set tbl_name_list "" }
    if ![info exists param_name_list] { set param_name_list "" }
    if ![info exists lcs_name_list] { set lcs_name_list "" }
    if ![info exists ptsetup] {array set ptsetup {}}
    set modify_material 0
    set modify_material_tbl 0
    set modify_param 0

    set chmhelp 0 
    set chmhelpfile ""
    
    set load_only_prism_params 0

    set hexa_corners_selected ""

    array set tdv_picked { x -1 y -1 }
    
    array set file_save {}
    array set file_save_type {}
    array set file_save_fam {}

    set hexa_sel select

    set geo_params_blank_done 0

    set cartfile_visible 0
    set globalCache { \
			  icon_size1 \
			  icon_size2 \
		      }

    set toptol_userset 0
    array set fam_visible {}
    set icem_fluent 0

    array set layers_data {}
    array set cross_section_data {}
    set table_data ""
    global family_part_preselect

    array set family_part_preselect {}
    set aie_ShowParametrized(edge) 0
    set aie_ShowParametrized(vertex) 0
    set aie_ShowParametrized(edge,entities) ""
    set aie_ShowParametrized(vertex,entities) ""

######################## Hexa globals ###################
    global prism_values env cprism_values
    global prism_extras prism_extra_types last_prism_extra
    global prism_family_on prism_families prism_parts prism_params_file
    global prism_family_height prism_family_ratio prism_family_n_layers
    global par_type
    global prism_mesh_loaded
    global thincut_data
    global allow_plane_selection
    global display_mesh_selection
    global Hexa_dimension
    global icem_fluent
    global hex_diagnostic_3d
    global hex_diagnostic_2d
    global hex_diagnostic_1d
    global bunching_laws
    global quad_types
    global default_bunch_laws
    global use_output_blocks
    global tdv_mouse_bindings
    global hex_line_width
    global hex_option
    global hex_diagnostic_calculate_3d hex_diagnostic_calculate_2d hex_diagnostic_calculate_1d

    array set hex_option {check_blck 0 check_inv 0 old_eparams 0 multigrid_level 0 \
                          wr_hexa7 0 uns_face_mesh one_tri default_bunching_law BiGeometric \
                          default_bunching_ratio 2.0 floating_grid 0 smooth_ogrid 0 proj_limit 0 \
                          n_tetra_smoothing_steps 20 trfDeg 1 hexa_verbose_mode 0 project_bspline 0 project_to_topo 0 \
                          hexa_update_mode 1 find_worst 1-3 uns_face_mesh_method uniform_quad sketching_mode 0 worse_criterion Quality}
    set hex_line_width 1
    set use_output_blocks 0
    set Hexa_dimension 3D
    set allow_plane_selection 1
    set display_mesh_selection 0
    set icem_fluent 0
    set thincut_data ""
    set prism_mesh_loaded 0
    set prism_families ""
    set prism_parts ""
    set prism_params_file ""
    array set prism_family_height {LIVE 0}
    array set prism_family_ratio {LIVE 0}
    array set prism_family_n_layers {LIVE 0}
    array set prism_family_on {LIVE 0}
    array set prism_values {
        law exponential
        layers 3
        ratio 1.2
        height ""
        total_height ""
        fillet 0.10
        ortho_weight 0.50
        max_prism_angle 180
        min_prism_quality 0.01
        init_dir_from_prev ""
        max_aspect_ratio ""
        prism_height_limit ""
        ratio_multiplier ""
        new_volume ""
        side_family ""
        top_family ""
        into_orphan 0
        smoothing_steps 12
        n_triangle_smoothing_steps 5
        triangle_quality ""
        n_tetra_smoothing_steps 10
        first_layer_smoothing_steps 1
        auto_reduction 0
        delete_base_triangles ""
        delete_standalone 1
        do_checks ""
        do_not_allow_sticking ""
        intermediate_write 1
        incremental_write 0
        max_jump_factor 5
        max_size_ratio ""
        min_smoothing_steps 6
        min_smoothing_val 0.1
        ratio_max ""
        refine_prism_boundary 1
        stair_step 1
        stop_columns 1
        tetra_smooth_limit 0.3
        blayer_2d 0
        use_existing_quad_layers 0
        use_prism_v10 0
        interpolate_heights 0
        verbosity_level 1
    }
    array set prism_extras {
        auto_reduction 0
        delete_base_triangles ""
        delete_standalone 1
        do_checks ""
        do_not_allow_sticking ""
        intermediate_write 1
        incremental_write 0
        max_jump_factor 5
        max_size_ratio ""
        min_smoothing_steps 6
        min_smoothing_val 0.1
        ratio_max ""
        refine_prism_boundary 1
        stair_step 1
        stop_columns 1
        tetra_smooth_limit 0.3
        blayer_2d 0
        use_existing_quad_layers 0
        use_prism_v10 0
        interpolate_heights 0
        verbosity_level 1
    }
    # these are logical or on/off values - others require a value
    set prism_extra_types {auto_reduction checksum delete_base_triangles \
        delete_standalone do_checks do_not_allow_sticking extend_pyramids \
        intermediate_write incremental_write parallel_verbose print_memory_usage \
        refine_prism_boundary stair_step stop_columns blayer_2d 
        use_existing_quad_layers use_prism_v10 interpolate_heights}
    array set cprism_values {}
    array set par_type {}
    array set hex_diagnostic_3d {
	"Determinant 2x2x2" {determinant 0 1}
	"Determinant 3x3x3" {determinant_27  0 1}
	Angle               {angle 0 90}
	Volume              {volume 0 20}
	Warpage             {warpage 0 90}
	"Eriksson Skewness" {eriksson 0 1}
	"Aspect ratio"      {aspect_ratio 1 20}
	"Quality"           {{Quality} 0 1}
	"Mid node"          {{Mid node} 0 1}
	"Mid node Angle"    {{Mid node Angle} 0 90}
	"Max warp"          {{Max warp} 0 90}
	"Max warp 4.3v"     {{Max warpgls} 0 90}
	"Orientation"       {{Orientation} 0 90}
	"Max ortho"         {{Max ortho} 0 90}
	"Max ortho 4.3v"    {{Max orthogls} 0 90}
	"Min ortho"         {{Min ortho} 0 90}
	"Taper"             {{Taper} 0 90}
	"Max dihedral angle" {{Max dihedral angle} 90 180}
	"Custom quality"    {{Custom quality} 0 1}
	"Max angle"         {{Max angle} 90 180}
	"Min angle"         {{Min angle} 0 90}
	"Max length"        {{Max length} 0 20}
	"Max side"          {{Max side} 0 20}
	"Min side"          {{Min side} 0 20}
	"Max ratio"         {{Max ratio} 0 20}
	"X size"            {{X size} 0 20}
	"Y size"            {{Y size} 0 20}
	"Z size"            {{Z size} 0 20}	
	"Distortion"        {{Distortion} 0 1}
    "Opp. Face Area Ratio" {{Opp. Face Area Ratio} 0 20} 
    "Opp. Face Parallelism" {{Opp. Face Parallelism} 0 20}
    "Ford"              {{Ford} 0 1} 
	"Max sector volume" {{Max sector volume} 0 20}
	"Min sector volume" {{Min sector volume} 0 20}
	"Volume change"     {{Volume change} 0 20}
	"Constant Radius"   {{Constant Radius} 0 20}
	"Equiangle Skewness"  {{Equiangle Skewness} 0 1}
	"Hex. Face Aspect Ratio"  {{Hex. Face Aspect Ratio} 0 1}
	"Hex. Face Distortion"  {{Hex. Face Distortion} 0 20}
    }

    array set hex_diagnostic_2d {
	"Determinant 2x2x2" {determinant 0 1}
	"Determinant 3x3x3" {determinant_27  0 1}
	Angle               {angle 0 90}
	Volume              {volume 0 20}
	Warpage             {warpage 0 90}
	"Eriksson Skewness" {eriksson 0 1}
	"Aspect ratio"      {aspect_ratio  1 20}
	"Quality"           {{Quality} 0 1}
	"Mid node"          {{Mid node} 0 1}
	"Mid node Angle"    {{Mid node Angle} 0 90}
	"Max warp"          {{Max warp} 0 90}
	"Max warp 4.3v"     {{Max warpgls} 0 90}
	"Max ortho"         {{Max ortho} 0 90}
	"Max ortho 4.3v"    {{Max orthogls} 0 90}
	"Min ortho"         {{Min ortho} 0 90}
	"Taper"             {{Taper} 0 90}
	"Custom quality"    {{Custom quality} 0 1}
	"Max angle"         {{Max angle} 90 180}
	"Min angle"         {{Min angle} 0 90}
	"Max length"        {{Max length} 0 20}
	"Max side"          {{Max side} 0 1}
	"Min side"          {{Min side} 0 1}
	"Max ratio"         {{Max ratio} 0 20}
	"X size"            {{X size} 0 1}
	"Y size"            {{Y size} 0 1}
	"Z size"            {{Z size} 0 1}	
	"Distortion"        {{Distortion} 0 1}
     "Ford"             {{Ford} 0 1} 
    }

    array set hex_diagnostic_1d {
	"Determinant 2x2x2" {determinant 0 1}
	"Determinant 3x3x3" {determinant_27  0 1}
	Angle               {angle 0 90}
	Volume              {volume 0 20}
	Warpage             {warpage 0 90}
	"Eriksson Skewness" {eriksson 0 1}
	"Aspect ratio"      {aspect_ratio  1 20}
	"Quality"           {{Quality} 0 1}
	"Mid node"          {{Mid node} 0 1}
	"Mid node Angle"    {{Mid node Angle} 0 90}
	"Max warp"          {{Max warp} 0 90}
	"Max warp 4.3v"     {{Max warpgls} 0 90}
	"Max ortho"         {{Max ortho} 0 90}
	"Max ortho 4.3v"    {{Max orthogls} 0 90}
	"Min ortho"         {{Min ortho} 0 90}
	"Taper"             {{Taper} 0 90}
	"Custom quality"    {{Custom quality} 0 1}
	"Max angle"         {{Max angle} 90 180}
	"Min angle"         {{Min angle} 0 90}
	"Max length"        {{Max length} 0 20}
	"Max side"          {{Max side} 0 1}
	"Min side"          {{Min side} 0 1}
	"Max ratio"         {{Max ratio} 0 20}
	"X size"            {{X size} 0 1}
	"Y size"            {{Y size} 0 1}
	"Z size"            {{Z size} 0 1}	
	"Distortion"        {{Distortion} 0 1}
    "Ford"              {{Ford} 0 1} 
    }

    set hex_diagnostic_calculate_3d {
        Volume "Max length" "Max side" "Min side" "Max ratio" "X size" "Y size" "Z size" \
        "Opp. Face Area Ratio" "Opp. Face Parallelism" "Max sector volume" "Min sector volume" \
        "Hex. Face Distortion" "Volume change" "Constant Radius"
    }

    set hex_diagnostic_calculate_2d {
        Volume "Max length" "Max side" "Min side" "Max ratio" "X size" "Y size" "Z size"
    }

    set hex_diagnostic_calculate_1d {
        Volume "Max length" "Max side" "Min side" "Max ratio" "X size" "Y size" "Z size"
    }


    # ********** DONT CHANGE THIS ********** - used also by hexa
    array set bunching_laws {
	    BiGeometric        default
	    Uniform            uniform
	    Hyperbolic         hyperbolic
	    Poisson            poisson
	    Curvature          curvature
	    Geometric1         geo1
	    Geometric2         geo2
	    Exponential1       exp1
	    Exponential2       exp2
	    Biexponential      biexponential
	    FullCosinus        fcosinus
	    HalfCosinus1       hcosinus1
	    HalfCosinus2       hcosinus2
	    Linear             linear
	    Spline             spline
	    On-Screen          ""
	    From-Graphs        ""
	    FromEdgeSplits     from_edge_pnts
	    UserDefined        userdefined
	    ReferenceMesh      from_refmesh
    }

    array set default_bunch_laws {
	    BiGeometric        default
	    Uniform            uniform
	    Hyperbolic         hyperbolic
	    Poisson            poisson
    }

    array set quad_types {
	    "All Quad"        all_quads
	    "Quad w/one Tri"  one_tri
	    "Quad Dominant"   several_tris
	    "All Tri"         all_tris
	    "Tri (STL like)"  stl
    }
    
    # I don't know where this should go
    set aie_meshDisplay(midside_nodes) 1
    
########################################################

    set use_local_select 0
    array set aie_subents {}
    set busy_cur [list @$guibase_dir/busy.cur orange]

    set toolBarInfo(activeDEZ) ""
    set toolBarInfo(activeWin) ""
    set fam_active ""
    set aie_temp_uns_map ""

    set uns_select_for select
    set take_first_press 0

    set solver_setup -1
    set solver_type 1
    set solver_setup_global 0
    set thickness_defined 0
    if {[info exists env(AI_ENV_ANSYS_SOLVERS)] || [info exists env(AI_ENV_ANSYS)]} { set solver_setup_global 1 }

    set product_mode ""
    set geom_off_mode 0
    set mesh_off_mode 0
    set meshedit_off_mode 0
    set hexa_off_mode 0
    set preprocessing_off_mode 0
    set output_off_mode 0
    
    set vis3_off_mode 0
    set cart3d_mode 0
    
    set beta_mode 0
    if [info exists env(AI_NO_GEOM)] { set geom_off_mode $env(AI_NO_GEOM) }
    if [info exists env(AI_NO_MESH)] { set mesh_off_mode $env(AI_NO_MESH) }
    if [info exists env(AI_NO_MESHEDIT)] { set meshedit_off_mode $env(AI_NO_MESHEDIT) }
    if [info exists env(AI_NO_BLOCKING)] { set hexa_off_mode $env(AI_NO_BLOCKING) }
    if [info exists env(AI_NO_PREPROCESSING)] { set preprocessing_off_mode $env(AI_NO_PREPROCESSING) }
    if [info exists env(AI_NO_OUTPUT)] { set output_off_mode $env(AI_NO_OUTPUT) }
    if [info exists env(AI_NO_POST)]     { set vis3_off_mode $env(AI_NO_POST) }
    if [info exists env(AI_ENV_BETA)]    { set beta_mode $env(AI_ENV_BETA) }

    set disable_overlay 0
    if {[info exists env(ICEM_NO_OVERLAY)]} {set disable_overlay $env(ICEM_NO_OVERLAY)}

    set or_type ""

    if {[info exists env(AI_ENV_PRODUCT)] && ($env(AI_ENV_PRODUCT) == "fea2.0" || $env(AI_ENV_PRODUCT) == "commonstruct" )} {
        set env(AI_ENV_FEA) 1
        set env(AI_ENV_HEXA) 1
        set env(AI_ENV_TETRA) 1
        set env(AI_ENV_QUAD) 1
        set env(AI_ENV_PRISM) 1
        set env(AI_ENV_BFCART) 1
        set env(AI_ENV_GLOBAL) 1
        set env(AI_ENV_POSTPROCESSING) 1
        set env(AI_ENV_CFD) 1
    }
    
    if {[info exists env(AI_ENV_AINASTRAN)]} {
	    set solver_type 0
    } elseif {[info exists env(AI_ENV_MSCNASTRAN)]} {
	    set solver_type 1
    }

    array set v3p_interp_data {
        mats ""
        selected_mats ""
        vars ""
        selected_vars ""
        type "Surfaces and Volumes"
        format "ASCII"
        ansys_command "BF"
        ansys_label ""
    }

    array set surface_select {
       tri 1
       quad 1
    }
    
    array set volume_select {
        tetra 1 
        hexa 1
        penta 1
        pyra 1
    }
    
    set lcs_data(Global) [list 0 Global Rectangular 0 0 0 0  0 0 0  0 0 0  0 1.0 1.0]
    
    set uns_use_subset 1
    set mesh_subset_shading Inherited
    set smooth_do_map ""
    set smooth_show_map ""

    set mesh_min_moving_element_aspect 0.1
    set med_float_precision 0
    set tdv_quadratic_accuracy 9
    set med_index_base 0

    set geom_fast_dynamics 1
    set med_fast_dynamics 1
    set tdv_dynamics_speed_thresh 300

    set undo_save_whole_mesh 1
    set undo_max_memory 0
    set gsys_display_list_max_size 100

    set option_subtype general
    set prev_use_xwindows $use_xwindows

    set prompt_for_bld_topo      0
    set prompt_for_bld_topo_opts 0
    set named_sels_as_parts      1

    if !$batch_mode {
        bubble_setup
    }  

    set aie_select_options 1
    
    # set default Off "preselect" toggle. 
    global vam_events
    set vam_events(do_onMotion) 0
    
    set black_and_white 0
    set histo_small_layout 1
    set please_wait_font font1
    set toplevel(single) 0
    #set toplevel(visual) ""
    #set boldfont "helvetica -14 bold"
    set auto_raise_forms 1
    set med_index_base 1
    set smoothTypes ""
    set smoothTypesSOE ""
    set auto_pick_mode 1
    set savedview(pos) "0 0 0"

    set smooth(criterion) Quality
    set unstruct_diag_maps(from_maps) ""
    set unstruct_diag(which) "Aspect ratio"
    set load_tetin_triangle_tolerance 0
    set tetin_keep_model_params 1
    set catia_trans(tetin_name) ""
    set gems_trans(tetin_name) ""
    set step_trans(tetinfile) ""
    set iges_trans(tetin_name) ""
    set proe_trans(tetin_name) ""
    set ug_trans(tetin_name) ""
    set ug_trans(file) ""
    set idi_trans(tetinfile) ""
    set hardcopy(ps_title) .
    set has_fromppm 1
    set job_title .
    set job_name .
    set tool_name ICEMFEA

    array set disp_options {
	uns_disp Wire
	uns_shrink 100
	uns_shrink_npos 0
	uns_normals 0
	uns_normals_colored 0
	uns_only_edges 0
	uns_single_surfaces 0
	uns_multiple_surfaces 0
	uns_changes 0
	uns_icons 0
	uns_icons_normals_vol 0
	uns_couplings 0
	uns_nodes 0
	uns_enums 0
	uns_node_type None
	uns_periodicity 0
	uns_no_inner 0
	uns_vol_bounds 1
	uns_surf_bounds 0
	uns_warn_if_display 500000
	uns_cut_delay_count 1000
	uns_color_by_quality 0
	uns_shell_diagnostic 0
    }

    array set diag_options {
	duplicate {
	    1 duplicate {select fix}
	    "deleting the duplicate elements"
	    ic_uns_delete_contents
	}
	multiple {
	    0 multiple-edge {select}
	}
	triangle_box {
	    0 triangle-box {select fix}
	    "replacing the triangles with a tetra"
	    diag_replace_triangles_with_tetra
	}
	single_2 {
	    0 single/2 {delete select}
	}
	single_multiple {
	    0 single/multiple {delete select}
	}
	standalone {
	    1 standalone {delete select}
	}
	single {
	    0 single-edge {delete select}
	}
	delaunay {
	    0 Delaunay-violating {select}
	}
	overlap {
	    0 overlapping {select fix}
	    "trying to remesh the element regions"
	    ic_uns_fix_subset_by_remeshing
	}
	3_surface_node_internal_faces {
	    0 corner {select}
	}
	uncovered {
	    1 uncovered {select fix}
	    "covering the exposed faces"
	    diag_fix_uncovered_faces
	}
	missing_internal {
	    1 missing-internal {select fix}
	    "adding the missing faces"
	    diag_fix_missing_internal_faces
	}
	periodic_problem {
	    0 "bad periodic" {select}
	}
	bound_edge {
	    0 "boundary" {select}
	}
	nmanvert {
	    1 "non-manifold vertex" {select fix}
	    "splitting the vertices in two"
	    diag_fix_nmanvert
	}
	spikes {
	    0 "spike vertex" {select}
	}
    }

  array set diagnostic_data {    
    duplicate,check   1
    duplicate,def_check   1
    duplicate,desc     duplicate
    duplicate,opts     {select fix}
    duplicate,howfix   "deleting the duplicate elements"
    duplicate,fixfunc  ic_uns_delete_contents
    duplicate,type     derror
    duplicate,verbose  "Duplicate elements"
    
    multiple,check    1
    multiple,def_check    1
    multiple,desc     multiple-edge
    multiple,opts     {select}
    multiple,howfix   ""
    multiple,fixfunc  ""
    multiple,type     dprob
    multiple,verbose  "Multiple edges"
    
    triangle_box,check   1
    triangle_box,def_check   1
    triangle_box,desc     triangle-box
    triangle_box,opts     {select fix}
    triangle_box,howfix   "replacing the triangles with a tetra"
    triangle_box,fixfunc  diag_replace_triangles_with_tetra
    triangle_box,type     dprob
    triangle_box,verbose  "Triangle boxes"
    
    single_2,check    0
    single_2,def_check    0
    single_2,desc      single/2
    single_2,opts      {delete select}
    single_2,howfix    ""
    single_2,fixfunc   ""
    single_2,type      dprob
    single_2,verbose   "2-Single edges"
    
    single_multiple,check   0
    single_multiple,def_check   0
    single_multiple,desc     single/multiple,
    single_multiple,opts     {delete select}
    single_multiple,howfix   ""
    single_multiple,fixfunc  ""
    single_multiple,type     dprob
    single_multiple,verbose  "Single-Multiple edges"
    
    standalone,check    0
    standalone,def_check    0
    standalone,desc     standalone
    standalone,opts     {delete select}
    standalone,howfix   ""
    standalone,fixfunc  ""
    standalone,type     dprob
    standalone,verbose  "Stand-alone surface mesh"
    
    single,check    1
    single,def_check    1
    single,desc     single-edge
    single,opts     {delete select}
    single,howfix   ""
    single,fixfunc  ""
    single,type     dprob
    single,verbose  "Single edges"
    
    delaunay,check  0
    delaunay,def_check  0
    delaunay,desc   Delaunay-violating
    delaunay,opts   {select}
    delaunay,howfix   ""
    delaunay,fixfunc  ""
    delaunay,type     dprob
    delaunay,verbose  "Delaunay-violation"
    
    overlap,check    0
    overlap,def_check    0
    overlap,desc     overlapping
    overlap,opts     {select fix}
    overlap,howfix   "trying to remesh the element regions"
    overlap,fixfunc  ic_uns_fix_subset_by_remeshing
    overlap,type     dprob
    overlap,verbose  "Overlapping elements"
    
    3_surface_node_internal_faces,check  0
    3_surface_node_internal_faces,def_check  0
    3_surface_node_internal_faces,desc   corner
    3_surface_node_internal_faces,opts   {select fix}
    3_surface_node_internal_faces,howfix   ""
    3_surface_node_internal_faces,fixfunc  ""
    3_surface_node_internal_faces,type     ""
    3_surface_node_internal_faces,verbose  ""
    
    uncovered,check    1
    uncovered,def_check    1
    uncovered,desc     uncovered
    uncovered,opts     {select fix}
    uncovered,howfix   "covering the exposed faces"
    uncovered,fixfunc  diag_fix_uncovered_faces
    uncovered,type     derror
    uncovered,verbose  "Uncovered faces"
    
    missing_internal,check    1
    missing_internal,def_check    1
    missing_internal,desc     missing-internal
    missing_internal,opts     {select fix}
    missing_internal,howfix   "adding the missing faces"
    missing_internal,fixfunc  diag_fix_missing_internal_faces
    missing_internal,type     derror
    missing_internal,verbose  "Missing internal faces"
    
    periodic_problem,check    0
    periodic_problem,def_check    0
    periodic_problem,desc     "bad periodic"
    periodic_problem,opts     {select}
    periodic_problem,howfix   ""
    periodic_problem,fixfunc  ""
    periodic_problem,type     derror
    periodic_problem,verbose  "Periodic problems"
    
    bound_edge,check    0
    bound_edge,def_check    0
    bound_edge,desc     "boundary"
    bound_edge,opts     {select}
    bound_edge,howfix   ""
    bound_edge,fixfunc  ""
    bound_edge,type     ""
    bound_edge,verbose  ""
    
    nmanvert,check    1
    nmanvert,def_check    1
    nmanvert,desc     "non-manifold vertex"
    nmanvert,opts     {select fix}
    nmanvert,howfix   "splitting the vertices in two"
    nmanvert,fixfunc  diag_fix_nmanvert
    nmanvert,type     dprob
    nmanvert,verbose  "Non-manifold vertices"
    
    disconnected_vert,check    1
    disconnected_vert,def_check    1
    disconnected_vert,desc     "disconnected vertices"
    disconnected_vert,opts     {delete select}
    disconnected_vert,howfix   ""
    disconnected_vert,fixfunc  ""
    disconnected_vert,type     dprob
    disconnected_vert,verbose  "Unconnected vertices"
    
    vol_orient,check    1
    vol_orient,def_check    1
    vol_orient,desc     "misoriented volume elements"
    vol_orient,opts     {select fix}
    vol_orient,howfix   "reorienting problem elements"
    vol_orient,fixfunc  diag_fix_volume_orientation
    vol_orient,type     derror
    vol_orient,verbose  "Volume orientations"
    
    surf_orient,check    1
    surf_orient,def_check    1
    surf_orient,desc     ""
    surf_orient,opts     {select}
    surf_orient,howfix   ""
    surf_orient,fixfunc  ""
    surf_orient,type     derror
    surf_orient,verbose  "Surface orientations" 
    
    hanging,check     1
    hanging,def_check 1
    hanging,desc      "hanging"
    hanging,opts      {select fix}
    hanging,howfix    delete
    hanging,fixfunc   ic_uns_delete_contents
    hanging,type      derror
    hanging,verbose   "Hanging elements"   
    
    penetrating,check     0
    penetrating,def_check 0
    penetrating,desc      "penetrating"
    penetrating,opts      {select}
    penetrating,howfix    ""
    penetrating,fixfunc   ""
    penetrating,type      derror
    penetrating,verbose   "Penetrating elements" 
    
    disconnbars,check     0
    disconnbars,def_check 0
    disconnbars,desc      "disconnected bar"
    disconnbars,opts      {select fix}
    disconnbars,howfix    delete
    disconnbars,fixfunc   ic_uns_delete_contents
    disconnbars,type      derror
    disconnbars,verbose   "Disconnected bar elements"
  }

    set custom_metric_keys {
	angle distortion aspect warpage skew minside surfdev
    }
    
    array set custom_metric {
	warpage,name "Max warp"
	warpage,active 1
	warpage,quad,acc_min  0
	warpage,quad,des_min  0
	warpage,quad,id       0
	warpage,quad,des_max 10
	warpage,quad,acc_max 30
	warpage,tri,acc_min  -1
	warpage,tri,des_min  -1
	warpage,tri,id   -1
	warpage,tri,des_max  -1
	warpage,tri,acc_max  -1
	
	aspect,name "Aspect ratio"
	aspect,active 1
	aspect,quad,acc_min 0.1 
	aspect,quad,des_min 0.3
	aspect,quad,id      1
	aspect,quad,des_max 1
	aspect,quad,acc_max 1
	aspect,tri,acc_min  0.1
	aspect,tri,des_min  0.3
	aspect,tri,id       1
	aspect,tri,des_max  1
	aspect,tri,acc_max  1
	
	distortion,name "Distortion"
	distortion,active 1
	distortion,quad,acc_min 0.4
	distortion,quad,des_min 0.7
	distortion,quad,id      1
	distortion,quad,des_max 1
	distortion,quad,acc_max 1
	distortion,tri,acc_min -1
	distortion,tri,des_min -1
	distortion,tri,id      -1
	distortion,tri,des_max -1
	distortion,tri,acc_max -1
	
	skew,name "Skew"
	skew,active 1
	skew,quad,acc_min  0
	skew,quad,des_min  0
	skew,quad,id       0
	skew,quad,des_max 45
	skew,quad,acc_max 60
	skew,tri,acc_min   0
	skew,tri,des_min   0
	skew,tri,id        0
	skew,tri,des_max  45
	skew,tri,acc_max  60
	
	angle,name "Angle"
	angle,active 1
	angle,quad,acc_min  30
	angle,quad,des_min  45
	angle,quad,id       90
	angle,quad,des_max 135
	angle,quad,acc_max 150
	angle,tri,acc_min   10
	angle,tri,des_min   30
	angle,tri,id        60
	angle,tri,des_max  120
	angle,tri,acc_max  140
	
	minside,name "Min side"
	minside,active 0
	minside,quad,acc_min  0
	minside,quad,des_min  0
	minside,quad,id       0
	minside,quad,des_max  0
	minside,quad,acc_max  0
	minside,tri,acc_min   0
	minside,tri,des_min   0
	minside,tri,id        0
	minside,tri,des_max   0
	minside,tri,acc_max   0
	
	surfdev,name "Surface dev"
	surfdev,active 0
	surfdev,quad,acc_min  0
	surfdev,quad,des_min  0
	surfdev,quad,id       0
	surfdev,quad,des_max  0
	surfdev,quad,acc_max  0
	surfdev,tri,acc_min   0
	surfdev,tri,des_min   0
	surfdev,tri,id        0
	surfdev,tri,des_max   0
	surfdev,tri,acc_max   0
    }    
    
    array set options {
    win_java_help 0
	record_journal 0
	med_save_emergency_mesh 1
	med_save_emergency_tetin 1
	med_save_emergency_blocking 1
	clean_up_tmp_files 1
	auto_fix_uncovered_faces 1
	editor ""
	bubble_delay 1000
	uns_warn_if_display 500000
	uns_warn_user_if_display 1000000
	edit_wait 0
	select_mode all
	boundary_mode all
	select_edge_mode 0
	flood_select_angle 0
	expert 1
	xhidden_full 1
	use_dlremote 0
	external_num 1
	show_factor 1
	show_tris 1
	diag_which all
	save_to_new 0
	project_active 0
	home_after_load 1
	max_binary_tetin 0
	n_processors 1
	temporary_directory ""
	mouse_color orange
	redtext_color red
	max_cad_map_size 512
	max_mesh_map_size 1024
	clean_up_tmp_files 1
	remote_host ""
	remote_user ""
	remote_path ""
	remote_acn ""
	remote_sh csh
	undo_logging 1
	quality_info Quality
	detail_info 0
	tree_disp_line 0
	tree_disp_node 0
	tree_disp_tri 2
	tree_disp_quad 2
	tree_disp_hexa 0
	tree_disp_tetra 0
	tree_disp_penta 0
	tree_disp_pyra 0
	apply_all 0
	remove_all 0
	display_origin 0
	histo_show_default 1
	histo_solid_default 1
	histo_color_by_quality_default 1
	evaluate_diagnostic 0
    user_name ""
    host_name ""
    keep_existing_file_names 0
    clear_undo 1
    auto_save_views 1
    enable_idle 0
    face_mode all
    select_toggle_corners 0
    replay_internal_editor 1
    }

    array set file_name {
	settings ""
	domain ""
	tetin ""
	family_boco ""
	attributes ""
	cart_file ""
	solver_params ""
	blocking ""
	family_topo ""
	med_replay ""
	hexa_replay ""
	topo_mulcad_out ""
	project_lock ""
	archive ""
	
	settings_loaded 0
	domain_loaded 0
	tetin_loaded 0
	family_boco_loaded 0
	attributes_loaded 0
	cart_file_loaded 0
	solver_params_loaded 0
    
	project_dir ""
	domains_dir ""
	mesh_dir ""
	transfer_dir ""
	parts_dir ""
	topology_dir ""
	catia_dir ""
	iges_dir ""
	ugparts_dir ""
	gemsparts_dir ""
    }

    set saved_params {
	    file_name options disp_options icon_size1 icon_size2 thickness_defined solver_type 
	    solver_setup prism_values aie_current_flavor vid_options 
	    savedTreeVisibility last_view cut_info hex_option saved_views
    }

    array set saved_params_no_reset_defaults {
	    prism_family_on ""
	    prism_values ""
	    prism_family_height ""
	    prism_family_ratio ""
	    prism_family_n_layers ""
	    prism_families ""
	    loaded_domains 1
	    tdv_mouse_bindings 1
	    bubble_delay 1
	    use_xwindows 1
        icon_size1 "24"
        icon_size2 "35"
        aie_current_flavor ""
    }
    
	global vid_options
	array set vid_options {
		replace 0 
		vid_mode 0 
		show_name 0 
		tdv_axes 1
		new_srf_topo 1
		same_pnt_tol 1e-4
		composite_tolerance 1.0
		auxiliary 0
		inherit 1
		default_part GEOM
		DelPerFlag 0
		DelBlkPerFlag 0	
	}

    set tdv_background_color ""

    array set map_tetin_sizes {
	    tetin ""
	    global 1
	    family 1
	    psurfaces 1
	    msurfaces 1
	    pcurves 1
	    mcurves 1
	    ppoint 1
	    thincuts 1
	    densities 1
	    subsets 1
	    mpoint 1
	    doit 0
    }

    if [ic_wb2_is_running] {
        array set import_model_options {
            from_source 0
            named_sel_only 0
            always_convert 0
            always_ref_key 0
            convert_to "Unitless"
            always_create_mpoint 1
            always_import 1
            always_import_blocking 1
        }
    } else {
        array set import_model_options {
            from_source 0
            named_sel_only 0
            always_convert 0
            always_ref_key 0
            convert_to "Unitless"
            always_create_mpoint 1
            always_import 0
            always_import_blocking 1
        }
    }
    
    project_settings_save_defaults
    set optf [home_directory]/.aienv_options
    if [file exists $optf] {
	    if [catch {source $optf} res] {
	        mess "$res\n" red
	    }
    }

    if ![info exists gui_style_mode] {
        set tdv_background_color {1 #6688dd #ffffff}
        set tdv_show_ansys_logo 1
        set gui_style_mode wb
    }

    if $use_xwindows_set {
        set use_xwindows $use_xwindows_set
    }

    #always ON by default
    set options(undo_logging) 1
    set options(select_mode) all

    set editor $options(editor)
    if {$editor == ""} {
	if $is_win {
            set editor notepad
        } else {
            set editor vi
        }
    }
    set env(EDITOR) $editor
    
    if {$beta_mode && [info exists hex_option(sketching_mode)]} {
        if {$hex_option(sketching_mode) == "1"} {
            set env(AI_ENV_HEXA_SKETCHING_MODE) 1
        } else {
            if [info exists env(AI_ENV_HEXA_SKETCHING_MODE)] {
                unset env(AI_ENV_HEXA_SKETCHING_MODE)
            }
        }
    } else {
        if [info exists env(AI_ENV_HEXA_SKETCHING_MODE)] {
            unset env(AI_ENV_HEXA_SKETCHING_MODE)
        }
        set hex_option(sketching_mode) 0
    }
    

    batch_interp eval array set str_option \{[array get str_option]\}
# we want to reset this to the value coming into this routine
# since that is the one specified on the command line (-Mike)
# fixed above - Ganesan
    
############## Global Meshing Param variables ###############

    array set global_mesh_params {
	    tetra_smooth 1
	    tetra_smooth2 1
	    tetra_smooth_niter 5
	    tetra_smooth_niter2 5
	    tetra_smooth_aspect 0.4
	    tetra_smooth_aspect2 0.4
	    tetra_coarsen 0
	    tetra_coarsen_niter 2
	    tetra_coarsen_aspect 0.2
	    tetra_fix_holes 1
	    tetra_fix_nmanifold 1
	    tetra_close_gaps 0
        tetra_use_active_lcs 0
	    tetra_save_tris 0
	    tetra_memory_scale 1
	    tetra_proximity_check 0
	    tetra_fillholes 0
	    tetra_meshall 0
	    tetra_floodfill 0
	    tetra_loadmesh 1
	    tetra_verbose 0
        tetra_bgmesh 0
        tetra_batch 0
	    tetra_run_cutter 1
	    tetra_save_tris 0
	    tetra_auto_orphan 0
        tetra_parallel_verbose 0
        tetra_tgrid_af 0
        tetra_spacing_factor 1
        tetra_expansion_factor 1.2
        tetra_run_adv_delaunay 1 
        tetra_tg_adv_delaunay_af 1

	    hybrid_remeshCenter 0

	    cart_csys 0
	    cart_proj_factor 0.98
	    cart_split_degen 0
	    cart_create_pyramids 0
	    cart_tratio "Uniform"
	    cart_conformal 0
	    cart_bbox ""
	    cart_user_bbox 0
	    cart_fillholes 0
	    cart_nuntangle 10
	    cart_infproj 1

	    cart_refall 1
	    cart_nlayers 1
	
	    cart_maxref -1
	    cart_aspect_ratio "1 1 1"
	    cart_nStart "2 2 2"
	    cart_symx 0
	    cart_symy 0
	    cart_symz 0
	    cart_computevof 0
	    cart_volfrac 0.5
	    cart_faces 0
	    cart_edges 0

	    shrinkwrap_projfactor 0.1
	    shrinkwrap_nsmooth 5
    }
}

proc  InitializeMedGraphics {} {
    global small_screen_hack tdv_axes_var tdv_origin_var top_level
    global tdv_default banner_disables_menus
    global options undo_save_whole_mesh

    #There should be only one tdv_default and  should never be changed any where else;
    # otherwise AI*Env will break - Ganesan
    batch_interp eval "set tdv_default $tdv_default"
    set cmd $tdv_default
    batch_interp alias $cmd gui_$cmd
    proc gui_$cmd args "\
	    global in_$cmd ;\
	    if \[info exists in_$cmd\] \{ puts \"Error: $cmd called re-entrantly\" ; return \"\" \};\
	    set in_$cmd 1 ;\
	    set ret \[eval $cmd \$args\] ;\
	    catch \{ unset in_$cmd \} ;\
	    return \$ret"
    catch {unset banner_disables_menus}

    catch {  # in case we have been compiled without hexa
        #For new hexa on windows
        batch_interp eval setup_tcl_events $tdv_default
    }

    InitGeomDisplaySettings
    InitBlockDisplaySettings
    InitUnsMeshDisplaySettings
    InitStrMeshDisplaySettings
    
    set top_level(single) 0
    set top_level(visual) ""

    # Draw the coord axes
    set small_screen_hack 0
    set tdv_axes_var(.v.view) 1
    set tdv_origin_var(.v.view) 1
    tdv_init_shortcuts 0 {s x}
    tdv_set_key_command j aie_disp_toggle_solid "Toggle solid display"

    tdv_background reset

    foreach n {ambient diffuse specular shininess dir} {
       aie_set_lighting $n $tdv_default
    }

    aie_set_title ""
    
    ic_undo_start
    if [info exists undo_save_whole_mesh] {
        ic_undo_enable_largeop $undo_save_whole_mesh
    }
}

proc InitGeomDisplaySettings {} {
    global str_option geom_visible aie_geoTypeVis
    
    foreach t {point curve surface material density loop body} {
	    set geom_visible($t) 0
	    set str_option($t,names) 0
	    set str_option($t,wide) 0
	    set str_option($t,norms) 0
	    set str_option($t,dtype) simple
	    set str_option($t,stype) wire
	    set str_option($t,sizes) none
	    set str_option($t,transparent) 0
    }
    # visibility must be consistent with initial Tree settings aie_geoTypeVis
    foreach t [array names aie_geoTypeVis] {
        if $aie_geoTypeVis($t) {set geom_visible($t) 1}
    }
    set str_option(point,protect) 0
    set str_option(curve,count) 0    
    set str_option(curve,show_composite) 0    
    foreach attach { show0 show1 show2 show3 } {
	    set str_option(curve,$attach) 1
    }
}

proc InitUnsMeshDisplaySettings {} {
    global aie_meshTypeVis aie_meshNodes aie_meshNodesBackup

    aie_changeMeshDisplay style Wire
    aie_changeMeshDisplay shrink 100
    if [info exists aie_meshNodesBackup(uns_node_type)] {
       aie_changeMeshDisplay nodes $aie_meshNodesBackup(uns_node_type)
    } else {
       aie_changeMeshDisplay nodes None
    }
    aie_changeMeshDisplay shrink_npos 0
    aie_changeMeshDisplay only_edges 0
    aie_changeMeshDisplay single_surfaces 0
    aie_changeMeshDisplay multiple_surfaces 0
    aie_changeMeshDisplay normals 0
    aie_changeMeshDisplay normals_colored 0
    aie_changeMeshDisplay icons 0
    aie_changeMeshDisplay enums 0
    aie_changeMeshDisplay vol_bounds 0
    aie_changeMeshDisplay surf_bounds 0
    aie_changeMeshDisplay color_by_quality 0

    foreach type {node line volume} {
	    set aie_meshTypeVis($type) 0
    }
    set aie_meshTypeVis(shell) 1
    if [info exists aie_meshNodes(Displayed)] {
        unset aie_meshNodes(Displayed)
    }
}

proc InitBlockDisplaySettings {{reset 0}} {
    global aie_blockVertProj aie_blockMeshStyle aie_blockMeshProj
    global display_flag dim_to_mesh enable_exec button_instructions
    global project_type

    if !$reset {
        foreach type {curve vert face block mesh} {
            set display_flag($type) 0
        }
    }
    set display_flag(edge) 1
    set display_flag(edge_vol) 1
    set display_flag(edge_nodes) 0
    set display_flag(edge_shape) 0
    set display_flag(block_super) 1
    set display_flag(block_struct) 1
    set display_flag(block_unstruct) 1
    set display_flag(block_swept) 1
    set display_flag(block_worst) 0
    set project_type -1
    set dim_to_mesh 3
    if !$display_flag(vert) {
        set aie_blockVertProj(proj) 1
        aie_change_vertproj proj
    }
    set aie_blockMeshStyle(1) 1
    aie_change_meshstyle 1
    set aie_blockMeshProj(2) 1
    aie_change_meshproj 2
    set enable_exec 1
    set button_instructions "left button = select; middle = accept, right = back up / cancel."
}

proc InitStrMeshDisplaySettings {} {
    global str_type_visible str_option aie_strShade

    foreach type {subface edge vertex} {
	set str_type_visible($type) 0
	set str_option($type,famcols) 1
    }
    set str_type_visible(domain) 1
    set str_option(domain,simplify) 0
    set str_option(domain,outlines) 1
    set str_option(domain,famcols) 1
    set aie_strShade(domain,none) 1
    aie_change_domain_shade none

    set aie_strShade(subface,wire) 1
    aie_change_subface_shade wire
}

proc SetupBatchGlue {} {
    set aie_gui_functions {	
	aie_create_initial_assemblies
	aie_initGeoVis
	aie_updateMeshVis
	aie_getBatchMeshDisplay
	aie_changeMeshDisplay
	aie_getBatchGeomDisplay
	aie_load_params_file
	aie_after_open_mesh
	aie_after_blocking_loaded
	aie_after_rename_blocking
	aie_saveProject
	aie_updateBlockVis
    }
    foreach cmd $aie_gui_functions {
	# These can't be reentrant
	batch_interp alias $cmd gui_$cmd
	proc gui_$cmd args "\
	    global in_$cmd ;\
	    if \[info exists in_$cmd\] \{ error \"$cmd called re-entrantly\" \};\
	    set in_$cmd 1 ;\
	    set ret \[eval $cmd \$args\] ;\
	    catch \{ unset in_$cmd \} ;\
	    return \$ret"
    }
    foreach cmd  $aie_gui_functions {
	script_interp alias $cmd $cmd
    }
}

set no_all_interaction_button 1
set banner_disables_menus 1
set unknown_options_are_tool_arguments 1
set env(ICEM_CASE_SENSITIVE) y
set tool_id med
set tdv_default .v.view
if ![info exists batch_mode] { set batch_mode 0 } ;# jka 07 July 2003, since this file is source'd after parsing -batch argv[i] 
set options(select_mode) all

# This code creates the user interface for the mesh editor.
#
# Copyright (c) 1993 - 1995 Pacific Marketing and Consulting, Inc,
#       and ICEM Systems, GmbH.  All rights reserved.
# Author:  Wayne A. Christopher, wayne@icemcfd.com

# These are not saved.


# ---------------------------------------------------

# These are saved.

set load_max_dim 3
set check_orientation_after_loading 1
set part_selected ""
set load_tetin_triangle_tolerance 0
set tetin_try_binary 0
set tetin_keep_model_params 1
set loaded_domains ""
set boco_solver ""
set mesh_min_moving_element_aspect 0.1
set tdv_background_color ""
set tdv_quadratic_accuracy 9
set undo_max_memory 0
set undo_save_whole_mesh 1
set merge_point_tol 0
set save_tetin_visible 0
set fam_listsize 6
set fam_sorttype name
set fam_update_mode always
set crease_project -1
set med_float_precision 0
set med_fast_dynamics 1
set geom_fast_dynamics 1
set med_save_emergency_mesh 1
set med_save_emergency_tetin 1
set med_save_emergency_blocking 1
set auto_fix_uncovered_faces 1
set prompt_for_bld_topo  0
set prompt_for_bld_topo_opts 0
set named_sels_as_parts 1
set tdv_start_spaceball 1
set tdv_enable_smooth_move 1

array set struct_move {
    do_translate 0
    do_translate 1
    do_rotate 0
    do_scale 0
    do_mirror 0
    do_flipijk 0
    translate "0 0 0"
    rotate 0
    rotaxis "1 0 0"
    rotaxis_other "1 0 0"
    mirror 0
    mirrornorm "1 0 0"
    flipijk 0
    scale 1
    about origin
    about_point "0 0 0"
    what move
    numcopies 1
    symfams ""
}

array set struct_move_node {
    set_pos 1
    dox 1
    doy 1
    doz 1
    xv 0
    yv 0
    zv 0
    on_geom 1
}

array set unstruct_move_node {
    set_pos 1
    dox 1
    doy 1
    doz 1
    xv 0
    yv 0
    zv 0
}

array set unstruct_move {
    select_elements 0
    do_translate 0
    do_translate 1
    do_rotate 0
    do_scale 0
    do_mirror 0
    translate "0 0 0"
    rotate 0
    rotaxis "1 0 0"
    rotaxis_other "1 0 0"
    mirror 0
    mirrornorm "1 0 0"
    scale 1
    about origin
    about_point "0 0 0"
    what move
    numcopies 1
}

array set geo_move {
    do_translate 0
    do_translate 1
    do_rotate 0
    do_scale 0
    do_mirror 0
    translate "0 0 0"
    rotate 0
    rotaxis "1 0 0"
    rotaxis_other "1 0 0"
    mirror 0
    mirrornorm "1 0 0"
    scale 1
    about origin
    about_point "0 0 0"
    what move
    numcopies 1
    entities ""
}

array set geo_modify {
    move_vec "1 0 0"
    move_norm "1 0 0"
    move_pt1 "0 0 0"
    move_pt2 "0 0 0"
}


if {[info exists env(SHELL)] && ![string match *csh $env(SHELL)]} {
    set options(remote_sh) sh
}

array set diag_option {
    which determinant
    adj 0
    do_histo 1
    min ""
    max ""
    num 50
    hgt ""
}

array set unstruct_diag {
    which Quality
    use_sel 0
    do_histo 1
    min ""
    max ""
    num 50
    hgt ""
}

array set struct_diag {
    which Quality
    use_sel 0
    do_histo 1
    min ""
    max ""
    num 50
    hgt ""
}

array set coarsen {
    aspect 0.2
    max_size ""
    tolerance 0.1
    all 1
}

array set old_smooth {
    alg           tetra
    crit          Determinant
    iters         5
    only_subset   0
    smoothto      10
    max_val       0.3
    laplace       0
    smooth_tets   1
    fix_tets      0 
    smooth_prisms 0
    fix_prisms    1
    smooth_tris   0
    fix_tris      0
    prism_warp_weight 0.5
}

array set smooth {
    collapse 1
    criterion Quality
    iters 5
    laplace 0
    max_val 0.3
    not_just_worst 0
    prism_warp_weight 0.5
    refine 0
    sel_what all
    violate 0
    violate_tol 0.1
    violate_rel 0.1
    sfit 0
    ignore_pp 0
    use_post 0
    post_which HEXA_8
}

array set tri2quad {
    skew         160
    warp         20
    quadrization 1
    improvement  1
    iters        6
    conver       0.25
    which        all
}

array set reorient {
    how dir
    dirx 0
    diry 0
    dirz 0
    vol_in 1
}

array set struct_reorient {
    how sel
    new0 0
    new1 1
    new2 2
    flip0 0
    flip1 0
    flip2 0
    domains ""
    stop_num 0
}

array set reorder {
    how dir
    dirx 1
    diry 0
    dirz 0
}

array set selmap {
    num_layers 1
    layer_mode active_active
    single_element_num 0
    number_global_mode 0
    number_local_type TRI_3
    nearpos "0 0 0"
    nearnode 0
    fill_angle 20
    add_by_edges 1
    rem_by_edges 1
    normal "0 0 1"
    cut_on 0
    cut_whole 1
    cut_scan 0.5
    cut_px 0
    cut_py 0
    cut_pz 0
    cut_nx 1
    cut_ny 0
    cut_nz 0
    reg_x1 0
    reg_y1 0
    reg_z1 0
    reg_x2 0
    reg_y2 0
    reg_z2 0
    reg_part 1
}

array set tetra_values {
    uncut_domain    uncut_domain.1
    cut_domain      cut_domain.1
    run_tetra       1
    run_cutter      1
    cutter_which    volume
    cutter_saveall  1
    cutter_savefams ""
    fix_nonman      1
    run_smoother    1
    smoother_iters  5
    smoother_aspect 0.4
    run_coarsen     0
    auto_orphan	    0
    coarsen_aspect  0.1
    load_after      1
}

array set hexa_values {
    blocking_file ""
    replay_file ""
}

array set frontal_values {
    tol 0.01
    x 0
    y 0
    z 1
    curve_file ""
}

array set select_defaults {
    type   ""
    family ""
}

array set refine {
    deviation  0
    steps      1
    use_all    0
    do_project 1
    use_tol    0
}

array set quad {
    element 1
    iters 20
    conver 0.025
    complete_edges 0
    proj 0
    how geo
    select 0
    geo_tol 0
    ele_tol 0
    dev 0
    improvement 1
    violate 0
    debug 0
    offset 0
}

array set ddn_options {
    mif_license hexa
    um Metric
    ds ANSI-82
    pf Ascii
}

array set import {
    dir import
    infile ""
    outfile ""
    
    plot3d_form   1
    plot3d_prec   0
    plot3d_planes 0
    plot3d_iblank 0
    plot3d_multi  1
}

array set swap_edges {
    min_aspect 0.2
    num_iter   4
}

array set change_family {
    domain_list ""
    subface_list ""
    edge_list ""
    vertex_list ""
}

array set scanp {
    how I
    index 1
    shade wire
    draw_nodes 0
    draw_ijk 0
    extended 0
}

array set hardcopy {
    format ppm
    outfile screen
    invert 0
    landscape 0
    generate_new 0
    scale 1
    jpeg_quality 75
    mpegfile image.mpg
    mpegpat image*.ppm
    ps_direct 1
    ps_type ""
    ps_color color
    ps_frame 1
    ps_title --default--
    ps_label --default--
    send_to_printer 0
}
#if [string match *win* $host_vendor] { set hardcopy(format) win }

array set mparams {
    emax_opt "" 
    emax_optl "Max size" 
    gnat 0
    gref 0
    internal_wall 0
    split_wall 0
    mom3d_no_adapt 0
    nlay 0
}

array set unstruct_create {
    type ""
    family ""
    do_make_consistent 1
}

array set geo_create {
    surface,segment,how     angle
    surface,segment,mintri  1
    surface,segment,angle   20
    surface,segment,curves  ""
    surface,segment,plane_p "0 0 0"
    surface,segment,plane_n "0 0 1"
    surface,segment,keep    0

    surface,points,pt1      "0 0 0"
    surface,points,pt2      "0 0 0"
    surface,points,pt3      "0 0 0"
    surface,points,pt4      "0 0 0"
    surface,points,pt5      "0 0 0"
    surface,points,pt6      "0 0 0"
    surface,points,pt7      "0 0 0"
    surface,points,pt8      "0 0 0"
    surface,points,npts     4
    surface,points,fam      ""
    surface,points,name     ""

    curve,segment,how       angle
    curve,segment,minedge   1
    curve,segment,angle     20
    curve,segment,plane_p   "0 0 0"
    curve,segment,plane_n   "0 0 1"
    curve,segment,keep      0

    curve,extract,bound     2
    curve,extract,angle     20
    curve,extract,minedge   0

    curve,points,how        2pts
    curve,points,pt1        "0 0 0"
    curve,points,pt2        "0 0 0"
    curve,points,fam        ""
    curve,points,name       ""

    point,extract,angle     20

    loop,screen,fam         ""
    loop,screen,name        ""
    loop,screen,allsep      0

    density,points,pt1      "0 0 0"
    density,points,pt2      "0 0 0"
    density,points,pt3      "0 0 0"
    density,points,pt4      "0 0 0"
    density,points,pt5      "0 0 0"
    density,points,pt6      "0 0 0"
    density,points,pt7      "0 0 0"
    density,points,pt8      "0 0 0"
    density,points,npts     4
    density,points,name     ""

    association             0
}

array set geo_cad {
    filter_points 1
    filter_curves 1
    close_gaps 0
    angle 30
    toler .01
    toler_max .1
    all_fams 1
    save_old 0
    merge_tol 0.1
    select_with_curves 1
    rebuild_topo 0
    select_internal 0
    add_nodes 0
    int_surf 0
    complete_edges 1
    partial 0
    new_family "-inherited"
    delete_degenerate 0
    multiple 0
    advanced 0
    yellow 1
}

array set midsurface {
    max_dist 0
    family midsurfaces
    save_old 0
    ask 2
    partial 0
    precision 0
}

array set solution {
    solver ""
}

array set file_save {
    sel_types 0
    sel_fams 0
    include_maps 1
    surfs_near_vols 1
    resnames ""
    only_subset 0
}

set fam_color() gray

array set unstruct_extrude {
    numl 1
    dir_fixed 1
    fix_dir "1 0 0"
    fun_dirx ""
    fun_diry ""
    fun_dirz ""
    sp_fixed 1
    fix_space 1
    fun_space ""
    vol_fam ""
    side_fam ""
    top_fam ""
    del_orig 0
    save_verts 0
    rpoint "0 0 0"
    rdir "1 0 0"
    rangle 10.0
    rmerge 1
}

array set iges_trans {
    file ""
    ddn_name ""
    dir_file default
    dir_file_user ""
    dir_file_exp 0
    data_red 0
    listing 0
    icempt 0
    listing_file iges_list
    trans_dos 0
    tetin_name ""
}

array set catia_trans {
    file ""
    project_dir ""
    preview ""
    args ""
    show "+show"
    noshow "-noshow"
    pick "+pick"
    nopick "+nopick"
    tritol 0.0004
    automaxsize ""
    bobox ""
    listing 0
    listing_file c4tetin.log
    tetin_name ""
    anf_name ""
    rcfile ""
    filter "inactive"
    filter_arg ""
    inhlayer ""
    laxis ""
}

array set unstruct_merge {
    how inter
    tol 0
}

array set linear_to_quadratic {
    project 1
    check_proj 0
    iters 10
    max_dev_half 0.1666666
    max_dev_nproj 30.0
    max_dev_chord 0.35
    max_leap 3.5
    midface 1
    refine 0
}

array set remesh {
    element 3
    how 0
    proj 0
    dev 0
    iters 20
    conver 0.025
    merge_tol 0.1
    surf 0
    complete_edges 0
    merge_ends 0
    ele_tol 0
    make_consistent 0
    debug 0
    all_dim 0
    max_steps 100
}

array set marker_new {
    pos "0 0 0"
    text "marker"
}

array set str_option {
    domain,shade wire
    domain,type_color \#80ff00
    domain,nodes 0
    domain,ijk 0
    domain,names 0
    domain,numbers 0
    domain,outlines 1
    domain,node_size 2
    domain,famcols 1
    domain,simplify 0
    domain,ijk_shrink 0
    domain,width 1
    domain,extended 0
    domain,changes 0
    domain,draw_twin 0
    
    subface,shade wire
    subface,type_color yellow
    subface,nodes 0
    subface,ijk 0
    subface,names 0
    subface,numbers 0
    subface,outlines 0
    subface,node_size 2
    subface,famcols 1
    subface,simplify 0
    subface,ijk_shrink 0
    subface,width 1
    subface,extended 0
    subface,changes 0
    subface,draw_twin 0
    
    edge,shade wire
    edge,type_color blue
    edge,nodes 0
    edge,ijk 0
    edge,names 0
    edge,numbers 0
    edge,outlines 0
    edge,node_size 2
    edge,famcols 1
    edge,simplify 0
    edge,ijk_shrink 0
    edge,width 1
    edge,extended 0
    edge,changes 0
    edge,draw_twin 0
    
    vertex,shade nodes
    vertex,type_color cyan
    vertex,nodes 1
    vertex,ijk 0
    vertex,names 0
    vertex,numbers 0
    vertex,outlines 0
    vertex,node_size 3
    vertex,famcols 1
    vertex,simplify 0
    vertex,ijk_shrink 0
    vertex,width 1
    vertex,extended 0
    vertex,changes 0
    vertex,draw_twin 0
    
    region,shade wire
    region,type_color magenta
    region,nodes 0
    region,ijk 0
    region,names 0
    region,numbers 0
    region,outlines 0
    region,node_size 2
    region,famcols 1
    region,simplify 0
    region,ijk_shrink 0
    region,width 1
    region,extended 0
    region,changes 0
    region,draw_twin 0
    
    curve,show0 1
    curve,show1 1
    curve,show2 1
    curve,show3 1
}

array set shrinkwrap {
    frac_longest 0.5
    frac_deepest 1.0
    max_angle 360.0
    min_angle 0.0
    max_dev 0
    solid 0
    fam HULL
}

array set convex_hull {
    tol 0.0
    how single
    divs_type model
    xdivs 4
    ydivs 4
    zdivs 4
    coarsen 1
    rem_int 0
    del_after 0
    ask_fams 0
    use_fam HULL
    sep_fams 1
}

array set movemesh {
    axis "1 0 0"
    origin "0 0 0"
    axptactive 0
    tranptactive 0
    tranptinactive 1
    vectaxis "0 0 0"
    vecttran "0 0 0"
    trans "0 0 0"
    theta 0.
    nmoves 1
    maxiter 3
    maxsoliter 30
    eigentol .1
    method simple
    smooth 1
    niter 5
    onlynode 1
    smoothpyra 0
    smoothprism 1
    smoothhexa 0
    smoothmodsactive 0
    coarsen 0
    refine 0
    swap 0
    swapactive 0
    max_ratio .25
    hexsmooth 0
    metric quality
    upto .1
    ignorepp 0
    sfit 0
}

array set yplus {
    value 5.
    fileismap 1
    result_on node
    maptosurf 1
    vertoff 0
    execscript 0
    script_file ""
    result_be ""
    result_file ""
    result_var ""
    result_fe 0
    result_reader ""
    ypsurfs ""
    relax .5
    use_corr 0
    corr_threshold .90
    ave_method aveneigh
    distance 1.
    iter 20
    conv .001
    use_distance 0
    use_node 1
}

set custom_metric_keys {
    angle distortion aspect warpage skew
}
array set custom_metric {
    warpage,name "Max warp"
    warpage,active 1
    warpage,quad,min  0
    warpage,quad,id   0
    warpage,quad,max 10
    warpage,tri,min  -1
    warpage,tri,id   -1
    warpage,tri,max  -1
    
    aspect,name "Aspect ratio"
    aspect,active 1
    aspect,quad,min .2 
    aspect,quad,id  1
    aspect,quad,max 1
    aspect,tri,min  .2
    aspect,tri,id   1
    aspect,tri,max  1
    
    distortion,name "Distortion"
    distortion,active 1
    distortion,quad,min .7
    distortion,quad,id  1
    distortion,quad,max 1
    distortion,tri,min -1
    distortion,tri,id  -1
    distortion,tri,max -1
    
    skew,name "Skew"
    skew,active 1
    skew,quad,min  0
    skew,quad,id   0
    skew,quad,max 45
    skew,tri,min   0
    skew,tri,id    0
    skew,tri,max  45
    
    angle,name "Angle"
    angle,active 1
    angle,quad,min  45
    angle,quad,id   90
    angle,quad,max 135
    angle,tri,min   20
    angle,tri,id    60
    angle,tri,max  120
}

array set curve_properties {
    emax_incr 1.0
    nmax_incr 1
    brat_incr 0.1
    ehgt_incr 0.1
    hrat_incr 0.1
    ewid_incr 1
    emin_incr 0.1
    edev_incr 0.1
}

array set saved_views {
    views ""
}

#-----------------------------------------------------------------------

#    fam_color
#    scanp
#    selmap



# These are the files whose names have to be saved relative in the 
# project_settings file if possible, and also reset to "" on closeproject.

array set project_file_names {
    part_selected parts
}

#project_settings_save_defaults

# These are basically all the executable files currently under ICEM_ACN

set program_path_list {
    abaqus acusolve airflo3d airflow alpha_flow ansys ansys2df auto_mesher
    autocfd autohex bagger bem2df blt_wish bltwish23 cfd++ cfd_ace cfl3d
    cfx5 cgns cgns2df chad cjpeg cmold coarse cobalt comco concert3d crsol
    cutter datex dave ddndir df2cgns df2rampant domain_view domaintypes
    dxf_post dxf_pre fast3d fastu fenfloss fensap fidap fire flex flotran
    flowCart flowCartinput flow3d flow_logic fluent fluent_topo fromppm 
    frontal gasp georampant global global_gui gmtec gplot gunzip gust gzip 
    hawk hex hex_gui hexa hughs2f ibm_bem icat icem_uh3d icemddn icu ideas 
    iflow iges_post iges_pre inca iples kiva3 laura license_check ls_dyna3d 
    magrec merge_unstr mesh2block mom3d_gui mpeg_encode mpeg_play mulcad_convert
    multiblock nasn nastar nastran2df nekton nparc ns3d nsu3d pab3d
    padammif parc patran2df pcube phoenics pl3d2domain plot3d pnmscale
    pnmtops pnmtotiff pnmtoxwd poly3d polyflow popinda ppmquant ppmtogif
    prebfc_trans prism qtet quad radioss rampant2df resconv rtt sandia
    scryu smooth spectrum splitflow starcd stl stl2df str_to_unstr
    supdomain surf2tri tascflow tclsh team tetin_view tetra tetra_gui
    tetssi thex tno tns3dmb toffset tranair trans tsmooth uh3d uncouple
    unput unput_gui unput_ideas usa usm3d usmkv3v visual3 visual3.mesa
    vsaero westinghouse wind wm wpatran wpil y237 ansys2df
}


set mesh_icons {
    createMSNBut
    checkMeshBut
    elemQualityBut 
    smoothMeshBut 
    smoothMeshSOEBut 
    repairMeshBut 
    mergeNodesBut 
    splitMeshBut 
    moveNodesBut 
    moveElemsBut 
    paraMeshBut
    convertMeshTypeBut 
    adjustMeshDens 
    renumberMeshBut 
    thicknessMeshBut 
    reorientMeshBut 
    offsetMeshBut 
    deleteNodesBut 
    deleteMidNodesBut 
    deleteElemsBut 
    extrudeMeshBut 
    meshPrismBut 
    meshQuad2Hex 
    modifyDistributedBut
}

set strmesh_icons {
    reorientMeshBut
    moveNodesBut 
    moveElemsBut 
    splitMeshBut
    elemQualityBut
    smoothMeshBut
}

set geom_icons { 
    repairGeomBut 
    transformSurfsBut 
    deletePointsBut 
    deleteCurveBut 
    deleteSurfBut 
    deleteBodyBut 
    deleteEntityBut 
    restoreEntityBut 
    meshSizeCurveBut 
    meshSizeSurfBut 
    createConnBut
    meshLineBut
    meshQuadBut 
    meshHexBut 
    meshGlobalBut
    meshGlobalBut2
    createBlock 
    advMeshParams
}


set bc_icons {
    singlePointConstraintBut
    pointImpdispBut
    curveImpdispBut
    surfImpdispBut 
    subsetImpdispBut 
    surfContactBut 
    singleContactBut
    pointVelocityBut 
    surfRigidwallBut 
    ForceBut
    pointForceBut
    curveForceBut
    surfForceBut 
    subsetForceBut
    PressureBut
    surfPresBut    
    subsetPresBut
    TemperatureBut   
    pointTmpBut
    curveTmpBut
    surfTmpBCBut 
    bodyTmpBut 
    subsetTmpBut
    gravityBut
    openMatBut
    saveMatBut
    createMatBut
    MatTabBut
    create0DElePropBut
    create1DElePropBut
    create2DElePropBut
    create3DElePropBut
    setupNASTRANBut
    setupSolverBut
    subcaseBut
    writeNastranBut
    DynamicTimeBut
    DynamicFreqBut	      
}

set block_icons {
    splitBlock 
    mergeBVertex 
    collapseBlock 
    projections 
    moveBVertex 
    transformBlockBut 
    editBedge 
    MParams 
    QBlock 
    QSmooth
    CheckBlock 
    deleteBlock 			      
}

set output_icons {
    solverBC
    solverParams
    solverInput	      
}

set bc_mesh_icons {
    multiplePointConstraintBut
    pointConstrainedBut
}

set non_nastran_icons {
    surfContactBut 
}

set lsdyna_icons {
    pointConstrainedBut
    singleContactBut
    pointVelocityBut 
    surfRigidwallBut 
}


