diff --git a/Plugin/Gradient.cpp b/Plugin/Gradient.cpp
index 0c14556f3b28e319280b790991f311be0655edc3..3e84a72e24ef65135406cbb4ceeb512a41505b39 100644
--- a/Plugin/Gradient.cpp
+++ b/Plugin/Gradient.cpp
@@ -1,4 +1,4 @@
-// $Id: Gradient.cpp,v 1.16 2008-05-12 20:24:05 geuzaine Exp $
+// $Id: Gradient.cpp,v 1.17 2008-06-06 19:14:35 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -67,19 +67,35 @@ void GMSH_GradientPlugin::catchErrorMessage(char *errorMessage) const
   strcpy(errorMessage, "Gradient failed...");
 }
 
-static List_T *incrementList(PViewDataList *data2, int numEdges)
+static List_T *incrementList(PViewDataList *data2, int numComp, int numEdges)
 {
-  switch(numEdges){
-  case 0: data2->NbVP++; return data2->VP;
-  case 1: data2->NbVL++; return data2->VL;
-  case 3: data2->NbVT++; return data2->VT;
-  case 4: data2->NbVQ++; return data2->VQ;
-  case 6: data2->NbVS++; return data2->VS;
-  case 12: data2->NbVH++; return data2->VH;
-  case 9: data2->NbVI++; return data2->VI;
-  case 8: data2->NbVY++; return data2->VY;
-  default: return 0;
+  if(numComp == 1){
+    switch(numEdges){
+    case 0: data2->NbVP++; return data2->VP;
+    case 1: data2->NbVL++; return data2->VL;
+    case 3: data2->NbVT++; return data2->VT;
+    case 4: data2->NbVQ++; return data2->VQ;
+    case 6: data2->NbVS++; return data2->VS;
+    case 12: data2->NbVH++; return data2->VH;
+    case 9: data2->NbVI++; return data2->VI;
+    case 8: data2->NbVY++; return data2->VY;
+    default: return 0;
+    }
+  }
+  else if(numComp == 3){
+    switch(numEdges){
+    case 0: data2->NbTP++; return data2->TP;
+    case 1: data2->NbTL++; return data2->TL;
+    case 3: data2->NbTT++; return data2->TT;
+    case 4: data2->NbTQ++; return data2->TQ;
+    case 6: data2->NbTS++; return data2->TS;
+    case 12: data2->NbTH++; return data2->TH;
+    case 9: data2->NbTI++; return data2->TI;
+    case 8: data2->NbTY++; return data2->TY;
+    default: return 0;
+    }
   }
+  return 0;
 }
 
 PView *GMSH_GradientPlugin::execute(PView *v)
@@ -102,9 +118,9 @@ PView *GMSH_GradientPlugin::execute(PView *v)
     for(int ele = 0; ele < data1->getNumElements(0, ent); ele++){
       if(data1->skipElement(0, ent, ele)) continue;
       int numComp = data1->getNumComponents(0, ent, ele);
-      if(numComp != 1) continue;
+      if(numComp != 1 && numComp != 3) continue;
       int numEdges = data1->getNumEdges(0, ent, ele);
-      List_T *out = incrementList(data2, numEdges);
+      List_T *out = incrementList(data2, numComp, numEdges);
       if(!out) continue;
       int numNodes = data1->getNumNodes(0, ent, ele);
       double x[8], y[8], z[8], val[8 * 3];
@@ -119,14 +135,17 @@ PView *GMSH_GradientPlugin::execute(PView *v)
       for(int nod = 0; nod < numNodes; nod++) List_Add(out, &z[nod]);
       for(int step = 0; step < data1->getNumTimeSteps(); step++){
 	for(int nod = 0; nod < numNodes; nod++)
-	  data1->getValue(step, ent, ele, nod, 0, val[nod]);
+	  for(int comp = 0; comp < numComp; comp++)
+	    data1->getValue(step, ent, ele, nod, comp, val[numComp * nod + comp]);
 	for(int nod = 0; nod < numNodes; nod++){
 	  double u, v, w, f[3];
 	  element->getNode(nod, u, v, w);
-	  element->interpolateGrad(val, u, v, w, f, 1);
-	  List_Add(out, &f[0]);
-	  List_Add(out, &f[1]);
-	  List_Add(out, &f[2]);
+	  for(int comp = 0; comp < numComp; comp++){
+	    element->interpolateGrad(val + comp, u, v, w, f, numComp);
+	    List_Add(out, &f[0]);
+	    List_Add(out, &f[1]);
+	    List_Add(out, &f[2]);
+	  }
 	}
       }
       delete element;