Index: vtkCellType.h
===================================================================
RCS file: /cvsroot/VTK/VTK/Filtering/vtkCellType.h,v
retrieving revision 1.5
diff -u -r1.5 vtkCellType.h
--- vtkCellType.h	7 May 2007 15:40:59 -0000	1.5
+++ vtkCellType.h	10 Aug 2007 14:45:50 -0000
@@ -71,6 +71,12 @@
   VTK_BIQUADRATIC_QUADRATIC_WEDGE      = 32,
   VTK_BIQUADRATIC_QUADRATIC_HEXAHEDRON = 33,
 
+  // Cubic isoparametric cells
+  VTK_CUBIC_EDGE                       = 34,
+  VTK_CUBIC_TRIANGLE                   = 35, // not yet implemented
+  VTK_BICUBIC_QUAD                     = 36,
+  VTK_TRICUBIC_HEXAHEDRON              = 37,
+  
   // Special class of cells formed by convex group of points
   VTK_CONVEX_POINT_SET = 41,
 
Index: vtkCellTypes.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Filtering/vtkCellTypes.cxx,v
retrieving revision 1.3
diff -u -r1.3 vtkCellTypes.cxx
--- vtkCellTypes.cxx	7 May 2007 15:40:59 -0000	1.3
+++ vtkCellTypes.cxx	10 Aug 2007 14:45:50 -0000
@@ -56,9 +56,10 @@
   "vtkQuadraticLinearWedge",
   "vtkBiquadraticQuadraticWedge",
   "vtkBiquadraticQuadraticHexahedron",
-  "UnknownClass",
-  "UnknownClass",
-  "UnknownClass",
+  "vtkCubicEdge",
+  "vtkCubicTriangle", // not yet implemented
+  "vtkBiCubicQuad",
+  "vtkTriCubicHexahedron",
   "UnknownClass",
   "UnknownClass",
   "UnknownClass",
Index: vtkGenericCell.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Filtering/vtkGenericCell.cxx,v
retrieving revision 1.6
diff -u -r1.6 vtkGenericCell.cxx
--- vtkGenericCell.cxx	31 Jul 2006 22:18:16 -0000	1.6
+++ vtkGenericCell.cxx	10 Aug 2007 14:45:50 -0000
@@ -47,6 +47,9 @@
 #include "vtkQuadraticLinearWedge.h"
 #include "vtkBiQuadraticQuadraticWedge.h"
 #include "vtkBiQuadraticQuadraticHexahedron.h"
+#include "vtkCubicEdge.h"
+#include "vtkBiCubicQuad.h"
+#include "vtkTriCubicHexahedron.h"
 
 vtkCxxRevisionMacro(vtkGenericCell, "$Revision: 1.6 $");
 vtkStandardNewMacro(vtkGenericCell);
@@ -310,6 +313,15 @@
   case VTK_BIQUADRATIC_QUADRATIC_HEXAHEDRON:
     cell = vtkBiQuadraticQuadraticHexahedron::New ();
     break;
+ case VTK_CUBIC_EDGE:
+    cell = vtkCubicEdge::New();
+    break;
+ case VTK_BICUBIC_QUAD:
+    cell = vtkBiCubicQuad::New();
+    break;
+ case VTK_TRICUBIC_HEXAHEDRON:
+    cell = vtkTriCubicHexahedron::New ();
+    break;
   case VTK_CONVEX_POINT_SET:
     cell = vtkConvexPointSet::New();
     break;
Index: vtkGenericCell.h
===================================================================
RCS file: /cvsroot/VTK/VTK/Filtering/vtkGenericCell.h,v
retrieving revision 1.5
diff -u -r1.5 vtkGenericCell.h
--- vtkGenericCell.h	31 Jul 2006 20:54:57 -0000	1.5
+++ vtkGenericCell.h	10 Aug 2007 14:45:50 -0000
@@ -124,7 +124,10 @@
     this->SetCellType(VTK_TRIQUADRATIC_HEXAHEDRON);}
   void SetCellTypeToBiQuadraticQuadraticHexahedron() {
     this->SetCellType(VTK_BIQUADRATIC_QUADRATIC_HEXAHEDRON);}
-
+  void SetCellTypeToCubicEdge() {this->SetCellType(VTK_CUBIC_EDGE);}
+  void SetCellTypeToBiCubicQuad() {this->SetCellType(VTK_BICUBIC_QUAD);}
+  void SetCellTypeToTriCubicHexahedron() {
+    this->SetCellType(VTK_TRICUBIC_HEXAHEDRON);}
   // Description:
   // Instantiate a new vtkCell based on it's cell type value
   static vtkCell* InstantiateCell(int cellType);
Index: vtkUnstructuredGrid.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Filtering/vtkUnstructuredGrid.cxx,v
retrieving revision 1.11
diff -u -r1.11 vtkUnstructuredGrid.cxx
--- vtkUnstructuredGrid.cxx	22 May 2007 13:44:32 -0000	1.11
+++ vtkUnstructuredGrid.cxx	10 Aug 2007 14:45:50 -0000
@@ -55,8 +55,11 @@
 #include "vtkBiQuadraticQuad.h"
 #include "vtkBiQuadraticQuadraticWedge.h"
 #include "vtkBiQuadraticQuadraticHexahedron.h"
+#include "vtkCubicEdge.h"
+#include "vtkBiCubicQuad.h"
+#include "vtkTriCubicHexahedron.h"
 
-vtkCxxRevisionMacro(vtkUnstructuredGrid, "$Revision: 1.11 $");
+vtkCxxRevisionMacro(vtkUnstructuredGrid, "$Revision: 1.10 $");
 vtkStandardNewMacro(vtkUnstructuredGrid);
 
 vtkUnstructuredGrid::vtkUnstructuredGrid ()
@@ -86,11 +89,14 @@
   this->QuadraticPyramid = NULL;
   this->QuadraticLinearQuad = NULL;
   this->BiQuadraticQuad = NULL;
-  this->TriQuadraticHexahedron = NULL;
+  this->TriQuadraticHexahedron = NULL; 
   this->QuadraticLinearWedge = NULL;
   this->BiQuadraticQuadraticWedge = NULL;
   this->BiQuadraticQuadraticHexahedron = NULL;
-  
+  this->CubicEdge = NULL;
+  this->BiCubicQuad = NULL;
+  this->TriCubicHexahedron = NULL;
+   
   this->ConvexPointSet = NULL;
   this->EmptyCell = NULL;
 
@@ -269,6 +275,18 @@
     {
     this->BiQuadraticQuadraticHexahedron->Delete ();
     }
+  if(this->CubicEdge)
+    {
+    this->CubicEdge->Delete();
+    }
+  if(this->BiCubicQuad)
+    {
+    this->BiCubicQuad->Delete();
+    }
+  if(this->TriCubicHexahedron)
+    {
+    this->TriCubicHexahedron->Delete ();
+    }
 
   if(this->ConvexPointSet)
     {
@@ -660,6 +678,30 @@
       cell = this->ConvexPointSet;
       break;
 
+    case VTK_CUBIC_EDGE:
+      if(!this->CubicEdge)
+        {
+        this->CubicEdge = vtkCubicEdge::New();
+        }
+      cell = this->CubicEdge;
+      break;
+
+    case VTK_BICUBIC_QUAD:
+      if(!this->BiCubicQuad)
+        {
+        this->BiCubicQuad = vtkBiCubicQuad::New();
+        }
+      cell = this->BiCubicQuad;
+      break;
+
+    case VTK_TRICUBIC_HEXAHEDRON:
+      if(!this->TriCubicHexahedron)
+        {
+        this->TriCubicHexahedron = vtkTriCubicHexahedron::New();
+        }
+      cell = this->TriCubicHexahedron;
+      break;
+
     case VTK_EMPTY_CELL:
       if(!this->EmptyCell)
         {
Index: vtkUnstructuredGrid.h
===================================================================
RCS file: /cvsroot/VTK/VTK/Filtering/vtkUnstructuredGrid.h,v
retrieving revision 1.8
diff -u -r1.8 vtkUnstructuredGrid.h
--- vtkUnstructuredGrid.h	1 May 2006 20:17:02 -0000	1.8
+++ vtkUnstructuredGrid.h	10 Aug 2007 14:45:51 -0000
@@ -60,7 +60,9 @@
 class vtkBiQuadraticQuad;
 class vtkBiQuadraticQuadraticWedge;
 class vtkBiQuadraticQuadraticHexahedron;
-
+class vtkCubicEdge;
+class vtkBiCubicQuad;
+class vtkTriCubicHexahedron;
 
 class VTK_FILTERING_EXPORT vtkUnstructuredGrid : public vtkPointSet 
 {
@@ -214,6 +216,9 @@
   vtkQuadraticLinearWedge           *QuadraticLinearWedge;
   vtkBiQuadraticQuadraticWedge      *BiQuadraticQuadraticWedge;
   vtkBiQuadraticQuadraticHexahedron *BiQuadraticQuadraticHexahedron;
+  vtkCubicEdge                      *CubicEdge;
+  vtkBiCubicQuad                      *BiCubicQuad;
+  vtkTriCubicHexahedron         *TriCubicHexahedron;
   vtkConvexPointSet                 *ConvexPointSet;
   vtkEmptyCell                      *EmptyCell;
   
Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/VTK/VTK/Filtering/CMakeLists.txt,v
retrieving revision 1.158
diff -u -r1.158 CMakeLists.txt
--- CMakeLists.txt	5 Mar 2007 13:34:24 -0000	1.158
+++ CMakeLists.txt	10 Aug 2007 14:45:51 -0000
@@ -13,6 +13,7 @@
 vtkActor2DCollection.cxx
 vtkAlgorithm.cxx
 vtkAlgorithmOutput.cxx
+vtkBiCubicQuad.cxx
 vtkBiQuadraticQuad.cxx
 vtkBiQuadraticQuadraticHexahedron.cxx
 vtkBiQuadraticQuadraticWedge.cxx
@@ -33,6 +34,7 @@
 vtkCone.cxx
 vtkConvexPointSet.cxx
 vtkCoordinate.cxx
+vtkCubicEdge.cxx
 vtkCylinder.cxx
 vtkDataObject.cxx
 vtkDataObjectAlgorithm.cxx
@@ -207,6 +209,7 @@
 vtkTreeDFSIterator.cxx
 vtkTriangle.cxx
 vtkTriangleStrip.cxx
+vtkTriCubicHexahedron.cxx
 vtkTriQuadraticHexahedron.cxx
 vtkTrivialProducer.cxx
 vtkUniformGrid.cxx
Index: Testing/Cxx/CMakeLists.txt
===================================================================
RCS file: /cvsroot/VTK/VTK/Filtering/Testing/Cxx/CMakeLists.txt,v
retrieving revision 1.13
diff -u -r1.13 CMakeLists.txt
--- Testing/Cxx/CMakeLists.txt	8 May 2006 18:23:14 -0000	1.13
+++ Testing/Cxx/CMakeLists.txt	10 Aug 2007 14:45:51 -0000
@@ -2,6 +2,8 @@
 #
 # Create a test lists
 CREATE_TEST_SOURCELIST(Tests ${KIT}CxxTests.cxx
+  cubicCellConsistency.cxx 
+  cubicEvaluation.cxx 
   quadCellConsistency.cxx
   otherColorTransferFunction.cxx
   TestInterpolationFunctions.cxx
Index: Testing/Cxx/TestInterpolationFunctions.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Filtering/Testing/Cxx/TestInterpolationFunctions.cxx,v
retrieving revision 1.13
diff -u -r1.13 TestInterpolationFunctions.cxx
--- Testing/Cxx/TestInterpolationFunctions.cxx	31 Jul 2006 20:54:57 -0000	1.13
+++ Testing/Cxx/TestInterpolationFunctions.cxx	10 Aug 2007 14:45:51 -0000
@@ -55,6 +55,11 @@
 #include "vtkQuadraticLinearWedge.h"
 #include "vtkTriQuadraticHexahedron.h"
 
+//Cubic cells
+#include "vtkCubicEdge.h"
+#include "vtkBiCubicQuad.h"
+#include "vtkTriCubicHexahedron.h"
+
 template <class TCell>
 int TestOneInterpolationFunction()
 {
@@ -155,5 +160,10 @@
   r += TestOneInterpolationFunction<vtkQuadraticLinearWedge>();
   r += TestOneInterpolationFunction<vtkTriQuadraticHexahedron>();
 
+  // Cubic cells
+  r += TestOneInterpolationFunction<vtkCubicEdge>();
+  r += TestOneInterpolationFunction<vtkBiCubicQuad>();
+  r += TestOneInterpolationFunction<vtkTriCubicHexahedron>();
+
   return r;
 }
Index: Testing/Cxx/TestInterpolationDerivs.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Filtering/Testing/Cxx/TestInterpolationDerivs.cxx,v
retrieving revision 1.5
diff -u -r1.5 TestInterpolationDerivs.cxx
--- Testing/Cxx/TestInterpolationDerivs.cxx	31 Jul 2006 20:54:57 -0000	1.5
+++ Testing/Cxx/TestInterpolationDerivs.cxx	10 Aug 2007 14:45:51 -0000
@@ -13,6 +13,7 @@
 
 =========================================================================*/
 #define VTK_EPSILON 1e-10
+#define VTK_NUMDERIV_EPSILON 1e-5
 
 // Subclass of vtkCell
 //#include "vtkEmptyCell.h"
@@ -55,6 +56,10 @@
 #include "vtkQuadraticLinearWedge.h"
 #include "vtkTriQuadraticHexahedron.h"
 
+//New cubic cells from gebbert
+#include "vtkCubicEdge.h"
+#include "vtkBiCubicQuad.h"
+#include "vtkTriCubicHexahedron.h"
 
 template <class TCell>
 int TestOneInterpolationDerivs()
@@ -63,20 +68,117 @@
   int numPts = cell->GetNumberOfPoints();
   int dim = cell->GetCellDimension();
   double *derivs = new double[dim*numPts];
+  double *weights_left = new double[numPts];
+  double *weights_right = new double[numPts];
   double *coords = cell->GetParametricCoords();
+  double leftcoords_x[numPts][3];
+  double leftcoords_y[numPts][3];
+  double leftcoords_z[numPts][3];
+  double rightcoords_x[numPts][3];
+  double rightcoords_y[numPts][3];
+  double rightcoords_z[numPts][3];
+  // h
+  double h = 0.0000001;
   int r = 0;
-  for(int i=0;i<numPts;++i)
+
+  // To check if the derivation numbering and scale is correct (different
+  // parametric spaces are used eg: [-1; 1] and [ 0; 1]) 
+  // we check the derivations with numerical differentiation
+  // BUT this algorithm needs the correct implementation of the cell interpolation functions
+
+  // first create the parametric coordinates for the central difference scheme:
+  //
+  //                f(x + h, y, z) - f(x - h, y, z)
+  //  f'(x,y,z)|x = -------------------------------
+  //                              2h
+  //                f(x, y + h, z) - f(x, y - h, z)
+  //  f'(x,y,z)|y = -------------------------------
+  //                              2h
+  //                f(x, y, z + h) - f(x, y, z - h)
+  //  f'(x,y,z)|z = -------------------------------
+  //                              2h
+
+  for(int i = 0; i < numPts; i++)
     {
-    double *point = coords + 3*i;
-    double sum = 0.;
-    cell->InterpolateDerivs(point, derivs); // static function
-    for(int j=0;j<dim*numPts;j++)
+    for(int k = 0; k < 3; k++)
       {
-      sum += derivs[j];
+      leftcoords_x[i][k]  =  coords[i*3 + k];
+      leftcoords_y[i][k]  =  coords[i*3 + k];
+      leftcoords_z[i][k]  =  coords[i*3 + k];
+      rightcoords_x[i][k] =  coords[i*3 + k];
+      rightcoords_y[i][k] =  coords[i*3 + k];
+      rightcoords_z[i][k] =  coords[i*3 + k];
+      // x direction
+      if(k == 0)
+        {
+      	leftcoords_x[i][k]  -= h;
+        rightcoords_x[i][k] +=  h;
+	}
+      // y direction
+      if(k == 1)
+        {
+      	leftcoords_y[i][k]  -= h;
+        rightcoords_y[i][k] +=  h;
+	}
+      // z direction
+      if(k == 2)
+        {
+      	leftcoords_z[i][k]  -= h;
+        rightcoords_z[i][k] +=  h;
+	}
       }
-    if( fabs(sum) > VTK_EPSILON )
+    }
+  
+  // check the cell derivatives for each cell dimension
+  for(int k = 0; k < dim; k++) 
+    {  
+    // check for each point
+    for(int i=0;i<numPts;++i)
       {
-      ++r;
+      double *point = coords + 3*i;
+      cell->InterpolateDerivs(point, derivs); // static function
+
+      // compute the weights at the left and right side of the node
+      // x direction
+      if(k == 0)
+        {
+        cell->InterpolateFunctions(leftcoords_x[i], weights_left); // static function
+        cell->InterpolateFunctions(rightcoords_x[i], weights_right); // static function
+	}
+ 
+      // y direction
+      if(k == 1)
+        {
+        cell->InterpolateFunctions(leftcoords_y[i], weights_left); // static function
+        cell->InterpolateFunctions(rightcoords_y[i], weights_right); // static function
+	}
+ 
+      // z direction
+      if(k == 2)
+        {
+        cell->InterpolateFunctions(leftcoords_z[i], weights_left); // static function
+        cell->InterpolateFunctions(rightcoords_z[i], weights_right); // static function
+	}
+ 
+      double sum = 0.0;
+      // compute the central difference quotient numerical and 
+      // calculate the difference between the analytic and numerical solution
+      for(int j = 0; j < numPts; j++)
+        {
+	double ndiff = (weights_right[j] - weights_left[j])/(2*h);
+        sum += fabs(derivs[j + k*numPts] - ndiff);
+        if(fabs(derivs[j + k*numPts] - ndiff) > VTK_NUMDERIV_EPSILON)
+          {
+	  cerr << "Error in InterpolateDerivs in cell type " << cell->GetCellType() 
+	       << " at position derivs[" << j + k*numPts << "]" << endl;
+	  r++;
+	  }	
+        }
+      if(sum > VTK_NUMDERIV_EPSILON)
+        {
+	cerr << "Error in InterpolateDerivs in cell type " << cell->GetCellType() << endl;
+	r++;
+	}
       }
     }
 
@@ -96,17 +198,18 @@
 
   cell->Delete();
   delete[] derivs;
+  delete[] weights_left;
+  delete[] weights_right;
   return r;
 }
 
 int TestInterpolationDerivs(int, char *[])
 {
   int r = 0;
-  
   // Subclasses of vtkCell3D
   //r += TestOneInterpolationDerivs<vtkEmptyCell>(); // not implemented
   //r += TestOneInterpolationDerivs<vtkGenericCell>(); // not implemented
-  //r += TestOneInterpolationDerivs<vtkLine>();
+  r += TestOneInterpolationDerivs<vtkLine>();
   r += TestOneInterpolationDerivs<vtkPixel>();
   //r += TestOneInterpolationDerivs<vtkPolygon>(); // not implemented
   //r += TestOneInterpolationDerivs<vtkPolyLine>(); // not implemented
@@ -122,7 +225,7 @@
   r += TestOneInterpolationDerivs<vtkHexahedron>();
   r += TestOneInterpolationDerivs<vtkPentagonalPrism>();
   r += TestOneInterpolationDerivs<vtkPyramid>();
-  //r += TestOneInterpolationDerivs<vtkTetra>();
+  r += TestOneInterpolationDerivs<vtkTetra>();
   r += TestOneInterpolationDerivs<vtkVoxel>();
   r += TestOneInterpolationDerivs<vtkWedge>();
 
@@ -136,7 +239,6 @@
   r += TestOneInterpolationDerivs<vtkQuadraticTriangle>();
   r += TestOneInterpolationDerivs<vtkQuadraticWedge>();
 
-
   // New bi-class
   r += TestOneInterpolationDerivs<vtkBiQuadraticQuad>();
   r += TestOneInterpolationDerivs<vtkBiQuadraticQuadraticHexahedron>();
@@ -145,6 +247,9 @@
   r += TestOneInterpolationDerivs<vtkQuadraticLinearWedge>();
   r += TestOneInterpolationDerivs<vtkTriQuadraticHexahedron>();
 
-
+  // New cubic cells
+  r += TestOneInterpolationDerivs<vtkCubicEdge>();
+  r += TestOneInterpolationDerivs<vtkBiCubicQuad>();
+  r += TestOneInterpolationDerivs<vtkTriCubicHexahedron>();
   return r;
 }
