void
avtHexahedron20Extractor::Extract(const avtHexahedron20 &hex)
{
    // Get the overall number of samples we expect from this hex
    int potentialNumSamples = ConstructBounds(hex.pts, 8);
  
    // If the number is too small we want to treat this hex as a special
    // "small" cell
    if (potentialNumSamples <= 0)
    {
        ContributeSmallCell(hex.pts, hex.val, 8);
        return;
    }
  
    // If the number is too large we want to send off this cell to
    // somewhere else
    /*
    // This is code that needs to be added somewhere else for the hex20 case 
    if (sendCellsMode && potentialNumSamples > 64)
      {
        celllist->Store(hex, minx, maxx, miny, maxy);
        return;
      }
    */

    // Store a pointer to our currrent hex (used in the StoreRay function)
    currentHex = &hex;
  
    switch (domainApproximation) 
    {
      case avtHex20Constant:
        ConstantHexExtract(hex);
        break;
      case avtHex20Linear:
        LinearHexExtract(hex);
        break;
      case avtHex20Quadratic:
        QuadraticHexExtract(hex);
        break;
    }
}
void
avtPyramidExtractor::Extract(const avtPyramid &pyr)
{
    int potentialNumSamples = ConstructBounds(pyr.pts, 5);

    if (potentialNumSamples <= 0)
    {
        ContributeSmallCell(pyr.pts, pyr.val, 5);
        return;
    }

    if (sendCellsMode && potentialNumSamples > 64)
    {
        celllist->Store(pyr, minx, maxx, miny, maxy);
        return;
    }

    //
    // minx and maxx are calculated in ConstructBounds.
    //
    int minx_iter = (minx < restrictedMinWidth ? restrictedMinWidth : minx);
    int maxx_iter = (maxx > restrictedMaxWidth ? restrictedMaxWidth : maxx);
    for (int xi = minx_iter ; xi <= maxx_iter ; xi++)
    {
        double x = XFromIndex(xi);

        int   triIndex = IndexToTriangulationTable(pyr.pts, 5, x);

        //
        // The triCase will have sets of three vertices, each of which makes
        // up a triangle that is part of the intersection of this cell with
        // the plane.  Take each triangle and find the sample points from it.
        //
        int  *triCase  = triangulationTables[triIndex];
        while (*triCase != -1)
        {
            //
            // Find the triangle for this tri case by seeing which edge the
            // triangle intersects and then interpolating along that edge
            // three times to form the triangle.
            //
            double y[3], z[3], v[3][AVT_VARIABLE_LIMIT];
            for (int tri_vertex = 0 ; tri_vertex < 3 ; tri_vertex++)
            {
                int pyr_vertex1 = verticesFromEdges[triCase[tri_vertex]][0];
                int pyr_vertex2 = verticesFromEdges[triCase[tri_vertex]][1];

                InterpolateToPlane(pyr.pts[pyr_vertex1], pyr.pts[pyr_vertex2],
                                   pyr.val[pyr_vertex1], pyr.val[pyr_vertex2],
                                   x, y[tri_vertex], z[tri_vertex],
                                   v[tri_vertex], pyr.nVars);
            }

            //
            // Call the base class method for extracting sample points from a
            // triangle.
            //
            ExtractTriangle(xi, y, z, v, pyr.nVars);

            triCase += 3;
        }
    }
}