Index: trunk/gui/src/RpDxToVtk.c
===================================================================
--- trunk/gui/src/RpDxToVtk.c	(revision 3943)
+++ trunk/gui/src/RpDxToVtk.c	(revision 3944)
@@ -73,12 +73,14 @@
 
         if (p >= endPtr) {
-            Tcl_AppendResult(interp, "unexpected EOF in reading points",
-                             (char *)NULL);
+            Tcl_AppendResult(interp, "unexpected EOF in reading field values",
+                             (char *)NULL);
+            free(array);
             return TCL_ERROR;
         }
         value = strtod(p, &nextPtr);
         if (nextPtr == p) {
-            Tcl_AppendResult(interp, "bad value found in reading points",
-                             (char *)NULL);
+            Tcl_AppendResult(interp, "bad value found in reading field values",
+                             (char *)NULL);
+            free(array);
             return TCL_ERROR;
         }
@@ -122,12 +124,14 @@
 
         if (p >= endPtr) {
-            Tcl_AppendResult(interp, "unexpected EOF in reading points",
-                             (char *)NULL);
+            Tcl_AppendResult(interp, "unexpected EOF in reading field values",
+                             (char *)NULL);
+            free(array);
             return TCL_ERROR;
         }
         value = strtod(p, &nextPtr);
         if (nextPtr == p) {
-            Tcl_AppendResult(interp, "bad value found in reading points",
-                             (char *)NULL);
+            Tcl_AppendResult(interp, "bad value found in reading field values",
+                             (char *)NULL);
+            free(array);
             return TCL_ERROR;
         }
@@ -169,12 +173,14 @@
 
         if (p >= endPtr) {
-            Tcl_AppendResult(interp, "unexpected EOF in reading points",
-                             (char *)NULL);
+            Tcl_AppendResult(interp, "unexpected EOF in reading field values",
+                             (char *)NULL);
+            free(array);
             return TCL_ERROR;
         }
         value = strtod(p, &nextPtr);
         if (nextPtr == p) {
-            Tcl_AppendResult(interp, "bad value found in reading points",
-                             (char *)NULL);
+            Tcl_AppendResult(interp, "bad value found in reading field values",
+                             (char *)NULL);
+            free(array);
             return TCL_ERROR;
         }
@@ -246,4 +252,77 @@
     return TCL_OK;
 }
+
+static int
+GetUniformFieldVectors(Tcl_Interp *interp, int nPoints, int *counts,
+                       char **stringPtr, const char *endPtr, Tcl_Obj *objPtr) 
+{
+    int i;
+    const char *p;
+    char mesg[2000];
+    double *array;
+    int iX, iY, iZ;
+
+    p = *stringPtr;
+    array = malloc(sizeof(double) * nPoints * 3);
+    if (array == NULL) {
+        return TCL_ERROR;
+    }
+    iX = iY = iZ = 0;
+    for (i = 0; i < nPoints; i++) {
+        double x, y, z;
+        char *nextPtr;
+        int loc;
+
+        if (p >= endPtr) {
+            Tcl_AppendResult(interp, "unexpected EOF in reading vectors",
+                             (char *)NULL);
+            free(array);
+            return TCL_ERROR;
+        }
+        x = strtod(p, &nextPtr);
+        if (nextPtr == p) {
+            Tcl_AppendResult(interp, "bad value found in reading vectors",
+                             (char *)NULL);
+            free(array);
+            return TCL_ERROR;
+        }
+        p = nextPtr;
+        y = strtod(p, &nextPtr);
+        if (nextPtr == p) {
+            Tcl_AppendResult(interp, "bad value found in reading vectors",
+                             (char *)NULL);
+            free(array);
+            return TCL_ERROR;
+        }
+        p = nextPtr;
+        z = strtod(p, &nextPtr);
+        if (nextPtr == p) {
+            Tcl_AppendResult(interp, "bad value found in reading vectors",
+                             (char *)NULL);
+            free(array);
+            return TCL_ERROR;
+        }
+        p = nextPtr;
+        loc = iZ*counts[0]*counts[1] + iY*counts[0] + iX;
+        if (++iZ >= counts[2]) {
+            iZ = 0;
+            if (++iY >= counts[1]) {
+                iY = 0;
+                ++iX;
+            }
+        }
+        array[loc*3  ] = x;
+        array[loc*3+1] = y;
+        array[loc*3+2] = z;
+    }
+    for (i = 0; i < nPoints; i++) {
+        sprintf(mesg, "%g %g %g\n", array[i*3], array[i*3+1], array[i*3+2]);
+        Tcl_AppendToObj(objPtr, mesg, -1);
+    }
+    free(array);
+    *stringPtr = (char *)p;
+    return TCL_OK;
+}
+
 #if defined(DO_WEDGES) && defined(CHECK_WINDINGS)
 static void
@@ -301,4 +380,5 @@
     int isUniform;
     int isStructuredGrid;
+    int hasVectors;
     int i, ix, iy, iz;
 
@@ -312,6 +392,7 @@
     dv2[0] = dv2[1] = dv2[2] = 0.0;
     count[0] = count[1] = count[2] = 0; /* Suppress compiler warning. */
-    isUniform = 1; /* Default to expecting uniform grid */
+    isUniform = 0;
     isStructuredGrid = 0;
+    hasVectors = 0;
 
     if (objc != 2) {
@@ -414,20 +495,56 @@
                           &count[2]) == 1) {
             // Z grid
+            isUniform = 0;
+        } else if (sscanf(line, "object %*d class array type %*s shape 3 rank 1"
+                          " items %d data follows", &nPoints) == 1) {
+#ifdef notdef
+                fprintf(stderr, "found class array type shape 3 nPoints=%d\n",
+                        nPoints);
+#endif
+            if (isUniform) {
+                hasVectors = 1;
+                if (GetUniformFieldVectors(interp, nPoints, count, &p, pend, fieldObjPtr)
+                    != TCL_OK) {
+                    return TCL_ERROR;
+                }
+            } else {
+                // This is a 2D point cloud in xy with a uniform zgrid
+                isUniform = 0;
+                nXYPoints = nPoints;
+                if (nXYPoints < 0) {
+                    sprintf(mesg, "bad # points %d", nXYPoints);
+                    Tcl_AppendResult(interp, mesg, (char *)NULL);
+                    return TCL_ERROR;
+                }
+                points = malloc(sizeof(double) * nXYPoints * 2);
+                if (GetPoints(interp, points, nXYPoints, &p, pend) != TCL_OK) {
+                    return TCL_ERROR;
+                }
+            }
         } else if (sscanf(line, "object %*d class array type %*s rank 1 shape 3"
-                          " items %d data follows", &nXYPoints) == 1) {
-            // This is a 2D point cloud in xy with a uniform zgrid
-            isUniform = 0;
+                          " items %d data follows", &nPoints) == 1) {
 #ifdef notdef
-            fprintf(stderr, "found class array type shape 3 nPoints=%d\n",
-                    nPoints);
-#endif
-            if (nXYPoints < 0) {
-                sprintf(mesg, "bad # points %d", nXYPoints);
-                Tcl_AppendResult(interp, mesg, (char *)NULL);
-                return TCL_ERROR;
-            }
-            points = malloc(sizeof(double) * nXYPoints * 2);
-            if (GetPoints(interp, points, nXYPoints, &p, pend) != TCL_OK) {
-                return TCL_ERROR;
+                fprintf(stderr, "found class array type shape 3 nPoints=%d\n",
+                        nPoints);
+#endif
+            if (isUniform) {
+                hasVectors = 1;
+                if (GetUniformFieldVectors(interp, nPoints, count, &p, pend, fieldObjPtr)
+                    != TCL_OK) {
+                    return TCL_ERROR;
+                }
+            } else {
+                // This is a 2D point cloud in xy with a uniform zgrid
+                isUniform = 0;
+                nXYPoints = nPoints;
+                if (nXYPoints < 0) {
+                    sprintf(mesg, "bad # points %d", nXYPoints);
+                    Tcl_AppendResult(interp, mesg, (char *)NULL);
+                    return TCL_ERROR;
+                }
+                points = malloc(sizeof(double) * nXYPoints * 2);
+                if (GetPoints(interp, points, nXYPoints, &p, pend) != TCL_OK) {
+                    return TCL_ERROR;
+                }
             }
         } else if (sscanf(line, "object %*d class array type %*s rank 0"
@@ -488,8 +605,13 @@
         sprintf(mesg, "POINT_DATA %d\n", nPoints);
         Tcl_AppendToObj(objPtr, mesg, -1);
-        sprintf(mesg, "SCALARS %s double 1\n", name);
-        Tcl_AppendToObj(objPtr, mesg, -1);
-        sprintf(mesg, "LOOKUP_TABLE default\n");
-        Tcl_AppendToObj(objPtr, mesg, -1);
+        if (hasVectors) {
+            sprintf(mesg, "VECTORS %s double\n", name);
+            Tcl_AppendToObj(objPtr, mesg, -1);
+        } else {
+            sprintf(mesg, "SCALARS %s double 1\n", name);
+            Tcl_AppendToObj(objPtr, mesg, -1);
+            sprintf(mesg, "LOOKUP_TABLE default\n");
+            Tcl_AppendToObj(objPtr, mesg, -1);
+        }
         Tcl_AppendObjToObj(objPtr, fieldObjPtr);
     } else if (isStructuredGrid) {
