
# Set the initial values of the parameters.
#
# Copyright (c) 1993, 1994 Pacific Marketing and Consulting
# Author:  Wayne A. Christopher, wayne@pmac.com
#          Pacific Marketing and Consulting, Berkeley, California
#

# All objects that have a geometrical component have a field called
# X_geotype.  This may be quad, prism, cyl, circ, or tri (triangular prism).
# In the case of prism, the object has fields that are X_{x,y,z}{s,e}.
# In the case of quad, the same fields are present, along with plane, which
# can be xy, xz, yz.
# In the case of circ, the fields are xc, yc, zc, plane, radius,
# and iradius (opt).
# In the case of cyl, the fields are xc, yc, zc, plane, radius,
# iradius (opt), and height.
# In the case of tri, the fields are {x,y,z}{1,2,3}, height, and plane.
#
# To deal with: angled planes, thickness.

set config_params {
    printcmd_ps ctrlkey helpviewer
    printcmd_text autoraise listsort scratch autoraise
    xterm_opts home_direction precision diff_flag legend_sigfigs
    legend_figstype all_fixvals
}

set config_default_params {
    ptol
}

set job_params "title notes"

set job_title ""
set job_notes ""

set job_ptol 1e-6
set job_ctrlkey Control
#set job_backup_level 0
set job_autoraise 0
#set job_autosave 0
set job_listsort creation_order
set job_home_direction -z
set job_all_fixvals per
set job_scratch jobdir
set job_xterm_opts ""
set job_helpviewer ""
set job_precision 0
set job_diff_flag 0
set job_legend_sigfigs 0
set job_legend_figstype {g}
set shape_color_gray 1

set job_printcmd_ps {lp -d%p %f}
set job_printcmd_text {lp -d%p %f}

set type_visible(names) 1

set grid_display_wire 1
set grid_display_solid 0

set object_params_affect_mesh(all,creation_order) 1

foreach p {obj_color obj_color_default obj_shading obj_texture obj_texture_scale
    obj_transparency obj_transparency_on obj_linewidth} {
    set object_params_affect_graphics(all,$p) 1
}

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

# The hardcopy_ ones are just used for summary at this point.
set hardcopy_printer lp
if $is_win {
    set hardcopy_type mswin
} else {
    set hardcopy_type ps
}
set hardcopy_colorps 1
set hardcopy_print 0
set hardcopy_auto_dirname ""
set animate_auto_dirname ""
# This is for the regular stuff.

array set hardcopy {
    format *.gif
    outfile screen
    invert 0
    landscape 0
    generate_new 0
    scale 1.0
    jpeg_quality 75
    mpegfile image.mpg
    mpegpat image*.ppm
    ps_direct 1
    ps_type ""
    ps_color color
    ps_frame 1
    ps_labels 1
    ps_title --default--
    ps_label --default--
    send_to_printer 0
    win_direct 1
    win_color color
    region_type all
    xstart 0
    ystart 0
    width 0
    height 0
}

array set p_hardcopy [array get hardcopy ]
array set f_hardcopy [array get hardcopy ]

if $is_win {
    set p_hardcopy(format) *.win
} else {
    set p_hardcopy(format) *.ps
}

if [string match *win* $host_vendor] { set hardcopy(format) win }

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

set cad_creation_mode single
set cad_use_hull 0
set cad_show_used 0
set cad_show_unused 1
set cad_area_ratio 1.05
set cad_max_pts 8
set cad_allow_nonunif 1
set cad_do_autoscale 1
set cad_group ""
set cad_volume_flag 1
set cad_min_feature_size 0
set cad_show_solid 0
set cad_topo_tol 0.01
array set cad_use_type { surface 1 curve 1 point 1 material 1 }
set load_tetin_triangle_tolerance 0.05

set file_import_type iges
set file_import_name ""
set file_import_job ""
set file_import_scale 1

set annotation_color white
set annotation_width 1
set annotation_pointsize 5

set shape_movegroup 0
set shape_snap_objects 0
set shape_snap_tol 10
set new_shape_factor 0.2

set default_pipe_radius 0.1


set family_name_type full  ;# full nchars alpha
set family_name_nchars 6
set family_name_sep_dims 1

set meshing_units m
set meshing_frequency_value 0
set meshing_frequency_scale GHz

set expression_edit_trial_how_solveid nums
#==============================================
array set tdv_lights_settings { complex 0 ambient_color \#ffffff ambient 1 ambient_intensity 0.3 light1 1 light2 1 light3 1 light1_color \#ffffff light1_intensity 0.75 light2_color \#ffffff light2_intensity 0.6  light3_color \#ffffff light3_intensity 0.4 light4 0 light4_color \#ffffff light4_intensity 0.0 light1_x 0.0 light1_y 0.0 light1_z 10.0 light1_pos 0 light2_x 0.0 light2_y 1.0 light2_z -1.0 light2_pos 0 light3_x 1.0 light3_y -2.0 light3_z -1.0 light3_pos 0 light4_x -2.0 light4_y 1.0 light4_z -1.0 light4_pos 0}

array set tdv_material_settings { m_a 0.35 m_d 1.0 m_s 0.35 m_sh 15 }    

array set shape_title {
    quad Rectangular
    cyl Cylinder
    circ Circular
    hexa Prism
    polygon Polygon
    incline Inclined
    sphere Ellipsoid
    oval "E. cylinder"
    cad "Bsplines"
    container Assembly
    none None
}

if ![info exists other_params] { set other_params "" }
set other_params [concat $other_params {
    default_pipe_radius
    shape_x_grid_on
    shape_y_grid_on
    shape_z_grid_on
    shape_x_grid
    shape_y_grid
    shape_z_grid
    shape_color_gray
    shape_movegroup
    shape_snap_objects
    shape_snap_tol
    new_shape_factor
    default_fluid_family
    gmax_in_def_units
    family_name_type
    family_name_nchars
    family_name_sep_dims
    local_coords
    grid_mesher_params
    meshing_units
    meshing_frequency_value
    meshing_frequency_scale
    tdv_user_views
    tdv_lights_settings
    tdv_material_settings
    tdv_mouse_bindings
    expression_params
    expression_param_trials
    expression_param_choices
    expression_param_by_cols
    expression_param_range
    expression_param_random
    expression_cur_trials
    expression_mode
    expression_trial_restartid
    expression_trial_name
    expression_trial_order
    expression_edit_trial_how_solveid
    unit_data
    unit_choices
    unit_default
    library_path
    pipe_mesh_params
    type_visible
    graph_texture_string
    graph_texture_scale
}]

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

array set pipe_mesh_params {
    on 0
    ogrid_height 0.5
    max_length 0
    init_height 0
    height_ratio 1.1
}

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

set filetype_data_types {
    model mesh post screendumps summaries reports logfiles scratch
}

set grid_params {
    type convert_multi max_elements
    perobject usesize_x usesize_y usesize_z usesize_h
    size_x size_y size_z size_h gcount_i gcount_j gcount_k
    gtype gmax_i gmax_j gmax_k gmin_i gmin_j gmin_k set_default_sizes gratio
    hgrid minglobal global_maxrat
    tetra_sm tetra_smqual tetra_smiters tetra_smcoarse tetra_smcasp
    tetra_smciters
    tetra_prisms tetra_prism_num tetra_prism_height tetra_prism_yplus
    run_tetssi prism_families
    triangulation_tolerance
    tetra_params
    cutter_tries allow_addfaces no_tetra no_cutter cutter_surface
    subgrids subgrid_info ratios ratio_info
    mesh_parts_separate grid_different_subgrid
    settings_type tetra_settings_type
    sep_x
    sep_y
    sep_z
    sep_x_units
    sep_y_units
    sep_z_units
    accept_all_minval_changes
}

set grid_subgrids 0
set grid_perobject 0
set grid_usesize_x 0
set grid_usesize_y 0
set grid_usesize_z 0
set grid_usesize_h 0
set grid_size_x 1
set grid_size_y 1
set grid_size_z 1
set grid_size_h 0
set grid_convert_multi 0
set grid_max_elements 10000000
set grid_settings_type normal
set grid_tetra_settings_type normal

set grid_gcount_i 10
set grid_gcount_j 10
set grid_gcount_k 10
set grid_gtype unif
set grid_gmax_i 0
set grid_gmax_j 0
set grid_gmax_k 0
set grid_gmin_i 0
set grid_gmin_j 0
set grid_gmin_k 0
set grid_set_default_sizes 0
set grid_hgrid 0
set grid_minglobal 0
set grid_global_maxrat 0
set grid_mesh_parts_separate 1
set grid_different_subgrid 1
set grid_accept_all_minval_changes 0

foreach i {x y z} {
    set grid_sep_$i 1e-3
    set grid_sep_${i}_units m
}

array set grid_gratio {
    i_init 0
    i_rat 1
    i_dir 0
    j_init 0
    j_rat 1
    j_dir 0
    k_init 0
    k_rat 1
    k_dir 0
}

set grid_ratios 0

set grid_usegraphics 0
set grid_editinput 0
set grid_display 0
foreach i {bar quad hexa tri penta coup0 coup1 coupi coupn} {
    set grid_dtype($i) 0
}
set grid_elemcount "not loaded"
set grid_nodecount "not loaded"
set grid_qtype object
set grid_nodenums 0
set grid_elemnums 0
set grid_cut_on 0
set grid_cut_incrpct 5
set grid_cut_pct 0.5
set grid_cut_pct_selected 1
set grid_use_full 0
set grid_solid 0
set grid_perobject 0
set grid_run_mesher 1
set grid_run_smoother 0
set grid_qual facealign

array set auto_animate {
    default,minval 0
    default,maxval 1
    default,startp 0
    default,endp 1.0
    default,nsteps 16
    default,startp_time 0
    default,endp_time 1.0
    default,nsteps_time 16
    default,incrval 0.1
    default,useincrval 0
    default,delay 24
    default,loop 0
    default,how screen
    default,to_file 0
    default,running 0
    default,stop 0
    default,scale 1.0
    default,region_type all
    default,xstart 0
    default,ystart 0
    default,width 0
    default,height 0
    default,button_lab Animate
    default,transient_button_lab Animate
    default,file_type *.mpg
}

set grid_hexa_interactive 0

set grid_tetra_sm 1
set grid_tetra_smqual 0.4
set grid_tetra_smiters 10
set grid_tetra_smcoarse 1
set grid_tetra_smcasp 0.1
set grid_tetra_smciters 1

set grid_tetra_prisms 0
set grid_tetra_prism_num 4
set grid_tetra_prism_ratio 2.0
set grid_tetra_prism_height 0.0
set grid_tetra_prism_yplus 0.001
set grid_tetra_prism_sms 6

set grid_run_tetssi 1
set grid_triangulation_tolerance 0.00005

set grid_cutter_tries 20
set grid_allow_addfaces 1
set grid_no_tetra 0
set grid_no_cutter 0
set grid_cutter_surface 0
set grid_tetra_oldstyle 1
set grid_tetra_surface 0
set grid_tetra_to_quad 0

set grid_prism_families(ORFN) 0

array set grid_mesher_normal {
    min_elements_gap     3
    min_elements_block   2
    max_ratio            2
    height_max           0
    max_ogrid            0
    min_cylinder_face    4
    min_triangle_face    4
    plate_join_tolerance 0
    ignore_globals       0
    ignore_perobject     0
    no_group_ogrids      0
    no_ogrids            0
    cartesian            0
    conformal            1
    conformal_tol        0.01
    cyl_shrink_factor    0.99
}

# the min_cylinder_face and min_triangle_face parameters should not go below 4

array set grid_mesher_coarse {
    min_elements_gap     2
    min_elements_block   1
    max_ratio            10
    height_max           0
    max_ogrid            0
    min_cylinder_face    4
    min_triangle_face    4
    plate_join_tolerance 0
    ignore_globals       0
    ignore_perobject     0
    no_group_ogrids      0
    no_ogrids            0
    cartesian            0
    conformal            1
    conformal_tol        0.01
    cyl_shrink_factor    0.99
}

array set grid_mesher_null {
    min_elements_gap     1
    min_elements_block   1
    max_ratio            10000
    height_max           10000
    max_ogrid            0
    min_cylinder_face    4
    min_triangle_face    4
    plate_join_tolerance 1
    ignore_globals       1
    ignore_perobject     1
    no_group_ogrids      0
    no_ogrids            0
    cartesian            0
    conformal            1
    conformal_tol        0.01
    cyl_shrink_factor    0.99
}

array set grid_tetra_normal {
    n_cells_in_gap          2
    edge_criterion          0.05
    natural_size_factor     0.8
    natural_size_refinement 32
    tetra_size_on_curves    0
    tetra_size_on_surfs     0
    tetra_ratio             0
    split_spanning          1
}

array set grid_tetra_coarse {
    n_cells_in_gap          1
    edge_criterion          0.05
    natural_size_factor     0.8
    natural_size_refinement 8
    tetra_size_on_curves    0
    tetra_size_on_surfs     0
    tetra_ratio             0
    split_spanning          1
}

proc grid_set_tetra_defaults {which verbose} {
    global grid_tetra_params grid_tetra_$which default_no_split_spanning
    
    foreach pn [array names grid_tetra_$which] {
	set grid_tetra_params($pn) [set grid_tetra_${which}($pn)]
    }
    if [info exists default_no_split_spanning] {
	set grid_tetra_params(split_spanning) 0
    }
    if $verbose { mess "Set meshing defaults to $which\n" }
}

proc grid_set_defaults {which verbose} {
    global grid_mesher_params grid_mesher_$which
    
    foreach pn [array names grid_mesher_$which] {
	set grid_mesher_params($pn) [set grid_mesher_${which}($pn)]
    }
    if $verbose { mess "Set meshing defaults to $which\n" }
}

grid_set_defaults normal 0
grid_set_tetra_defaults normal 0

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

set grid_smoother_normal(limit_bad_determ)     0.0
set grid_smoother_normal(limit_bad_angle)      35.0
set grid_smoother_normal(mth_node_oriented_sm) 0
set grid_smoother_normal(mth_local_sm)         Optimize
set grid_smoother_normal(no_iter_local_sm)     3
set grid_smoother_normal(max_level_local_sm)   3
set grid_smoother_normal(no_step)              1
set grid_smoother_normal(wght_orthog)          1.0
set grid_smoother_normal(sfit)                 1
set grid_smoother_normal(ign_ps_points)        0
set grid_smoother_normal(fix_bo)               0

foreach i [array names grid_smoother_normal] {
    set grid_smoother_params($i) $grid_smoother_normal($i)
}

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

set type_list {
    domain hexa cyl tri incline quad circle container
}
set grid_type_list {
    domain hexa cyl tri incline quad circle
}

foreach t $type_list { set type_phase($t) model }

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

set grid_side_names(domain) { "" minx maxx miny maxy minz maxz }
set grid_side_names(hexa)    { inside minx maxx miny maxy minz maxz }
set grid_side_names(cyl)     { inside bot top sides }
set grid_side_names(tri)     { inside bot top sides }
set grid_side_names(incline) { inside bot top sides sides sides sides }
set grid_side_names(quad)    { "" bot top }
set grid_side_names(circle)  { "" outer inner }

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

set object_params(part) {}

set object_type_title(part) "Parts"
set object_type_title(part_sep) "Meshed sep. parts"

set object_edit_info(part) {
    { default default { body Body { container Container } } }
}

set object_type_title(group) "Group"
# -----------------------------

set config_params_2 {
    shape_color_gray 
    type_visible
    tdv_nonuniform_scale
    bubble_delay
    grid_type
    shape_x_motion
    shape_y_motion
    shape_z_motion
    shape_indomain
    shape_nopenetrate
    shape_movegroup
    shape_snap_objects
    shape_snap_tol
    shape_x_grid_on
    shape_y_grid_on
    shape_z_grid_on
    shape_x_grid
    shape_y_grid
    shape_z_grid
    new_shape_factor
    error_report
}

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

set bad_face_align 0.15
set bad_det_aspect 0.15
set bad_volume 1e-12

array set copy_from {
    object ""
    how none
    creation_order 1
    groups 1
    shapeinfo 1
    objinfo 0
}

set palette_predefined {
    black	magenta	pink	red
    purple	gray	LimeGreen orange
    brown	#e6e6fa beige	yellow
    blue	green	cyan	white
}

set view_colordata {
    #0000ff
    #007fff
    #00ffff
    #00ff7f
    #00ff00
    #7fff00
    #ffff00
    #ff7f00
    #ff0000
}

set curve_colors {
    red green blue yellow #e6e6fa cyan magenta orange pink violet
}
set curve_ncolors [llength $curve_colors]

set curve_patterns {
    {0xff 0xff} {0xff 0x00} {0xc0 0xff} {0x33 0x33} {0xf0 0xf0}
    {0xff 0xff} {0xff 0x00} {0xc0 0xff} {0x33 0x33} {0xf0 0xf0}
}

# This is really annoying.
set curve_stipple_to_pspat(ffff) ""
set curve_stipple_to_pspat(ff00) "8 8"
set curve_stipple_to_pspat(c0ff) "4 2 8 2"
set curve_stipple_to_pspat(03ff) "4 2 8 2"
set curve_stipple_to_pspat(3333) "2 2"
set curve_stipple_to_pspat(cccc) "2 2"
set curve_stipple_to_pspat(0f0f) "4 4"
set curve_stipple_to_pspat(f0f0) "4 4"

set graph_params { color width shadepolicy fancy font texture transparency transparency_on }

set graph_types ""
foreach xx {
    { {cad point} \#e6e6fa  4  ""   "" ""    0 }
    { {cad line}  gray      2  ""   "" ""    0 }
    { highlight   red       1  ""   "" ""    1 }
    
    { part        gray      1  view "" fixed 0 }
    { part_sep    \#ff50c0  1  view "" fixed 0 }
    
    { title       white     "" ""   "" fixed 1 }
    { date        white     "" ""   "" fixed 1 }
    { names       white     "" ""   "" fixed 1 }
    
    { {mesh hexa} \#e6e6fa  1  ""   "" ""    1 }
    { {mesh penta} \#fae6e6 1  ""   "" ""    1 }
    { {mesh quad} yellow    1  ""   "" ""    1 }
    { {mesh bar}  white     4  ""   "" ""    1 }
    
    { {mesh quality}  red    1  ""   "" ""  1 }
    
    { {mesh selected} orange 1  ""   "" ""  1 }
    { {mesh adjacent} orange 1  ""   "" ""  1 }
} {
    set type [lindex $xx 0]
    set graph_color($type) [lindex $xx 1]
    set graph_width($type) [lindex $xx 2]
    set graph_shadepolicy($type) [lindex $xx 3]
    set graph_fancy($type) [lindex $xx 4]
    set graph_font($type) [lindex $xx 5]
    set graph_visible($type) 1
    set graph_texture($type) ""
    set graph_transparency($type) 0.5
    set graph_transparency_on($type) 0
    if {[lindex $xx 6] || [info exists icepak_root]} {
	lappend graph_types $type
    }
    if ![string match part* $type] {
	set object_type_title($type) [string totitle $type]
    }
}

set graph_color(surface_probe) white

# -----------------for the geometry import------------

array set csv_text_data {
    o_type ""
    s_type ""
    sep_char ","
    hdr_num 0
    ob_text ""
    ob_index 0
    maxc 0
}

array set html_report_shape_params {
    container {
	Position "xp yp zp" coords
    }
    none {
    }
    hexa {
	Size "xd yd zd" "coords diff"
    }
    quad {
	Size "xd yd zd" "coords diff"
	Thickness thickness float
	Plane plane int
    }
    incline {
	Size "xd yd zd" "coords diff"
	Axis axis int
	Thickness thickness float
    }
    cyl {
	Non-uniform changes bool
	Plane plane int
	Height height float
	Radius radius float
    }
    circ {
	Plane plane int
	Radius radius float
	"Int radius" iradius float
    }
    polygon {
	Plane plane int
	Height height float
	Non-uniform changes bool
	"Num verts" nverts int
    }
    pipe {
	"Num verts" nverts int
    }
    ellipse {
	Size "xd yd zd" "coords diff"
    }
    sphere {
	Size "xd yd zd" "coords diff"
    }
    oval {
	"Bot center" "xc yc zc" coords
	"Top center" "xc2 yc2 zc2" coords
	"Bot radius" radius float
	"Top radius" radius2 float
    }
    cad {
    }
}

array set object_param_name_map {
    plane,0 Y-Z
    plane,1 X-Z
    plane,2 X-Y
}
