[vtk-developers] vtkCell::InterpolationFunction / InterpolationDerivs

Mathieu Malaterre mathieu.malaterre at kitware.com
Tue May 2 16:34:31 EDT 2006


Hello,

	I would like to change the signature of the following functions:

  static void InterpolationFunctions (double pcoords[3], double *weights);
  static void InterpolationDerivs (double pcoords[3], double *derivs);

into:

  virtual void InterpolationFunctions (double pcoords[3], double *weights);
  virtual void InterpolationDerivs (double pcoords[3], double *derivs);


Reasons:
* Take advantage of run time info
eg. templated code for test: TestInterpolationFunctions.cxx

* Consistent signature
eg. vtkTetra::InterpolationDerivs(double derivs[])

* Allow one to provide an implementation for vtkPolygon, since we need 
class member info. See vtk hand book for implementation.

* Provide straightforward implementation for vtkGenericCell


Impact:
Code like this:

    case VTK_SINGLE_POINT: // cellId can only be = 0
      vtkVertex::InterpolationFunctions(pcoords,weights);
      iMax = loc[0];
      jMax = loc[1];
      kMax = loc[2];
      cell = this->Vertex;
      break;
    case VTK_X_LINE:
      vtkLine::InterpolationFunctions(pcoords,weights);
      iMax = loc[0] + 1;
      jMax = loc[1];
      kMax = loc[2];
      cell = this->Line;
      break;

would become:

    case VTK_SINGLE_POINT: // cellId can only be = 0
      iMax = loc[0];
      jMax = loc[1];
      kMax = loc[2];
      cell = this->Vertex;
      break;
    case VTK_X_LINE:
      iMax = loc[0] + 1;
      jMax = loc[1];
      kMax = loc[2];
      cell = this->Line;
      break;
   } // end switch
   cell->InterpolationFunctions(pcoords,weights);


But the main reason remain that this should make life of programmer 
easier by avoiding templated code like

VTK/Filtering/Testing/Cxx/TestInterpolationFunctions.cxx

or the non-templated version at:

VTK/GenericFiltering/Testing/Cxx/vtkBridgeCell.cxx
(vtkBridgeCell::InterpolationFunctions)


Those static functions should not be widespread, therefore I don't think 
we need a deprecation mechanism for those, since they remain mostly for 
internal use.


Comments ?
Mathieu



More information about the vtk-developers mailing list