Ignore:
Timestamp:
Feb 18, 2016, 4:13:14 PM (9 years ago)
Author:
ldelgass
Message:

Merge UQ and fixes from 1.4 branch

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/gui/scripts/analyzer.tcl

    r5880 r6021  
    7979    protected method _lammpsToSequence {xmlobj path id child data}
    8080    protected method _trajToSequence {xmlobj {path ""}}
     81    protected method _pop_uq_dialog {win}
     82    protected method _setWaitVariable {state}
     83    protected method _adjust_level {win}
    8184
    8285    private variable _tool ""          ;# belongs to this tool
     
    9295    private variable _lastPlot
    9396    private common job                 ;# array var used for blt::bgexec jobs
     97    private variable _uq_active 0      ;# a UQ variables has been used
     98    private variable _wait_uq 0
    9499}
    95100
     
    328333    }
    329334    pack $itk_component(resultpages) -expand yes -fill both
    330 
    331     set f [$itk_component(results) insert end -fraction 0.1]
     335   set f [$itk_component(results) insert end -fraction 0.1]
    332336    itk_component add resultselector {
    333337        Rappture::ResultSelector $f.rsel -resultset $_resultset \
     
    395399# ----------------------------------------------------------------------
    396400itcl::body Rappture::Analyzer::simulate {args} {
    397     if {$args == "-ifneeded"} {
     401    #puts "simulate args='$args'"
     402
     403    set uq [$_tool get_uq -uq_type smolyak -uq_args 2]
     404
     405    # pop up UQ window
     406    if {[$uq num_runs] > 1} {
     407        set _uq_active 1
     408        set status [$uq run_dialog $itk_component(simulate)]
     409        if {$status == 0} {
     410            # cancelled
     411            return
     412        }
     413        lappend args -uq_type [$uq type]
     414        lappend args -uq_args [$uq args]
     415        # Need to put these UQ values into the driver file
     416        # so the call to resultset::contains will be correct.
     417        set _xml [$_tool xml object]
     418        $_xml put uq.type.current [$uq type]
     419        $_xml put uq.args.current [$uq args]
     420        $_xml put uq.args.about.label "level"
     421        $_xml put uq.args.about.description "Polynomial Degree of Smolyak GPC method."
     422    }
     423    #puts "simulate args=$args"
     424
     425    if {[lindex $args 0] == "-ifneeded"} {
    398426        # check to see if simulation is really needed
    399427        $_tool sync
     
    404432            return
    405433        }
    406         set args ""
     434        set args [lreplace $args 0 0]
    407435    }
    408436
     
    427455
    428456    # execute the job
     457    #puts "$_tool run $args"
     458
    429459    foreach {status result} [eval $_tool run $args] break
    430460
     
    470500}
    471501
     502
    472503# ----------------------------------------------------------------------
    473504# USAGE: reset ?-eventually|-now?
     
    515546        clear
    516547    }
     548    #puts "Analyzer::load"
    517549    $_resultset add $xmlobj
    518550
     
    652684# ----------------------------------------------------------------------
    653685itcl::body Rappture::Analyzer::_plot {args} {
     686    #puts "analyzer::_plot"
    654687    set _plotlist $args
    655688
     
    755788    } elseif {$page != ""} {
    756789        set _lastlabel $name
    757         set win [winfo toplevel $itk_component(hull)]
    758790        $itk_component(resultpages) current $page
    759791        set f [$itk_component(resultpages) page $page]
    760 
    761792        # We don't want to replot if we're using an existing viewer with the
    762793        # the same list of objects to plot.  So track the viewer and the list.
    763794        if { ![info exists _lastPlot($f)] || $_plotlist != $_lastPlot($f) } {
    764795            set _lastPlot($f) $_plotlist
     796            set win [winfo toplevel $itk_component(hull)]
    765797            blt::busy hold $win
     798            #puts "rviewer = $f.rviewer"
     799            #puts "_plotlist = $_plotlist"
    766800            $f.rviewer plot clear
    767801            eval $f.rviewer plot add $_plotlist
    768             blt::busy release [winfo toplevel $itk_component(hull)]
     802            blt::busy release $win
    769803        }
    770804        Rappture::Logger::log output $_label2item($name)
     
    782816# ----------------------------------------------------------------------
    783817itcl::body Rappture::Analyzer::_fixResultSet {args} {
     818    #puts "Analyzer::_fixResultSet $args"
    784819    array set eventData $args
    785820    switch -- $eventData(op) {
     
    794829            set haveresults 0
    795830            foreach item [_reorder [$xmlobj children output]] {
    796                 switch -glob -- $item {
    797                     log* {
    798                         _autoLabel $xmlobj output.$item "Output Log" counters
    799                     }
    800                     number* {
    801                         _autoLabel $xmlobj output.$item "Number" counters
    802                     }
    803                     integer* {
    804                         _autoLabel $xmlobj output.$item "Integer" counters
    805                     }
    806                     mesh* {
    807                         _autoLabel $xmlobj output.$item "Mesh" counters
    808                     }
    809                     string* {
    810                         _autoLabel $xmlobj output.$item "String" counters
    811                     }
    812                     histogram* - curve* - field* {
    813                         _autoLabel $xmlobj output.$item "Plot" counters
    814                     }
    815                     map* {
    816                         _autoLabel $xmlobj output.$item "Map" counters
    817                     }
    818                     drawing* {
    819                         _autoLabel $xmlobj output.$item "Drawing" counters
    820                     }
    821                     structure* {
    822                         _autoLabel $xmlobj output.$item "Structure" counters
    823                     }
    824                     table* {
    825                         _autoLabel $xmlobj output.$item "Energy Levels" counters
    826                     }
    827                     sequence* {
    828                         _autoLabel $xmlobj output.$item "Sequence" counters
     831                if {[$xmlobj get output.$item.about.uqtype] == ""} {
     832                    switch -glob -- $item {
     833                        log* {
     834                            _autoLabel $xmlobj output.$item "Output Log" counters
     835                        }
     836                        number* {
     837                            _autoLabel $xmlobj output.$item "Number" counters
     838                        }
     839                        integer* {
     840                            _autoLabel $xmlobj output.$item "Integer" counters
     841                        }
     842                        mesh* {
     843                            _autoLabel $xmlobj output.$item "Mesh" counters
     844                        }
     845                        string* {
     846                            _autoLabel $xmlobj output.$item "String" counters
     847                        }
     848                        histogram* - curve* - field* {
     849                            _autoLabel $xmlobj output.$item "Plot" counters
     850                        }
     851                        drawing* {
     852                            _autoLabel $xmlobj output.$item "Drawing" counters
     853                        }
     854                        structure* {
     855                            _autoLabel $xmlobj output.$item "Structure" counters
     856                        }
     857                        table* {
     858                            _autoLabel $xmlobj output.$item "Energy Levels" counters
     859                        }
     860                        sequence* {
     861                            _autoLabel $xmlobj output.$item "Sequence" counters
     862                        }
    829863                    }
    830864                }
     
    853887                    }
    854888                    set hidden [$xmlobj get output.$item.hide]
    855                     if { $hidden == "" } {
     889                    if {$hidden == ""} {
    856890                        set hidden 0
    857891                    }
    858892                    if {"" != $label && !$hidden} {
     893                        set uq_part [$xmlobj get output.$item.about.uqtype]
     894
     895                        #puts "label=$label uq_part=$uq_part"
     896
    859897                        if {![info exists _label2page($label)]} {
     898                            #puts "Adding label: '$label'"
    860899                            set name "page[incr _pages]"
     900                            #puts "Inserting $name into resultpages"
    861901                            set page [$itk_component(resultpages) \
    862902                                insert end $name]
     
    884924                            set reset($page) 1
    885925                        }
    886                         $page.rviewer add $index $xmlobj output.$item
     926                        $page.rviewer add $index $xmlobj output.$item $label $uq_part
    887927                    }
    888928                }
     
    10371077        configure -simcontrolcolor $simcbg
    10381078
    1039         $itk_component(simulate) configure -state disabled
     1079        if {$_uq_active == 0} {
     1080            $itk_component(simulate) configure -state disabled
     1081        }
    10401082        $itk_component(abort) configure -state normal
    10411083
     
    10651107    # Scan through and pick out any =RAPPTURE-PROGRESS=> messages first.
    10661108    #
     1109
    10671110    while {[regexp -indices \
    10681111               {=RAPPTURE-PROGRESS=> *([-+]?[0-9]+) +([^\n]*)(\n|$)} $message \
     
    10801123        foreach {i0 i1} $match break
    10811124        set message [string replace $message $i0 $i1]
     1125    }
     1126
     1127    #
     1128    # Now handle SUBMIT-PROGRESS
     1129    #
     1130    while {[regexp -indices {=SUBMIT-PROGRESS=> aborted=([0-9]+) finished=([0-9]+) failed=([0-9]+) executing=([0-9]+)\
     1131        waiting=([0-9]+) setting_up=([0-9]+) setup=([0-9]+) %done=([0-9.]+) timestamp=([0-9.]+)(\n|$)} $message \
     1132        match aborted finished failed executing waiting setting_up setup percent ts mesg]} {
     1133
     1134        set mesg ""
     1135        foreach {i0 i1} $percent break
     1136        set percent [string range $message $i0 $i1]
     1137        foreach {i0 i1} $failed break
     1138        set failed [string range $message $i0 $i1]
     1139        foreach {i0 i1} $match break
     1140        set message [string replace $message $i0 $i1]
     1141
     1142        if {$failed != 0} {set mesg "$failed jobs failed!"}
     1143        if {$percent >= 100} { set mesg "Jobs finished.  Analyzing results..."}
     1144
     1145        pack $itk_component(progress) -fill x -padx 10 -pady 10
     1146        $itk_component(progress) settings -percent $percent -message $mesg
    10821147    }
    10831148
Note: See TracChangeset for help on using the changeset viewer.