source: trunk/gui/scripts/uqinfo.tcl @ 6527

Last change on this file since 6527 was 6021, checked in by ldelgass, 8 years ago

Merge UQ and fixes from 1.4 branch

File size: 2.8 KB
Line 
1# -*- mode: tcl; indent-tabs-mode: nil -*-
2
3package require Itcl
4package require BLT
5
6namespace eval Rappture {
7    # forward declaration
8}
9
10itcl::class Rappture::UqInfo {
11    constructor {xmlobj path uq_part} {
12        # defined below
13    }
14    destructor {
15        # defined below
16    }
17
18    public method add {xmlobj path uq_part}
19    public method get {}
20    public method desc {}
21    public method hints {{key ""}}
22    private method _renumber {}
23    private variable _objlist;      # UQ objects
24}
25
26# ----------------------------------------------------------------------
27# CONSTRUCTOR
28# ----------------------------------------------------------------------
29itcl::body Rappture::UqInfo::constructor {xmlobj path uq_part} {
30    #puts "UQ INFO CONST $xmlobj $path $uq_part"
31    if {![Rappture::library isvalid $xmlobj]} {
32        error "bad value \"$xmlobj\": should be LibraryObj"
33    }
34    add $xmlobj $path $uq_part
35}
36
37# ----------------------------------------------------------------------
38# DESTRUCTOR
39# ----------------------------------------------------------------------
40itcl::body Rappture::UqInfo::destructor {} {
41}
42
43itcl::body Rappture::UqInfo::_renumber {} {
44    set numtabs [array size _objlist]
45    set index 0
46
47    foreach name [list PDF Probability Sensitivity Response "All Runs" Sequence ] {
48        if {[info exists _objlist($name)]} {
49            foreach {i items} $_objlist($name) break
50            set _objlist($name) [list $index $items]
51            incr index
52        }
53    }
54}
55
56#
57# _objlist is an array of lists.
58# lindex 0 is the index (tab number)
59# lindex 1 is a list of lists containing the xmlobj and path
60# of each element.
61itcl::body Rappture::UqInfo::add {xmlobj path uq_part} {
62    #puts "\nUQ INFO ADD $xmlobj $path $uq_part"
63
64    if {![Rappture::library isvalid $xmlobj]} {
65        error "bad value \"$xmlobj\": should be LibraryObj"
66    }
67
68    if {![info exists _objlist($uq_part)]} {
69        set _objlist($uq_part)  {0 {}}
70    }
71
72    foreach {index items} $_objlist($uq_part) break
73    lappend items [list $xmlobj $path]
74    set _objlist($uq_part) [list $index $items]
75    _renumber
76}
77
78
79# ----------------------------------------------------------------------
80# USAGE: get
81#
82# Clients use this to query the list of objects being plotted.
83# ----------------------------------------------------------------------
84itcl::body Rappture::UqInfo::get {} {
85    #uts "UqInfo::get"
86    return [array get _objlist]
87}
88
89# ----------------------------------------------------------------------
90# USAGE: hints ?<keyword>?
91#
92# Returns a list of key/value pairs for various hints about plotting
93# this curve.  If a particular <keyword> is specified, then it returns
94# the hint for that <keyword>, if it exists.
95# ----------------------------------------------------------------------
96itcl::body Rappture::UqInfo::hints {{keyword ""}} {
97    #puts "UqInfo hints $keyword"
98}
Note: See TracBrowser for help on using the repository browser.