Ignore:
Timestamp:
Jun 16, 2014, 10:42:46 AM (10 years ago)
Author:
gah
Message:

add check for number of field points

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3/gui/scripts/field.tcl

    r4204 r4387  
    10681068# numComponents --
    10691069#
    1070 # Returns if the number of components in the field component.
     1070# Returns the number of components in the field component.
    10711071#
    10721072itcl::body Rappture::Field::numComponents {cname} {
     
    15391539            }
    15401540        }
    1541         if { $dim  != 3 } {
     1541        if { $dim != 3 } {
    15421542            set _dim $dim
    15431543        }
     
    15811581            set _viewer "contour"
    15821582        }
     1583        set numFieldValues [$v length]
     1584        set numComponentsPerPoint [numComponents $cname]
     1585        set numPoints [$mesh numpoints]
     1586        if { ($numPoints * $numComponentsPerPoint) != $numFieldValues } {
     1587            puts stderr "ERROR: Number of points in mesh and field values don't agree"
     1588            return 0
     1589        }
     1590
    15831591        set _comp2dims($cname) "[$mesh dimensions]D"
    15841592        set _comp2mesh($cname) [list $mesh $v]
     
    16031611            return 0
    16041612        }
     1613        set numFieldValues [$v length]
     1614        set numComponentsPerPoint [numComponents $cname]
     1615        set numPoints [$mesh numpoints]
     1616        if { ($numPoints * $numComponentsPerPoint) != $numFieldValues } {
     1617            puts stderr "ERROR: Number of points in mesh and field values don't agree"
     1618            return 0
     1619        }
    16051620        set _comp2dims($cname) "[$mesh dimensions]D"
    16061621        set _comp2mesh($cname) [list $mesh $v]
Note: See TracChangeset for help on using the changeset viewer.