Attached Files | quadcelltests.diff [^] (13,743 bytes) 2007-08-10 10:35 [Show Content] [Hide Content]Index: Testing/Cxx/quadCellConsistency.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Filtering/Testing/Cxx/quadCellConsistency.cxx,v
retrieving revision 1.3
diff -u -r1.3 quadCellConsistency.cxx
--- Testing/Cxx/quadCellConsistency.cxx 8 May 2006 18:23:14 -0000 1.3
+++ Testing/Cxx/quadCellConsistency.cxx 10 Aug 2007 14:33:31 -0000
@@ -23,14 +23,20 @@
#include "vtkQuadraticTriangle.h"
#include "vtkQuad.h"
#include "vtkQuadraticQuad.h"
+#include "vtkBiQuadraticQuad.h"
+#include "vtkQuadraticLinearQuad.h"
#include "vtkTetra.h"
#include "vtkQuadraticTetra.h"
#include "vtkHexahedron.h"
#include "vtkQuadraticHexahedron.h"
+#include "vtkTriQuadraticHexahedron.h"
+#include "vtkBiQuadraticQuadraticHexahedron.h"
#include "vtkPyramid.h"
#include "vtkQuadraticPyramid.h"
#include "vtkWedge.h"
#include "vtkQuadraticWedge.h"
+#include "vtkBiQuadraticQuadraticWedge.h"
+#include "vtkQuadraticLinearWedge.h"
void InitializeCell(vtkCell *cell)
{
@@ -80,8 +86,10 @@
if( lFace->GetCellType() == VTK_TRIANGLE )
sum += (qFace->GetCellType() != VTK_QUADRATIC_TRIANGLE);
// Check that linear Quad match quad Quad
- if( lFace->GetCellType() == VTK_QUAD )
- sum += (qFace->GetCellType() != VTK_QUADRATIC_QUAD );
+ if( lFace->GetCellType() == VTK_QUAD &&
+ (qFace->GetCellType() != VTK_QUADRATIC_QUAD && qFace->GetCellType() != VTK_BIQUADRATIC_QUAD &&
+ qFace->GetCellType() != VTK_QUADRATIC_LINEAR_QUAD) )
+ sum++;
// Check that the points of the linear cell match the one from the quadratic one
for( int i=0; i<n; i++)
{
@@ -122,14 +130,24 @@
// Quad
vtkQuad *quad = vtkQuad::New();
vtkQuadraticQuad *qquad = vtkQuadraticQuad::New();
+ vtkBiQuadraticQuad *biqquad = vtkBiQuadraticQuad::New();
+ vtkQuadraticLinearQuad *qlquad = vtkQuadraticLinearQuad::New();
InitializeCell(quad);
InitializeCell(qquad);
+ InitializeCell(biqquad);
+ InitializeCell(qlquad);
ret += CompareCellEdges(quad, qquad);
ret += CompareCellFaces(quad, qquad);
+ ret += CompareCellEdges(quad, biqquad);
+ ret += CompareCellFaces(quad, biqquad);
+ ret += CompareCellEdges(quad, qlquad);
+ ret += CompareCellFaces(quad, qlquad);
quad->Delete();
qquad->Delete();
+ biqquad->Delete();
+ qlquad->Delete();
// Tetra
vtkTetra *tetra = vtkTetra::New();
@@ -146,14 +164,24 @@
// Hexhedron
vtkHexahedron *hex = vtkHexahedron::New();
vtkQuadraticHexahedron *qhex = vtkQuadraticHexahedron::New();
+ vtkTriQuadraticHexahedron *triqhex = vtkTriQuadraticHexahedron::New();
+ vtkBiQuadraticQuadraticHexahedron *biqqhex = vtkBiQuadraticQuadraticHexahedron::New();
InitializeCell(hex);
InitializeCell(qhex);
+ InitializeCell(triqhex);
+ InitializeCell(biqqhex);
ret += CompareCellEdges(hex, qhex);
ret += CompareCellFaces(hex, qhex);
+ ret += CompareCellEdges(hex, triqhex);
+ ret += CompareCellFaces(hex, triqhex);
+ ret += CompareCellEdges(hex, biqqhex);
+ ret += CompareCellFaces(hex, biqqhex);
hex->Delete();
qhex->Delete();
+ triqhex->Delete();
+ biqqhex->Delete();
// Pyramid
vtkPyramid *pyr= vtkPyramid::New();
@@ -170,14 +198,19 @@
// Wedge cells
vtkWedge *wedge = vtkWedge::New();
vtkQuadraticWedge *qwedge = vtkQuadraticWedge::New();
+ vtkBiQuadraticQuadraticWedge *biqwedge = vtkBiQuadraticQuadraticWedge::New();
InitializeCell(wedge);
InitializeCell(qwedge);
+ InitializeCell(biqwedge);
ret += CompareCellEdges(wedge, qwedge);
ret += CompareCellFaces(wedge, qwedge);
+ ret += CompareCellEdges(wedge, biqwedge);
+ ret += CompareCellFaces(wedge, biqwedge);
wedge->Delete();
qwedge->Delete();
+ biqwedge->Delete();
return ret;
}
Index: Testing/Cxx/quadraticEvaluation.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Filtering/Testing/Cxx/quadraticEvaluation.cxx,v
retrieving revision 1.3
diff -u -r1.3 quadraticEvaluation.cxx
--- Testing/Cxx/quadraticEvaluation.cxx 31 Jul 2006 22:34:02 -0000 1.3
+++ Testing/Cxx/quadraticEvaluation.cxx 10 Aug 2007 14:33:31 -0000
@@ -29,6 +29,16 @@
#include "vtkQuadraticPyramid.h"
#include "vtkPoints.h"
+// New quadratic cells
+#include "vtkBiQuadraticQuad.h"
+#include "vtkQuadraticLinearQuad.h"
+#include "vtkQuadraticLinearWedge.h"
+#include "vtkBiQuadraticQuadraticWedge.h"
+#include "vtkTriQuadraticHexahedron.h"
+#include "vtkBiQuadraticQuadraticHexahedron.h"
+
+static void ComputeDataValues(vtkPoints *pts, double *edgeValues);
+
void ComputeDataValues(vtkPoints *pts, double *edgeValues)
{
double x[3];
@@ -53,6 +63,8 @@
// actual test
double dist2;
int subId;
+ int i;
+ double *paramcoor;
//-----------------------------------------------------------
strm << "Test instantiation New() and NewInstance() Start" << endl;
@@ -76,13 +88,43 @@
vtkQuadraticPyramid *pyra = vtkQuadraticPyramid::New();
vtkQuadraticHexahedron *pyra2 = hex->NewInstance();
+
+ // New quadratic cells
+
+ vtkQuadraticLinearQuad *quadlin = vtkQuadraticLinearQuad::New();
+ vtkQuadraticLinearQuad *quadlin2 = quadlin->NewInstance();
+
+ vtkBiQuadraticQuad *biquad = vtkBiQuadraticQuad::New();
+ vtkBiQuadraticQuad *biquad2 = biquad->NewInstance();
+
+ vtkQuadraticLinearWedge *wedgelin = vtkQuadraticLinearWedge::New();
+ vtkQuadraticLinearWedge *wedgelin2 = wedgelin->NewInstance();
+
+ vtkBiQuadraticQuadraticWedge *biwedge = vtkBiQuadraticQuadraticWedge::New();
+ vtkBiQuadraticQuadraticWedge *biwedge2 = biwedge->NewInstance();
+
+
+ vtkTriQuadraticHexahedron *trihex = vtkTriQuadraticHexahedron::New();
+ vtkTriQuadraticHexahedron *trihex2 = trihex->NewInstance();
+
+
+ vtkBiQuadraticQuadraticHexahedron *bihex = vtkBiQuadraticQuadraticHexahedron::New();
+ vtkBiQuadraticQuadraticHexahedron *bihex2 = bihex->NewInstance();
+
+
edge2->Delete();
tri2->Delete();
quad2->Delete();
+ quadlin2->Delete();
+ biquad2->Delete();
tetra2->Delete();
hex2->Delete();
+ trihex2->Delete();
+ bihex2->Delete();
wedge2->Delete();
+ wedgelin2->Delete();
+ biwedge2->Delete();
pyra2->Delete();
strm << "Test instantiation New() and NewInstance() End" << endl;
@@ -313,6 +355,99 @@
pyra->EvaluatePosition(pyraPoint[0], pyraClosest, subId, pyraPCoords,
dist2, pyraWeights);
+ // New quadratic cells
+
+ // vtkQuadraticLinearQuad
+ double quadlinPCoords[3], quadlinWeights[6], quadlinPosition[3];
+ double quadlinPoint[1][3] = {{0.25, 0.33, 0.0}};
+ double quadlinClosest[3];
+ paramcoor = quadlin->GetParametricCoords();
+
+ for(i = 0; i < quadlin->GetNumberOfPoints(); i++)
+ quadlin->GetPointIds()->SetId(i,i);
+
+ for(i = 0; i < quadlin->GetNumberOfPoints(); i++)
+ quadlin->GetPoints()->SetPoint(i, paramcoor[i*3], paramcoor[i*3 + 1], paramcoor[i*3 + 2]);
+
+ quadlin->EvaluatePosition(quadlinPoint[0], quadlinClosest, subId, quadlinPCoords,
+ dist2, quadlinWeights);
+
+ // vtkBiQuadraticQuad
+ double biquadPCoords[3], biquadWeights[6], biquadPosition[3];
+ double biquadPoint[1][3] = {{0.25, 0.33, 0.0}};
+ double biquadClosest[3];
+ paramcoor = biquad->GetParametricCoords();
+
+ for(i = 0; i < biquad->GetNumberOfPoints(); i++)
+ biquad->GetPointIds()->SetId(i,i);
+
+ for(i = 0; i < biquad->GetNumberOfPoints(); i++)
+ biquad->GetPoints()->SetPoint(i, paramcoor[i*3], paramcoor[i*3 + 1], paramcoor[i*3 + 2]);
+
+ biquad->EvaluatePosition(biquadPoint[0], biquadClosest, subId, biquadPCoords,
+ dist2, biquadWeights);
+
+ // vtkQuadraticLinearWedge
+ double wedgelinPCoords[3], wedgelinWeights[12], wedgelinPosition[3];
+ double wedgelinPoint[1][3] = {{0.25, 0.33333, 0.666667}};
+ double wedgelinClosest[3];
+ paramcoor = wedgelin->GetParametricCoords();
+
+ for(i = 0; i < wedgelin->GetNumberOfPoints(); i++)
+ wedgelin->GetPointIds()->SetId(i,i);
+
+ for(i = 0; i < wedgelin->GetNumberOfPoints(); i++)
+ wedgelin->GetPoints()->SetPoint(i, paramcoor[i*3], paramcoor[i*3 + 1], paramcoor[i*3 + 2]);
+
+ wedgelin->EvaluatePosition(wedgelinPoint[0], wedgelinClosest, subId, wedgelinPCoords,
+ dist2, wedgelinWeights);
+
+ // vtkBiQuadraticQuadraticWedge
+ double biwedgePCoords[3], biwedgeWeights[18], biwedgePosition[3];
+ double biwedgePoint[1][3] = {{0.25, 0.33333, 0.666667}};
+ double biwedgeClosest[3];
+ paramcoor = biwedge->GetParametricCoords();
+
+ for(i = 0; i < biwedge->GetNumberOfPoints(); i++)
+ biwedge->GetPointIds()->SetId(i,i);
+
+ for(i = 0; i < biwedge->GetNumberOfPoints(); i++)
+ biwedge->GetPoints()->SetPoint(i, paramcoor[i*3], paramcoor[i*3 + 1], paramcoor[i*3 + 2]);
+
+ biwedge->EvaluatePosition(biwedgePoint[0], biwedgeClosest, subId, biwedgePCoords,
+ dist2, biwedgeWeights);
+
+ // vtkBiQuadraticQuadraticHexahedron
+ double bihexPCoords[3], bihexWeights[24], bihexPosition[3];
+ double bihexPoint[1][3] = {{0.25, 0.33333, 0.666667}};
+ double bihexClosest[3];
+ paramcoor = bihex->GetParametricCoords();
+
+ for(i = 0; i < bihex->GetNumberOfPoints(); i++)
+ bihex->GetPointIds()->SetId(i,i);
+
+ for(i = 0; i < bihex->GetNumberOfPoints(); i++)
+ bihex->GetPoints()->SetPoint(i, paramcoor[i*3], paramcoor[i*3 + 1], paramcoor[i*3 + 2]);
+
+ bihex->EvaluatePosition(bihexPoint[0], bihexClosest, subId, bihexPCoords,
+ dist2, bihexWeights);
+
+ // vtkTriQuadraticHexahedron
+ double trihexPCoords[3], trihexWeights[27], trihexPosition[3];
+ double trihexPoint[1][3] = {{0.25, 0.33333, 0.666667}};
+ double trihexClosest[3];
+ paramcoor = trihex->GetParametricCoords();
+
+ for(i = 0; i < trihex->GetNumberOfPoints(); i++)
+ trihex->GetPointIds()->SetId(i,i);
+
+ for(i = 0; i < trihex->GetNumberOfPoints(); i++)
+ trihex->GetPoints()->SetPoint(i, paramcoor[i*3], paramcoor[i*3 + 1], paramcoor[i*3 + 2]);
+
+ trihex->EvaluatePosition(trihexPoint[0], trihexClosest, subId, trihexPCoords,
+ dist2, trihexWeights);
+
+
strm << "Test vtkCell::EvaluatePosition End" << endl;
//-------------------------------------------------------------
@@ -330,9 +465,6 @@
tetra->EvaluateLocation(subId, tetraPCoords, tetraPosition, tetraWeights);
// vtkQuadraticHexahedron
- hexPCoords[0] = 0.25;
- hexPCoords[1] = 0.33;
- hexPCoords[2] = 0.75;
hex->EvaluateLocation(subId, hexPCoords, hexPosition, hexWeights);
// vtkQuadraticWedge
@@ -341,15 +473,36 @@
// vtkQuadraticPyramid
pyra->EvaluateLocation(subId, pyraPCoords, pyraPosition, pyraWeights);
+ // New quadratic cells
+
+ // vtkQuadraticLinearQuad
+ quadlin->EvaluateLocation(subId, quadlinPCoords, quadlinPosition, quadlinWeights);
+
+ // vtkBiQuadraticQuad
+ biquad->EvaluateLocation(subId, biquadPCoords, biquadPosition, biquadWeights);
+
+
+ // vtkQuadraticLinearWedge
+ wedgelin->EvaluateLocation(subId, wedgelinPCoords, wedgelinPosition, wedgelinWeights);
+
+ // vtkBiQuadraticQuadraticWedge
+ biwedge->EvaluateLocation(subId, biwedgePCoords, biwedgePosition, biwedgeWeights);
+
+ // vtkQuadraticLinearQuad
+ bihex->EvaluateLocation(subId, bihexPCoords, bihexPosition, bihexWeights);
+
+ // vtkBiQuadraticQuad
+ trihex->EvaluateLocation(subId, trihexPCoords, trihexPosition, trihexWeights);
+
strm << "Test vtkCell::EvaluateLocation End" << endl;
//-------------------------------------------------------------
strm << "Test vtkCell::CellDerivs Start" << endl;
// vtkQuadraticEdge - temporarily commented out
-// double edgeValues[3], edgeDerivs[3];
-// ComputeDataValues(edge->Points,edgeValues);
-// edge->Derivatives(subId, edgePCoords, edgeValues, 1, edgeDerivs);
+ //double edgeValues[3], edgeDerivs[3];
+ //ComputeDataValues(edge->Points,edgeValues);
+ //edge->Derivatives(subId, edgePCoords, edgeValues, 1, edgeDerivs);
// vtkQuadraticTriangle
double triValues[6], triDerivs[3];
@@ -381,6 +534,39 @@
ComputeDataValues(pyra->Points,pyraValues);
pyra->Derivatives(subId, pyraPCoords, pyraValues, 1, pyraDerivs);
+ // New quadratic cells
+
+ // vtkQuadraticLinearQuad
+ double quadlinValues[6], quadlinDerivs[3];
+ ComputeDataValues(quadlin->Points,quadlinValues);
+ quadlin->Derivatives(subId, quadlinPCoords, quadlinValues, 1, quadlinDerivs);
+
+ // vtkBiQuadraticQuad
+ double biquadValues[9], biquadDerivs[3];
+ ComputeDataValues(biquad->Points,biquadValues);
+ biquad->Derivatives(subId, biquadPCoords, biquadValues, 1, biquadDerivs);
+
+ // vtkQuadraticLinearWedge
+ double wedgelinValues[12], wedgelinDerivs[3];
+ ComputeDataValues(wedgelin->Points, wedgelinValues);
+ wedgelin->Derivatives(subId, wedgelinPCoords, wedgelinValues, 1, wedgelinDerivs);
+
+ // vtkBiQuadraticQuadraticWedge
+ double biwedgeValues[18], biwedgeDerivs[3];
+ ComputeDataValues(biwedge->Points, biwedgeValues);
+ biwedge->Derivatives(subId, biwedgePCoords, biwedgeValues, 1, biwedgeDerivs);
+
+ // vtkBiQuadraticQuadraticHexahedron
+ double bihexValues[24], bihexDerivs[3];
+ ComputeDataValues(bihex->Points, bihexValues);
+ bihex->Derivatives(subId, bihexPCoords, bihexValues, 1, bihexDerivs);
+
+ // vtkTriQuadraticHexahedron
+ double trihexValues[27], trihexDerivs[3];
+ ComputeDataValues(trihex->Points, trihexValues);
+ trihex->Derivatives(subId, trihexPCoords, trihexValues, 1, trihexDerivs);
+
+
strm << "Test vtkCell::CellDerivs End" << endl;
edge->Delete();
@@ -388,8 +574,14 @@
quad->Delete();
tetra->Delete();
hex->Delete();
+ bihex->Delete();
+ trihex->Delete();
wedge->Delete();
+ wedgelin->Delete();
+ biwedge->Delete();
pyra->Delete();
+ quadlin->Delete();
+ biquad->Delete();
return 0;
}
|