Posted to tcl by mig at Fri Jan 09 02:55:01 GMT 2015view pretty

    for {set i5 0} {$i5 < $ncells} {incr i5} {
	set calck [expr {$i5/$grdsize}]
	set grdindex [expr {$i5-$calck*$grdsize}]
	set volpt [[contGeom GetOutput] GetPoint $i5];# HERE!
	set volz [lindex $volpt 2]
	if {$calck < $volzdim-1} {
	    set i5b [expr {$i5 + $grdsize}]
	} else {
	    set i5b [expr {$i5 - $grdsize}]
	}
	set volptb [[contGeom GetOutput] GetPoint $i5b];# HERE!
	set volzb [lindex $volptb 2]
	set zgriddim [expr {abs($volz - $volzb)}]
	
	set cellvol [expr {$dx*$dy*$zgriddim}]  
	
	set ptscal [[[[contGeom GetOutput] GetPointData] GetScalars] GetValue $i5];# HERE!
	
	if {$volz>=$elev1 && $volz<=$elev2} {
	    if {$threshtype==1 && $ptscal>= $volcontvalU} {
		sumcells
	    } elseif {$threshtype==0 && $ptscal>=$volcontvalL && $ptscal<=$volcontvalU} {
		sumcells
	    } elseif {$threshtype==-1 && $ptscal<=$volcontvalL} {
		sumcells
	    }
	} else {
	    eval [[[[contGeom GetOutput] GetPointData] GetScalars] SetValue $i5 $repor];# HERE!!!
	}
    }