Index: trunk/gui/scripts/mesh.tcl
===================================================================
--- trunk/gui/scripts/mesh.tcl	(revision 5002)
+++ trunk/gui/scripts/mesh.tcl	(revision 5003)
@@ -1,3 +1,3 @@
-# -*- mode: tcl; indent-tabs-mode: nil -*- 
+# -*- mode: tcl; indent-tabs-mode: nil -*-
 
 # ----------------------------------------------------------------------
@@ -18,27 +18,27 @@
 package require Itcl
 
-namespace eval Rappture { 
-    # forward declaration 
+namespace eval Rappture {
+    # forward declaration
 }
 
 itcl::class Rappture::Mesh {
-    private variable _xmlobj ""  ;	# Ref to XML obj with device data
-    private variable _mesh ""    ;	# Lib obj representing this mesh
-    private variable _dim	0;	# Dimension of mesh (1, 2, or 3)
-    private variable _type "";		# Indicates the type of mesh.
-    private variable _axis2units;	# System of units for x, y, z
-    private variable _axis2labels;      # 
-    private variable _hints 
-    private variable _limits        ;	# Array of mesh limits. Keys are 
-					# xmin, xmax, ymin, ymax, ...
-    private variable _numPoints 0   ;	# # of points in mesh
-    private variable _numCells 0   ;	# # of cells in mesh
-    private variable _vtkdata "";	# Mesh in vtk file format.
+    private variable _xmlobj ""  ;      # Ref to XML obj with device data
+    private variable _mesh ""    ;      # Lib obj representing this mesh
+    private variable _dim        0;     # Dimension of mesh (1, 2, or 3)
+    private variable _type "";          # Indicates the type of mesh.
+    private variable _axis2units;       # System of units for x, y, z
+    private variable _axis2labels;      #
+    private variable _hints
+    private variable _limits        ;   # Array of mesh limits. Keys are
+                                        # xmin, xmax, ymin, ymax, ...
+    private variable _numPoints 0   ;   # # of points in mesh
+    private variable _numCells 0   ;    # # of cells in mesh
+    private variable _vtkdata "";       # Mesh in vtk file format.
     private variable _isValid 0;        # Indicates if the mesh is valid.
-    constructor {xmlobj path} { 
-	# defined below 
-    }
-    destructor { 
-	# defined below 
+    constructor {xmlobj path} {
+        # defined below
+    }
+    destructor {
+        # defined below
     }
     public method points {}
@@ -58,26 +58,26 @@
     public method vtkdata {{what -partial}}
     public method type {} {
-	return $_type
+        return $_type
     }
     public method numpoints {} {
-	return $_numPoints
+        return $_numPoints
     }
     public method numcells {} {
-	return $_numCells
-    }
-
-    private common _xp2obj       ;	# used for fetch/release ref counting
-    private common _obj2ref      ;	# used for fetch/release ref counting
-    private variable _xv	""
-    private variable _yv	""
-    private variable _zv	""
-    private variable _xCoords	"";	# For the blt contour only
-    private variable _yCoords	"";	# For the blt contour only
-    
+        return $_numCells
+    }
+
+    private common _xp2obj       ;        # used for fetch/release ref counting
+    private common _obj2ref      ;        # used for fetch/release ref counting
+    private variable _xv        ""
+    private variable _yv        ""
+    private variable _zv        ""
+    private variable _xCoords        "";  # For the blt contour only
+    private variable _yCoords        "";  # For the blt contour only
+
     private method ReadNodesElements {path}
-    private method GetDimension { path } 
-    private method GetDouble { path } 
-    private method GetInt { path } 
-    private method InitHints {} 
+    private method GetDimension { path }
+    private method GetDouble { path }
+    private method GetInt { path }
+    private method InitHints {}
     private method ReadGrid { path }
     private method ReadUnstructuredGrid { path }
@@ -164,7 +164,7 @@
     foreach u $units axis { x y z } {
         if { $u != "" } {
-            set _axis2units($axis) $u 
+            set _axis2units($axis) $u
         } else {
-            set _axis2units($axis) $first 
+            set _axis2units($axis) $first
         }
     }
@@ -179,9 +179,9 @@
     # Meshes comes in a variety of flavors
     #
-    # Dimensionality is determined from the <dimension> tag.  
+    # Dimensionality is determined from the <dimension> tag.
     #
     # <vtk> described mesh
     # <element> +  <node> definitions
-    # <grid>		rectangular mesh 
+    # <grid>		rectangular mesh
     # <unstructured>    homogeneous cell type mesh.
 
@@ -189,10 +189,10 @@
     set subcount 0
     foreach cname [$_mesh children] {
-	foreach type { vtk grid unstructured } {
-	    if { $cname == $type } {
-		incr subcount
-		break
-	    } 
-	}
+        foreach type { vtk grid unstructured } {
+            if { $cname == $type } {
+                incr subcount
+                break
+            }
+        }
     }
     if {[$_mesh element "node"] != "" ||
@@ -206,14 +206,14 @@
     }
     if { $subcount > 1 } {
-	puts stderr "WARNING: too many mesh types specified for \"$path\"."
+        puts stderr "WARNING: too many mesh types specified for \"$path\"."
         return
     }
     set result 0
     if { [$_mesh element "vtk"] != ""} {
-	set result [ReadVtk $path]
+        set result [ReadVtk $path]
     } elseif {[$_mesh element "grid"] != "" } {
-	set result [ReadGrid $path]
+        set result [ReadGrid $path]
     } elseif {[$_mesh element "unstructured"] != "" } {
-	set result [ReadUnstructuredGrid $path]
+        set result [ReadUnstructuredGrid $path]
     } elseif {[$_mesh element "node"] != "" && [$_mesh element "element"] != ""} {
         set result [ReadNodesElements $path]
@@ -231,25 +231,25 @@
 
     if { $_xCoords != "" } {
-	blt::vector destroy $_xCoords
+        blt::vector destroy $_xCoords
     }
     if { $_yCoords != "" } {
-	blt::vector destroy $_yCoords
-    }
-}
-
-#
-# vtkdata -- 
-#
-#	This is called by the field object to generate a VTK file to send to
-#	the remote render server.  Returns the vtkDataSet object containing
-#	(at this point) just the mesh.  The field object doesn't know (or
-#	care) what type of mesh is used.  The field object will add field
-#	arrays before generating output to send to the remote render server.
+        blt::vector destroy $_yCoords
+    }
+}
+
+#
+# vtkdata --
+#
+#        This is called by the field object to generate a VTK file to send to
+#        the remote render server.  Returns the vtkDataSet object containing
+#        (at this point) just the mesh.  The field object doesn't know (or
+#        care) what type of mesh is used.  The field object will add field
+#        arrays before generating output to send to the remote render server.
 #
 itcl::body Rappture::Mesh::vtkdata {{what -partial}} {
     if {$what == "-full"} {
         append out "# vtk DataFile Version 3.0\n"
-	append out "[hints label]\n"
-	append out "ASCII\n"
+        append out "[hints label]\n"
+        append out "ASCII\n"
         append out $_vtkdata
         return $out
@@ -340,10 +340,10 @@
 itcl::body Rappture::Mesh::mesh { {type "vtk"} } {
     switch $type {
-	"vtk" { 
-	    return ""
-	}
-	default { 
-	    error "Requested mesh type \"$type\" is unknown."
-	}
+        "vtk" {
+            return ""
+        }
+        default {
+            error "Requested mesh type \"$type\" is unknown."
+        }
     }
 }
@@ -443,5 +443,5 @@
     set string [$_xmlobj get $path.dim]
     if { $string == "" } {
-	puts stderr "WARNING: no tag <dim> found in mesh \"$path\"."
+        puts stderr "WARNING: no tag <dim> found in mesh \"$path\"."
         return 0
     }
@@ -479,5 +479,5 @@
         return 0
     }
-    # Create a VTK file with the mesh in it.  
+    # Create a VTK file with the mesh in it.
     set _vtkdata [$_xmlobj get $path.vtk]
     append out "# vtk DataFile Version 3.0\n"
@@ -521,22 +521,22 @@
     set numCurvilinear 0
     foreach axis { x y z } {
-	set min    [$_xmlobj get "$path.grid.${axis}axis.min"]
-	set max    [$_xmlobj get "$path.grid.${axis}axis.max"]
-	set num    [$_xmlobj get "$path.grid.${axis}axis.numpoints"]
-	set coords [$_xmlobj get "$path.grid.${axis}coords"]
-	set dim    [$_xmlobj get "$path.grid.${axis}dim"]
-	if { $min != "" && $max != "" && $num != "" && $num > 0 } {
-	    set ${axis}Min $min
-	    set ${axis}Max $max
-	    set ${axis}Num $num
+        set min    [$_xmlobj get "$path.grid.${axis}axis.min"]
+        set max    [$_xmlobj get "$path.grid.${axis}axis.max"]
+        set num    [$_xmlobj get "$path.grid.${axis}axis.numpoints"]
+        set coords [$_xmlobj get "$path.grid.${axis}coords"]
+        set dim    [$_xmlobj get "$path.grid.${axis}dim"]
+        if { $min != "" && $max != "" && $num != "" && $num > 0 } {
+            set ${axis}Min $min
+            set ${axis}Max $max
+            set ${axis}Num $num
             if {$min > $max} {
                 puts stderr "ERROR: grid $axis axis minimum larger than maximum"
                 return 0
             }
-	    incr numUniform
-	} elseif { $coords != "" } {
-	    incr numRectilinear
-	    set ${axis}Coords $coords
-	} elseif { $dim != "" } {
+            incr numUniform
+        } elseif { $coords != "" } {
+            incr numRectilinear
+            set ${axis}Coords $coords
+        } elseif { $dim != "" } {
             set ${axis}Num $dim
             incr numCurvilinear
@@ -545,7 +545,7 @@
     set _dim [expr $numRectilinear + $numUniform + $numCurvilinear]
     if { $_dim == 0 } {
-	# No data found.
+        # No data found.
         puts stderr "WARNING: bad grid \"$path\": no data found"
-	return 0
+        return 0
     }
     if { $numCurvilinear > 0 } {
@@ -560,5 +560,5 @@
             return 0
         }
-	if { ![info exists xNum] } {
+        if { ![info exists xNum] } {
             puts stderr "WARNING: bad grid \"$path\": invalid dimensions for curvilinear grid: missing <xdim> from grid description."
             return 0
@@ -572,5 +572,5 @@
         if { [info exists zNum] } {
             set _dim 3
-	    set _numPoints [expr $xNum * $yNum * $zNum]
+            set _numPoints [expr $xNum * $yNum * $zNum]
             set _numCells [expr ($xNum > 1 ? ($xNum - 1) : 1) * ($yNum > 1 ? ($yNum - 1) : 1) * ($zNum > 1 ? ($zNum - 1) : 1)]
             if { ($_numPoints*3) != $numCoords } {
@@ -583,17 +583,17 @@
             }
             $all split $xv $yv $zv
-	    foreach axis {x y z} {
+            foreach axis {x y z} {
                 set vector [set ${axis}v]
                 set _limits($axis) [$vector limits]
-	    }
-	    append out "DATASET STRUCTURED_GRID\n"
-	    append out "DIMENSIONS $xNum $yNum $zNum\n"
-	    append out "POINTS $_numPoints double\n"
+            }
+            append out "DATASET STRUCTURED_GRID\n"
+            append out "DIMENSIONS $xNum $yNum $zNum\n"
+            append out "POINTS $_numPoints double\n"
             append out [$all range 0 end]
             append out "\n"
-	    set _vtkdata $out
+            set _vtkdata $out
         } elseif { [info exists yNum] } {
             set _dim 2
-	    set _numPoints [expr $xNum * $yNum]
+            set _numPoints [expr $xNum * $yNum]
             set _numCells [expr ($xNum > 1 ? ($xNum - 1) : 1) * ($yNum > 1 ? ($yNum - 1) : 1)]
             if { ($_numPoints*2) != $numCoords } {
@@ -605,17 +605,17 @@
                 return 0
             }
-	    foreach axis {x y} {
+            foreach axis {x y} {
                 set vector [set ${axis}v]
                 set _limits($axis) [$vector limits]
-	    }
+            }
             set _limits(z) [list 0 0]
             $zv seq 0 0 [$xv length]
             $all merge $xv $yv $zv
-	    append out "DATASET STRUCTURED_GRID\n"
-	    append out "DIMENSIONS $xNum $yNum 1\n"
-	    append out "POINTS $_numPoints double\n"
+            append out "DATASET STRUCTURED_GRID\n"
+            append out "DIMENSIONS $xNum $yNum 1\n"
+            append out "POINTS $_numPoints double\n"
             append out [$all range 0 end]
             append out "\n"
-	    set _vtkdata $out
+            set _vtkdata $out
         } else {
             set _dim 1
@@ -632,16 +632,16 @@
             $zv seq 0 0 [$xv length]
             $all merge $xv $yv $zv
-	    append out "DATASET STRUCTURED_GRID\n"
-	    append out "DIMENSIONS $xNum 1 1\n"
-	    append out "POINTS $_numPoints double\n"
+            append out "DATASET STRUCTURED_GRID\n"
+            append out "DIMENSIONS $xNum 1 1\n"
+            append out "POINTS $_numPoints double\n"
             append out [$all range 0 end]
             append out "\n"
-	    set _vtkdata $out
-	}
+            set _vtkdata $out
+        }
         blt::vector destroy $all $xv $yv $zv
-	return 1
+        return 1
     }
     if { $numRectilinear == 0 && $numUniform > 0} {
-	# This is the special case where all axes 2D/3D are uniform.  
+        # This is the special case where all axes 2D/3D are uniform.
         # This results in a STRUCTURED_POINTS
         if { $_dim == 1 } {
@@ -651,15 +651,15 @@
                 set xSpace [expr ($xMax - $xMin) / double($xNum - 1)]
             }
-	    set _numPoints $xNum
+            set _numPoints $xNum
             set _numCells [expr $xNum - 1]
-	    append out "DATASET STRUCTURED_POINTS\n"
-	    append out "DIMENSIONS $xNum 1 1\n"
-	    append out "ORIGIN $xMin 0 0\n"
-	    append out "SPACING $xSpace 0 0\n"
-	    set _vtkdata $out
+            append out "DATASET STRUCTURED_POINTS\n"
+            append out "DIMENSIONS $xNum 1 1\n"
+            append out "ORIGIN $xMin 0 0\n"
+            append out "SPACING $xSpace 0 0\n"
+            set _vtkdata $out
             set _limits(x) [list $xMin $xMax]
             set _limits(y) [list 0 0]
             set _limits(z) [list 0 0]
-	} elseif { $_dim == 2 } {
+        } elseif { $_dim == 2 } {
             if {$xNum == 1} {
                 set xSpace 0
@@ -672,16 +672,16 @@
                 set ySpace [expr ($yMax - $yMin) / double($yNum - 1)]
             }
-	    set _numPoints [expr $xNum * $yNum]
+            set _numPoints [expr $xNum * $yNum]
             set _numCells [expr ($xNum > 1 ? ($xNum - 1) : 1) * ($yNum > 1 ? ($yNum - 1) : 1)]
-	    append out "DATASET STRUCTURED_POINTS\n"
-	    append out "DIMENSIONS $xNum $yNum 1\n"
-	    append out "ORIGIN $xMin $yMin 0\n"
-	    append out "SPACING $xSpace $ySpace 0\n"
-	    set _vtkdata $out
-	    foreach axis {x y} {
-		set _limits($axis) [list [set ${axis}Min] [set ${axis}Max]]
-	    }
+            append out "DATASET STRUCTURED_POINTS\n"
+            append out "DIMENSIONS $xNum $yNum 1\n"
+            append out "ORIGIN $xMin $yMin 0\n"
+            append out "SPACING $xSpace $ySpace 0\n"
+            set _vtkdata $out
+            foreach axis {x y} {
+                set _limits($axis) [list [set ${axis}Min] [set ${axis}Max]]
+            }
             set _limits(z) [list 0 0]
-	} elseif { $_dim == 3 } {
+        } elseif { $_dim == 3 } {
             if {$xNum == 1} {
                 set xSpace 0
@@ -699,29 +699,29 @@
                 set zSpace [expr ($zMax - $zMin) / double($zNum - 1)]
             }
-	    set _numPoints [expr $xNum * $yNum * $zNum]
+            set _numPoints [expr $xNum * $yNum * $zNum]
             set _numCells [expr ($xNum > 1 ? ($xNum - 1) : 1) * ($yNum > 1 ? ($yNum - 1) : 1) * ($zNum > 1 ? ($zNum - 1) : 1)]
-	    append out "DATASET STRUCTURED_POINTS\n"
-	    append out "DIMENSIONS $xNum $yNum $zNum\n"
-	    append out "ORIGIN $xMin $yMin $zMin\n"
-	    append out "SPACING $xSpace $ySpace $zSpace\n"
-	    set _vtkdata $out
-	    foreach axis {x y z} {
-		set _limits($axis) [list [set ${axis}Min] [set ${axis}Max]]
-	    }
-	} else { 
-	    puts stderr "WARNING: bad grid \"$path\": bad dimension \"$_dim\""
+            append out "DATASET STRUCTURED_POINTS\n"
+            append out "DIMENSIONS $xNum $yNum $zNum\n"
+            append out "ORIGIN $xMin $yMin $zMin\n"
+            append out "SPACING $xSpace $ySpace $zSpace\n"
+            set _vtkdata $out
+            foreach axis {x y z} {
+                set _limits($axis) [list [set ${axis}Min] [set ${axis}Max]]
+            }
+        } else {
+            puts stderr "WARNING: bad grid \"$path\": bad dimension \"$_dim\""
             return 0
-	}
-	return 1
+        }
+        return 1
     }
     # This is the hybrid case.  Some axes are uniform, others are nonuniform.
     set xv [blt::vector create \#auto]
     if { [info exists xMin] } {
-	$xv seq $xMin $xMax $xNum
-    } else {
-	$xv set [$_xmlobj get $path.grid.xcoords]
-	set xMin [$xv min]
-	set xMax [$xv max]
-	set xNum [$xv length]
+        $xv seq $xMin $xMax $xNum
+    } else {
+        $xv set [$_xmlobj get $path.grid.xcoords]
+        set xMin [$xv min]
+        set xMax [$xv max]
+        set xNum [$xv length]
     }
     set yv [blt::vector create \#auto]
@@ -740,67 +740,67 @@
     set zv [blt::vector create \#auto]
     if { $_dim == 3 } {
-	if { [info exists zMin] } {
-	    $zv seq $zMin $zMax $zNum
-	}  else {
-	    $zv set [$_xmlobj get $path.grid.zcoords]
-	    set zMin [$zv min]
-	    set zMax [$zv max]
-	    set zNum [$zv length]
-	}
-    } else {
-	set zNum 1
+        if { [info exists zMin] } {
+            $zv seq $zMin $zMax $zNum
+        }  else {
+            $zv set [$_xmlobj get $path.grid.zcoords]
+            set zMin [$zv min]
+            set zMax [$zv max]
+            set zNum [$zv length]
+        }
+    } else {
+        set zNum 1
     }
     if { $_dim == 3 } {
-	set _numPoints [expr $xNum * $yNum * $zNum]
+        set _numPoints [expr $xNum * $yNum * $zNum]
         set _numCells [expr ($xNum > 1 ? ($xNum - 1) : 1) * ($yNum > 1 ? ($yNum - 1) : 1) * ($zNum > 1 ? ($zNum - 1) : 1)]
-	append out "DATASET RECTILINEAR_GRID\n"
-	append out "DIMENSIONS $xNum $yNum $zNum\n"
-	append out "X_COORDINATES $xNum double\n"
-	append out [$xv range 0 end]
-	append out "\n"
-	append out "Y_COORDINATES $yNum double\n"
-	append out [$yv range 0 end]
-	append out "\n"
-	append out "Z_COORDINATES $zNum double\n"
-	append out [$zv range 0 end]
-	append out "\n"
-	set _vtkdata $out
-	foreach axis {x y z} {
-	    if { [info exists ${axis}Min] } {
-		set _limits($axis) [list [set ${axis}Min] [set ${axis}Max]]
-	    }
-	}
+        append out "DATASET RECTILINEAR_GRID\n"
+        append out "DIMENSIONS $xNum $yNum $zNum\n"
+        append out "X_COORDINATES $xNum double\n"
+        append out [$xv range 0 end]
+        append out "\n"
+        append out "Y_COORDINATES $yNum double\n"
+        append out [$yv range 0 end]
+        append out "\n"
+        append out "Z_COORDINATES $zNum double\n"
+        append out [$zv range 0 end]
+        append out "\n"
+        set _vtkdata $out
+        foreach axis {x y z} {
+            if { [info exists ${axis}Min] } {
+                set _limits($axis) [list [set ${axis}Min] [set ${axis}Max]]
+            }
+        }
     } elseif { $_dim == 2 } {
-	set _numPoints [expr $xNum * $yNum]
+        set _numPoints [expr $xNum * $yNum]
         set _numCells [expr ($xNum > 1 ? ($xNum - 1) : 1) * ($yNum > 1 ? ($yNum - 1) : 1)]
-	append out "DATASET RECTILINEAR_GRID\n"
-	append out "DIMENSIONS $xNum $yNum 1\n"
-	append out "X_COORDINATES $xNum double\n"
-	append out [$xv range 0 end]
-	append out "\n"
-	append out "Y_COORDINATES $yNum double\n"
-	append out [$yv range 0 end]
-	append out "\n"
-	append out "Z_COORDINATES 1 double\n"
-	append out "0\n"
-	foreach axis {x y} {
-	    if { [info exists ${axis}Min] } {
-		set _limits($axis) [list [set ${axis}Min] [set ${axis}Max]]
-	    }
-	}
+        append out "DATASET RECTILINEAR_GRID\n"
+        append out "DIMENSIONS $xNum $yNum 1\n"
+        append out "X_COORDINATES $xNum double\n"
+        append out [$xv range 0 end]
+        append out "\n"
+        append out "Y_COORDINATES $yNum double\n"
+        append out [$yv range 0 end]
+        append out "\n"
+        append out "Z_COORDINATES 1 double\n"
+        append out "0\n"
+        foreach axis {x y} {
+            if { [info exists ${axis}Min] } {
+                set _limits($axis) [list [set ${axis}Min] [set ${axis}Max]]
+            }
+        }
         set _limits(z) [list 0 0]
-	set _vtkdata $out
+        set _vtkdata $out
     } elseif { $_dim == 1 } {
         set _numPoints $xNum
         set _numCells [expr $xNum - 1]
-	append out "DATASET RECTILINEAR_GRID\n"
-	append out "DIMENSIONS $xNum 1 1\n"
-	append out "X_COORDINATES $xNum double\n"
-	append out [$xv range 0 end]
-	append out "\n"
-	append out "Y_COORDINATES 1 double\n"
-	append out "0\n"
-	append out "Z_COORDINATES 1 double\n"
-	append out "0\n"
+        append out "DATASET RECTILINEAR_GRID\n"
+        append out "DIMENSIONS $xNum 1 1\n"
+        append out "X_COORDINATES $xNum double\n"
+        append out [$xv range 0 end]
+        append out "\n"
+        append out "Y_COORDINATES 1 double\n"
+        append out "0\n"
+        append out "Z_COORDINATES 1 double\n"
+        append out "0\n"
         if { [info exists xMin] } {
             set _limits(x) [list $xMin $xMax]
@@ -808,10 +808,10 @@
         set _limits(y) [list 0 0]
         set _limits(z) [list 0 0]
-	set _vtkdata $out
-    } else {
-	puts stderr "WARNING: bad grid \"$path\": invalid dimension \"$_dim\""
+        set _vtkdata $out
+    } else {
+        puts stderr "WARNING: bad grid \"$path\": invalid dimension \"$_dim\""
         return 0
     }
-    blt::vector destroy $xv $yv $zv 
+    blt::vector destroy $xv $yv $zv
     return 1
 }
@@ -847,12 +847,12 @@
     set celltypes {}
     foreach { a b c } $triangles {
-	append data " 3 $a $b $c\n"
-	append celltypes "5\n"
-	incr _numCells
+        append data " 3 $a $b $c\n"
+        append celltypes "5\n"
+        incr _numCells
     }
     append out "DATASET UNSTRUCTURED_GRID\n"
     append out "POINTS $_numPoints double\n"
     foreach x [$xv range 0 end] y [$yv range 0 end] z [$zv range 0 end] {
-	append out " $x $y $z\n"
+        append out " $x $y $z\n"
     }
     set count [expr $_numCells * 4]
@@ -879,12 +879,12 @@
     set celltypes {}
     foreach { a b c d } $quads {
-	append data " 4 $a $b $c $d\n"
-	append celltypes "9\n"
-	incr _numCells
+        append data " 4 $a $b $c $d\n"
+        append celltypes "9\n"
+        incr _numCells
     }
     append out "DATASET UNSTRUCTURED_GRID\n"
     append out "POINTS $_numPoints double\n"
     foreach x [$xv range 0 end] y [$yv range 0 end] z [$zv range 0 end] {
-	append out " $x $y $z\n"
+        append out " $x $y $z\n"
     }
     set count [expr $_numCells * 5]
@@ -916,6 +916,6 @@
             continue
         }
-	append data " $numIndices $line\n"
-	incr _numCells
+        append data " $numIndices $line\n"
+        incr _numCells
         set count [expr $count + $numIndices + 1]
     }
@@ -923,5 +923,5 @@
     append out "POINTS $_numPoints double\n"
     foreach x [$xv range 0 end] y [$yv range 0 end] z [$zv range 0 end] {
-	append out " $x $y $z\n"
+        append out " $x $y $z\n"
     }
     append out "VERTICES $_numCells $count\n"
@@ -950,6 +950,6 @@
             continue
         }
-	append data " $numIndices $line\n"
-	incr _numCells
+        append data " $numIndices $line\n"
+        incr _numCells
         set count [expr $count + $numIndices + 1]
     }
@@ -957,5 +957,5 @@
     append out "POINTS $_numPoints double\n"
     foreach x [$xv range 0 end] y [$yv range 0 end] z [$zv range 0 end] {
-	append out " $x $y $z\n"
+        append out " $x $y $z\n"
     }
     append out "LINES $_numCells $count\n"
@@ -984,6 +984,6 @@
             continue
         }
-	append data " $numIndices $line\n"
-	incr _numCells
+        append data " $numIndices $line\n"
+        incr _numCells
         set count [expr $count + $numIndices + 1]
     }
@@ -991,5 +991,5 @@
     append out "POINTS $_numPoints double\n"
     foreach x [$xv range 0 end] y [$yv range 0 end] z [$zv range 0 end] {
-	append out " $x $y $z\n"
+        append out " $x $y $z\n"
     }
     append out "POLYGONS $_numCells $count\n"
@@ -1018,6 +1018,6 @@
             continue
         }
-	append data " $numIndices $line\n"
-	incr _numCells
+        append data " $numIndices $line\n"
+        incr _numCells
         set count [expr $count + $numIndices + 1]
     }
@@ -1025,5 +1025,5 @@
     append out "POINTS $_numPoints double\n"
     foreach x [$xv range 0 end] y [$yv range 0 end] z [$zv range 0 end] {
-	append out " $x $y $z\n"
+        append out " $x $y $z\n"
     }
     append out "TRIANGLE_STRIPS $_numCells $count\n"
@@ -1047,12 +1047,12 @@
     set celltypes {}
     foreach { a b c d } $tetras {
-	append data " 4 $a $b $c $d\n"
-	append celltypes "10\n"
-	incr _numCells
+        append data " 4 $a $b $c $d\n"
+        append celltypes "10\n"
+        incr _numCells
     }
     append out "DATASET UNSTRUCTURED_GRID\n"
     append out "POINTS $_numPoints double\n"
     foreach x [$xv range 0 end] y [$yv range 0 end] z [$zv range 0 end] {
-	append out " $x $y $z\n"
+        append out " $x $y $z\n"
     }
     set count [expr $_numCells * 5]
@@ -1076,12 +1076,12 @@
     set celltypes {}
     foreach { a b c d e f g h } $hexas {
-	append data " 8 $a $b $c $d $e $f $g $h\n"
-	append celltypes "12\n"
-	incr _numCells
+        append data " 8 $a $b $c $d $e $f $g $h\n"
+        append celltypes "12\n"
+        incr _numCells
     }
     append out "DATASET UNSTRUCTURED_GRID\n"
     append out "POINTS $_numPoints double\n"
     foreach x [$xv range 0 end] y [$yv range 0 end] z [$zv range 0 end] {
-	append out " $x $y $z\n"
+        append out " $x $y $z\n"
     }
     set count [expr $_numCells * 9]
@@ -1105,12 +1105,12 @@
     set celltypes {}
     foreach { a b c d e f } $wedges {
-	append data " 6 $a $b $c $d $e $f\n"
-	append celltypes "13\n"
-	incr _numCells
+        append data " 6 $a $b $c $d $e $f\n"
+        append celltypes "13\n"
+        incr _numCells
     }
     append out "DATASET UNSTRUCTURED_GRID\n"
     append out "POINTS $_numPoints double\n"
     foreach x [$xv range 0 end] y [$yv range 0 end] z [$zv range 0 end] {
-	append out " $x $y $z\n"
+        append out " $x $y $z\n"
     }
     set count [expr $_numCells * 7]
@@ -1134,12 +1134,12 @@
     set celltypes {}
     foreach { a b c d e } $pyramids {
-	append data " 5 $a $b $c $d $e\n"
-	append celltypes "14\n"
-	incr _numCells
+        append data " 5 $a $b $c $d $e\n"
+        append celltypes "14\n"
+        incr _numCells
     }
     append out "DATASET UNSTRUCTURED_GRID\n"
     append out "POINTS $_numPoints double\n"
     foreach x [$xv range 0 end] y [$yv range 0 end] z [$zv range 0 end] {
-	append out " $x $y $z\n"
+        append out " $x $y $z\n"
     }
     set count [expr $_numCells * 6]
@@ -1153,5 +1153,5 @@
 
     set _vtkdata $out
-    return 1 
+    return 1
 }
 
@@ -1241,5 +1241,5 @@
     set celltypes [$_xmlobj get $path.unstructured.celltypes]
     if { $numCells == 0 && $celltypes != "" } {
-	puts stderr "WARNING: bad unstuctured grid \"$path\": no <cells> description found."
+        puts stderr "WARNING: bad unstuctured grid \"$path\": no <cells> description found."
         return 0
     }
@@ -1266,5 +1266,5 @@
         }
     }
-    # Step 2: Allow points to be specified as <points> or 
+    # Step 2: Allow points to be specified as <points> or
     #         <xcoords>, <ycoords>, <zcoords>.  Split and convert into
     #         3 vectors, one for each coordinate.
@@ -1414,45 +1414,45 @@
     set data {}
     foreach cname [$_xmlobj children -type node $path] {
-	append data "[$_xmlobj get $path.$cname]\n"
-    }	
+        append data "[$_xmlobj get $path.$cname]\n"
+    }
     Rappture::ReadPoints $data _dim points
     if { $_dim == 2 } {
-	set all [blt::vector create \#auto]
-	set xv [blt::vector create \#auto]
-	set yv [blt::vector create \#auto]
-	set zv [blt::vector create \#auto]
-	$all set $points
-	$all split $xv $yv
-	set _numPoints [$xv length]
+        set all [blt::vector create \#auto]
+        set xv [blt::vector create \#auto]
+        set yv [blt::vector create \#auto]
+        set zv [blt::vector create \#auto]
+        $all set $points
+        $all split $xv $yv
+        set _numPoints [$xv length]
         set _limits(x) [$xv limits]
         set _limits(y) [$yv limits]
         set _limits(z) [list 0 0]
-	# 2D Dataset. All Z coordinates are 0
-	$zv seq 0.0 0.0 $_numPoints
-	$all merge $xv $yv $zv
-	set points [$all range 0 end]
-	blt::vector destroy $all $xv $yv $zv
+        # 2D Dataset. All Z coordinates are 0
+        $zv seq 0.0 0.0 $_numPoints
+        $all merge $xv $yv $zv
+        set points [$all range 0 end]
+        blt::vector destroy $all $xv $yv $zv
     } elseif { $_dim == 3 } {
-	set all [blt::vector create \#auto]
-	set xv [blt::vector create \#auto]
-	set yv [blt::vector create \#auto]
-	set zv [blt::vector create \#auto]
-	$all set $points
-	$all split $xv $yv $zv
-	set _numPoints [$xv length]
+        set all [blt::vector create \#auto]
+        set xv [blt::vector create \#auto]
+        set yv [blt::vector create \#auto]
+        set zv [blt::vector create \#auto]
+        $all set $points
+        $all split $xv $yv $zv
+        set _numPoints [$xv length]
         set _limits(x) [$xv limits]
         set _limits(y) [$yv limits]
         set _limits(z) [$zv limits]
-	set points [$all range 0 end]
-	blt::vector destroy $all $xv $yv $zv
-    } else {
-	error "bad dimension \"$_dim\" for nodes mesh"
+        set points [$all range 0 end]
+        blt::vector destroy $all $xv $yv $zv
+    } else {
+        error "bad dimension \"$_dim\" for nodes mesh"
     }
     array set node2celltype {
-	3 5
-	4 10
-	8 12
-	6 13
-	5 14
+        3 5
+        4 10
+        8 12
+        6 13
+        5 14
     }
     set count 0
@@ -1463,11 +1463,11 @@
     foreach cname [$_xmlobj children -type element $path] {
         set nodeList [$_mesh get $cname.nodes]
-	set numNodes [llength $nodeList]
-	if { ![info exists node2celltype($numNodes)] } {
-	    puts stderr "WARNING: bad nodes/elements mesh \$path\": unknown number of indices \"$_numNodes\": should be 3, 4, 5, 6, or 8"
-	    return 0
-	}
-	set celltype $node2celltype($numNodes)
-	append celltypes "  $celltype\n"
+        set numNodes [llength $nodeList]
+        if { ![info exists node2celltype($numNodes)] } {
+            puts stderr "WARNING: bad nodes/elements mesh \$path\": unknown number of indices \"$_numNodes\": should be 3, 4, 5, 6, or 8"
+            return 0
+        }
+        set celltype $node2celltype($numNodes)
+        append celltypes "  $celltype\n"
         if { $celltype == 12 } {
             # Formerly used voxels instead of hexahedrons. We're converting
@@ -1479,9 +1479,9 @@
             }
             set nodeList $newList
-        } 
-	append data "  $numNodes $nodeList\n"
-	incr _numCells
-	incr count $numNodes 
- 	incr count;			# One extra for the VTK celltype id.
+        }
+        append data "  $numNodes $nodeList\n"
+        incr _numCells
+        incr count $numNodes
+        incr count;                        # One extra for the VTK celltype id.
     }
 
@@ -1496,5 +1496,5 @@
     append out "\n"
     set _vtkdata $out
-    set _isValid 1 
+    set _isValid 1
 }
 
