Changeset 1134 for branches/sandbox


Ignore:
Timestamp:
Apr 20, 2011 10:34:51 AM (10 years ago)
Author:
toby
Message:

prepare to vary RB multipliers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/rb.tcl

    r1130 r1134  
    5454}
    5555
    56 # returns two items:
     56# ReadRigidBody provides all information associated with a rigid body type
     57#  rbnum is the rigid body type number
     58# it returns two items:
    5759#   the number of times the rigid body is mapped
    5860#   a list containing an element for each scaling factor in rigid body #rbnum.
     
    9698    return [list $used $out]
    9799}
     100
     101# SetRigidBodyVar
     102#   rbnum is the rigid body type number
     103#   varnumlist is a list of variable numbers
     104#      note that if this list is shorter than the number of actual multipliers
     105#      for the body, the unspecified variable will be set to 0 (not refined)
     106#   damplist   is a list of damping values (0-9)
     107#      note that if the damplist is shorter than the number of actual multipliers
     108#      the unspecified values are not changed
     109
     110#  SetRigidBodVar 2 {1 2 3} {}
     111#       will vary the (first 3) translations in body #3 and will not change the
     112#       damping values
     113#  SetRigidBodVar 3 {} {0 0 0}
     114#       will turn off all variables and will change the (first 3) damping values
     115# Nothing is returned
     116proc SetRigidBodyVar {rbnum varnumlist damplist} {
     117    if {[lsearch [RigidBodyList] $rbnum] == -1} {
     118        return ""
     119    }
     120    set value $rbnum
     121    validint value 2
     122    set key "RGBD${value}"
     123    set nmult [string trim [string range [readexp "$key NSMP"] 0 4]]
     124    for {set i 1} {$i <= $nmult} {incr i} {
     125        set j $i
     126        incr j -1
     127        set var [lindex $varnumlist $j]
     128        if {$var == ""} {set var 0}
     129        validint var 5
     130        setexp "${key}${i}PARM" var 11 15
     131        set damp [lindex $damplist $j]
     132        if {$damp != ""} {
     133            if {$damp > 9} {set damp 9}
     134            if {$damp < 0} {set damp 0}
     135            validint damp 5
     136        }
     137        setexp "${key}${i}PARM" damp 16 20
     138    }
     139}
     140
    98141
    99142# return the number of times rigid body $bodytyp is mapped in phase $phase
     
    685728    set varlist {}
    686729    foreach type [RigidBodyList] {
     730        set typelist [lindex [ReadRigidBody $type] 1]
     731        for item in $typelist {
     732            lappend varlist [lindex $item 2]
     733        }
    687734        foreach phase $::expmap(phaselist) {
    688735            foreach i [RigidBodyMappingList $phase $type] {
Note: See TracChangeset for help on using the changeset viewer.