# $Revision$ on $Date$
# The above revision line needs to be the first line for all techtk files
# Copyright (c) 2006 Ansys Inc

proc InitGlobals {} {
	global geom_visible
	global str_option
	global fam_visible
	global options
	foreach t {point curve surface material density loop} {
		set geom_visible($t) 1
		set str_option($t,dtype) simple
		set str_option($t,stype) wire
		set str_option($t,sizes) none
	}
	set geom_visible(curve) 1
	set options(select_mode) all
	
}

set AppName "ICEMFEA"


# 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.

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 0
    uns_surf_bounds 0
    uns_warn_if_display 500000
    uns_cut_delay_count 1000
}

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

# 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_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 prompt_for_bld_topo      0
set prompt_for_bld_topo_opts 0
set med_save_emergency_mesh 0
set med_save_emergency_tetin 1

array set file_name {
    settings ""
    domain ""
    tetin ""
    family_boco ""
    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
    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 ""
}

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"
}

array set options {
    edit_wait 0
    select_mode all
    boundary_mode all
    flood_select_angle 0
    expert 1
    xhidden_full 1
    use_dlremote 0
    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
    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
}

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 cart3d {
    file_prefix    "model"
    run_intersect  1
    run_cubes      1
    fix_normals    1
    nominal_radius 30
    num_div        5
    max_ref        11
    mesh_symX      0
    mesh_symY      0
    mesh_symZ      0
    mesh_save      0
    adv_options    0
    aspect_ratio   1
    buff_lay       4
    max_angle      20
    cut_planesX    3
    cut_planesY    3
    cut_planesZ    3
    mesh_internal  0
}

array set flowCart {
    mesh_file      "model_c3d.mesh"
    cntl_file      "flowCart.cntl"
    run_reorder    1
    reorder_scheme H
    run_mgPrep     1
    num_mgl        3
    restart        0
    max_cycles     100
}

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

array set select_defaults {
    type   ""
    family ""
}

array set bandwidth {
    iters 1
    type  profile
}

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
}

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

    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
    offset 0
    offset_h 1.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,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.4 
    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.4
    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   90
    angle,tri,acc_max  110
}

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

#    fam_color
#    scanp
#    selmap

set saved_params {
    file_name
    bandwidth
    boco_solver
    bubble_delay
    change_family
    coarsen
    fam_listsize
    fam_sorttype
    fam_update_mode
    ddn_options
    diag_option
    file_save
    frontal_values
    geo_create
    geo_move
    geo_modify
    hardcopy
    hexa_values
    iges_trans
    import
    load_max_dim
    load_tetin_triangle_tolerance
    loaded_domains
    med_float_precision
    med_fast_dynamics
    med_index_base
    movemesh
    geom_fast_dynamics
    prompt_for_bld_topo
    prompt_for_bld_topo_opts
    mesh_min_moving_element_aspect
    tdv_quadratic_accuracy
    merge_point_tol
    options
    quad
    refine
    remesh
    reorient
    struct_reorient
    select_defaults
    smooth
    solution
    struct_move
    struct_move_node
    unstruct_move_node
    use_xwindows
    swap_edges
    tdv_mouse_bindings
    part_selected
    tetin_try_binary
    tetra_values
    tri2quad
    undo_max_memory
    undo_save_whole_mesh
    unstruct_create
    unstruct_diag
    unstruct_extrude
    unstruct_merge
    unstruct_move
    yplus
    linear_to_quadratic
    auto_raise_forms
    med_save_emergency_mesh
    med_save_emergency_tetin
    crease_project
    gsys_display_list_max_size
    geo_cad
    midsurface
    custom_metric
}

array set saved_params_no_reset_defaults {
    loaded_domains 1
    tdv_mouse_bindings 1
    bubble_delay 1
    use_xwindows 1
}

# 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
}


# Global array used by the resultlib
array set backend {
}
