Changeset 5343


Ignore:
Timestamp:
Apr 28, 2015, 11:42:22 PM (5 years ago)
Author:
ldelgass
Message:

Don't alloc vectors until we checked for failure cases in VtkDataSetToXy?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/field.tcl

    r5330 r5343  
    12881288    }
    12891289    set numPoints [$dataset GetNumberOfPoints]
     1290    set dataAttrs [$dataset GetPointData]
     1291    if { $dataAttrs == ""} {
     1292        puts stderr "WARNING: No point data found"
     1293        return 0
     1294    }
     1295    set array [$dataAttrs GetScalars]
     1296    if { $array == ""} {
     1297        puts stderr "WARNING: No scalar point data found"
     1298        return 0
     1299    }
     1300    # Multi-component scalars (e.g. color scalars) are not supported
     1301    if { [$array GetNumberOfComponents] != 1 } {
     1302        return 0
     1303    }
     1304    set numTuples [$array GetNumberOfTuples]
    12901305    set xv [blt::vector create \#auto]
    12911306    for { set i 0 } { $i < $numPoints } { incr i } {
     
    12941309    }
    12951310    set yv [blt::vector create \#auto]
    1296     set dataAttrs [$dataset GetPointData]
    1297     if { $dataAttrs == ""} {
    1298         puts stderr "WARNING: No point data found"
    1299         return 0
    1300     }
    1301     set array [$dataAttrs GetScalars]
    1302     if { $array == ""} {
    1303         puts stderr "WARNING: No scalar point data found"
    1304         return 0
    1305     }
    1306     # Multi-component scalars (e.g. color scalars) are not supported
    1307     if { [$array GetNumberOfComponents] != 1 } {
    1308         return 0
    1309     }
    1310     set numTuples [$array GetNumberOfTuples]
    13111311    for { set i 0 } { $i < $numTuples } { incr i } {
    13121312        $yv append [$array GetComponent $i 0]
Note: See TracChangeset for help on using the changeset viewer.