Changeset 4666 for branches/1.3
- Timestamp:
- Nov 8, 2014, 5:58:32 PM (10 years ago)
- Location:
- branches/1.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3
- Property svn:mergeinfo changed
/trunk merged: 4639,4659
- Property svn:mergeinfo changed
-
branches/1.3/gui/scripts/field.tcl
r4665 r4666 1514 1514 set dim 0 1515 1515 foreach axis {x y z} { 1516 foreach {min max} [$mesh limits $axis] { 1516 foreach {min max} [$mesh limits $axis] { 1517 1517 if { $min < $max } { 1518 1518 incr dim -
branches/1.3/gui/scripts/mesh.tcl
r4512 r4666 518 518 set ${axis}Max $max 519 519 set ${axis}Num $num 520 if {$min > $max} { 521 puts stderr "ERROR: grid $axis axis minimum larger than maximum" 522 return 0 523 } 520 524 incr numUniform 521 525 } elseif { $coords != "" } { … … 557 561 set _dim 3 558 562 set _numPoints [expr $xNum * $yNum * $zNum] 559 set _numCells [expr ($xNum - 1) * ($yNum - 1) * ($zNum -1)]563 set _numCells [expr ($xNum > 1 ? ($xNum - 1) : 1) * ($yNum > 1 ? ($yNum - 1) : 1) * ($zNum > 1 ? ($zNum - 1) : 1)] 560 564 if { ($_numPoints*3) != $numCoords } { 561 565 puts stderr "WARNING: bad grid \"$path\": invalid grid: \# of points does not match dimensions <xdim> * <ydim> * <zdim>" … … 580 584 set _dim 2 581 585 set _numPoints [expr $xNum * $yNum] 582 set _numCells [expr ($xNum - 1) * ($yNum -1)]586 set _numCells [expr ($xNum > 1 ? ($xNum - 1) : 1) * ($yNum > 1 ? ($yNum - 1) : 1)] 583 587 if { ($_numPoints*2) != $numCoords } { 584 588 puts stderr "WARNING: bad grid \"$path\": \# of points does not match dimensions <xdim> * <ydim>" … … 630 634 # This results in a STRUCTURED_POINTS 631 635 if { $_dim == 1 } { 632 set xSpace [expr ($xMax - $xMin) / double($xNum - 1)] 636 if {$xNum == 1} { 637 set xSpace 0 638 } else { 639 set xSpace [expr ($xMax - $xMin) / double($xNum - 1)] 640 } 633 641 set _numPoints $xNum 634 642 set _numCells [expr $xNum - 1] … … 642 650 set _limits(z) [list 0 0] 643 651 } elseif { $_dim == 2 } { 644 set xSpace [expr ($xMax - $xMin) / double($xNum - 1)] 645 set ySpace [expr ($yMax - $yMin) / double($yNum - 1)] 652 if {$xNum == 1} { 653 set xSpace 0 654 } else { 655 set xSpace [expr ($xMax - $xMin) / double($xNum - 1)] 656 } 657 if {$yNum == 1} { 658 set ySpace 0 659 } else { 660 set ySpace [expr ($yMax - $yMin) / double($yNum - 1)] 661 } 646 662 set _numPoints [expr $xNum * $yNum] 647 set _numCells [expr ($xNum - 1) * ($yNum -1)]663 set _numCells [expr ($xNum > 1 ? ($xNum - 1) : 1) * ($yNum > 1 ? ($yNum - 1) : 1)] 648 664 append out "DATASET STRUCTURED_POINTS\n" 649 665 append out "DIMENSIONS $xNum $yNum 1\n" … … 656 672 set _limits(z) [list 0 0] 657 673 } elseif { $_dim == 3 } { 658 set xSpace [expr ($xMax - $xMin) / double($xNum - 1)] 659 set ySpace [expr ($yMax - $yMin) / double($yNum - 1)] 660 set zSpace [expr ($zMax - $zMin) / double($zNum - 1)] 674 if {$xNum == 1} { 675 set xSpace 0 676 } else { 677 set xSpace [expr ($xMax - $xMin) / double($xNum - 1)] 678 } 679 if {$yNum == 1} { 680 set ySpace 0 681 } else { 682 set ySpace [expr ($yMax - $yMin) / double($yNum - 1)] 683 } 684 if {$zNum == 1} { 685 set zSpace 0 686 } else { 687 set zSpace [expr ($zMax - $zMin) / double($zNum - 1)] 688 } 661 689 set _numPoints [expr $xNum * $yNum * $zNum] 662 set _numCells [expr ($xNum - 1) * ($yNum - 1) * ($zNum -1)]690 set _numCells [expr ($xNum > 1 ? ($xNum - 1) : 1) * ($yNum > 1 ? ($yNum - 1) : 1) * ($zNum > 1 ? ($zNum - 1) : 1)] 663 691 append out "DATASET STRUCTURED_POINTS\n" 664 692 append out "DIMENSIONS $xNum $yNum $zNum\n" … … 713 741 if { $_dim == 3 } { 714 742 set _numPoints [expr $xNum * $yNum * $zNum] 715 set _numCells [expr ($xNum - 1) * ($yNum - 1) * ($zNum -1)]743 set _numCells [expr ($xNum > 1 ? ($xNum - 1) : 1) * ($yNum > 1 ? ($yNum - 1) : 1) * ($zNum > 1 ? ($zNum - 1) : 1)] 716 744 append out "DATASET RECTILINEAR_GRID\n" 717 745 append out "DIMENSIONS $xNum $yNum $zNum\n" … … 733 761 } elseif { $_dim == 2 } { 734 762 set _numPoints [expr $xNum * $yNum] 735 set _numCells [expr ($xNum - 1) * ($yNum -1)]763 set _numCells [expr ($xNum > 1 ? ($xNum - 1) : 1) * ($yNum > 1 ? ($yNum - 1) : 1)] 736 764 append out "DATASET RECTILINEAR_GRID\n" 737 765 append out "DIMENSIONS $xNum $yNum 1\n"
Note: See TracChangeset
for help on using the changeset viewer.