MantisBT - VTK
View Issue Details
0000565VTK(No Category)public2004-02-02 07:462011-01-13 17:00
john platt 
Mathieu Malaterre 
normalmajoralways
closedfixed 
 
 
0000565: No output from vtkProbeFilter with quadratic hexs
vtkQuadraticHexahedron.cxx at about line 221

// pcoords[0] = params[0] - vtkMath::Determinant3x3 (fcol,scol,tcol) / d;
// pcoords[1] = params[1] - vtkMath::Determinant3x3 (rcol,fcol,tcol) / d;
// pcoords[2] = params[2] - vtkMath::Determinant3x3 (rcol,scol,fcol) / d;

    // The interpolation functions and derivatives are evaluated in the iso-P
    // space (-1,1). The Newton correction must be transformed to the VTK
    // parametric space(0,1) for the coordinate update.
    pcoords[0] = params[0] - 0.5*vtkMath::Determinant3x3 (fcol,scol,tcol) / d;
    pcoords[1] = params[1] - 0.5*vtkMath::Determinant3x3 (rcol,fcol,tcol) / d;
    pcoords[2] = params[2] - 0.5*vtkMath::Determinant3x3 (rcol,scol,fcol) / d;
No tags attached.
Issue History
2010-11-29 17:59Mathieu MalaterreSource_changeset_attached => VTK master 1bd74903
2011-01-13 17:00Source_changeset_attached => VTK master a2bd8391
2011-01-13 17:00Source_changeset_attached => VTK master 020ef709
2011-06-16 13:11Zack GalbreathCategory => (No Category)

Notes
(0000596)
Mathieu Malaterre   
2004-02-02 10:08   
John,
   I am not sure I understand your remark. The interpolation are evaluated in the 'VTK' parametric space. The derivatives are also -as I deduce them from the interpolation functions-. I use a c++ code like this to check they are ok:


//------------------------------------------------------
#include "vtkQuadraticHexahedron.h"
#include <assert.h>

int main()
{
  vtkQuadraticHexahedron *aHex = vtkQuadraticHexahedron::New ();
  double sf[20];
  double *foo = aHex->GetParametricCoords();
  
  for(int i=0;i<60;)
    {
      double point[3];
      point[0] = foo[i++];
      point[1] = foo[i++];
      point[2] = foo[i];
// std::cout << "point(" << i/3 << "):" << point[0] << "," << point[1] << "," << point[2] << std::endl;
      aHex->InterpolationFunctions(point, sf);
      std::cout << "sf(" << i/3 << "):" << std::endl;
      for(int j=0;j<20;j++)
      {
        std::cout << sf[j] << "," ;
        if(j == (i/3))
          assert( sf[j] == 1);
        else
          assert( sf[j] == 0);
      }
      std::cout << std::endl;
      i++;
    }

  aHex->Delete();
  return 0;
}
//------------------------------------------------------

You can check that coordinate are from 0 to 1.

Thanks for your time,
Mathieu
(0000600)
Mathieu Malaterre   
2004-02-02 16:25   
John answer me this:
The first thing vtkQuadraticHexahedron::InterpolationDerivs() does is to
transform the VTK parametric coordinates to the iso-P coordinates -

  double r = 2.0*(pcoords[0]-0.5);
  double s = 2.0*(pcoords[1]-0.5);
  double t = 2.0*(pcoords[2]-0.5);

The computed gradients therefore represent the change in interpolation
function due to a change in iso-P coordinate, not VTK parametric
coordinate. If you want to update VTK parametric coordinates using these
gradients, you need to apply the inverse transformation.

If you like, the interpolation gradients wrt to VTK parametric
coordinates, p, are

    dN/dp = ( dN/dr )*( dr/dp ) = 2 dN/dr

where, r, are the iso-P coordinates and dN/dr are the gradients given by
InterpolationDerivs(). This is the required form of the Jacobian matrix
for the Newton correction in VTK parametric coordinates.

Rather than scale all the derivatives by 2, the determinant, d, will
increase by a factor of 8 but the determinant in the numerator only by a
factor of 4 since it contains only 2 columns of derivatives - hence the
0.5.

Similar transformations may be required elsewhere so it is probably
better to change InterpolationDerivs().

Back to your numerical trial...

1. Take an arbitrary hex20 and evaluate the world coordinates, X1, at
some internal point given by VTK parametric coordinates (p,q,r).
2. Chose a close point (p+dp,q,r) and evaluate the world coordinates,
X2.
3. Create a finite difference approximation to the gradients -
   dx/dp = (x2-x1)/dp, dy/dp = (y2-y1)/dp, dz/dp = (z2-z1)/dp
4. Compute the shape function derivatives at (p,q,r) and transform to
VTK parametric space by multiplying by 2.

In the limit as dp -> 0, the gradients should become identical.

I've a lot of explaining to do if this test doesn't work!!

(0000601)
Mathieu Malaterre   
2004-02-02 16:26   
I'll commit the changes tomorrow.
(0000682)
Mathieu Malaterre   
2004-02-20 15:14   
Ok, I have just commited the changes.