1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    quadraticEvaluation.cxx
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 // .NAME
16 // .SECTION Description
17 // This program tests quadratic cell EvaluatePosition() and EvaluateLocation()
18 // methods.
19 
20 #include "vtkDebugLeaks.h"
21 
22 #include "vtkIdList.h"
23 #include "vtkQuadraticEdge.h"
24 #include "vtkQuadraticTriangle.h"
25 #include "vtkQuadraticQuad.h"
26 #include "vtkQuadraticHexahedron.h"
27 #include "vtkQuadraticTetra.h"
28 #include "vtkQuadraticWedge.h"
29 #include "vtkQuadraticPyramid.h"
30 #include "vtkPoints.h"
31 
32 #include <vtksys/ios/sstream>
33 
34 // New quadratic cells
35 #include "vtkBiQuadraticQuad.h"
36 #include "vtkQuadraticLinearQuad.h"
37 #include "vtkQuadraticLinearWedge.h"
38 #include "vtkBiQuadraticQuadraticWedge.h"
39 #include "vtkTriQuadraticHexahedron.h"
40 #include "vtkBiQuadraticQuadraticHexahedron.h"
41 #include "vtkBiQuadraticTriangle.h"
42 #include "vtkCubicLine.h"
43 
44 static void  ComputeDataValues(vtkPoints *pts, double *edgeValues);
45 
ComputeDataValues(vtkPoints * pts,double * edgeValues)46 void  ComputeDataValues(vtkPoints *pts, double *edgeValues)
47 {
48   double x[3];
49   int numPts = pts->GetNumberOfPoints();
50   for (int i=0; i<numPts; i++)
51     {
52     pts->GetPoint(i,x);
53     double dem = (1.0 + x[0]);
54     if(fabs(dem) < 1.e-08)
55       {
56       edgeValues[i] = 0;
57       }
58     else
59       {
60       edgeValues[i] = 1.0 / dem; //simple linear function for now
61       }
62     }
63 }
64 
TestQE(ostream & strm)65 int TestQE(ostream& strm)
66 {
67   // actual test
68   double dist2;
69   int subId;
70   int i;
71   double *paramcoor;
72 
73   //-----------------------------------------------------------
74   strm << "Test instantiation New() and NewInstance() Start" << endl;
75   vtkQuadraticEdge *edge = vtkQuadraticEdge::New();
76   vtkQuadraticEdge *edge2 = edge->NewInstance();
77 
78   vtkQuadraticTriangle *tri = vtkQuadraticTriangle::New();
79   vtkQuadraticTriangle *tri2 = tri->NewInstance();
80 
81   vtkQuadraticQuad *quad = vtkQuadraticQuad::New();
82   vtkQuadraticQuad *quad2 = quad->NewInstance();
83 
84   vtkQuadraticTetra *tetra = vtkQuadraticTetra::New();
85   vtkQuadraticTetra *tetra2 = tetra->NewInstance();
86 
87   vtkQuadraticHexahedron *hex = vtkQuadraticHexahedron::New();
88   vtkQuadraticHexahedron *hex2 = hex->NewInstance();
89 
90   vtkQuadraticWedge *wedge = vtkQuadraticWedge::New();
91   vtkQuadraticWedge *wedge2 = wedge->NewInstance();
92 
93   vtkQuadraticPyramid *pyra = vtkQuadraticPyramid::New();
94   vtkQuadraticHexahedron *pyra2 = hex->NewInstance();
95 
96   // New quadratic cells
97 
98   vtkQuadraticLinearQuad *quadlin = vtkQuadraticLinearQuad::New();
99   vtkQuadraticLinearQuad *quadlin2 = quadlin->NewInstance();
100 
101   vtkBiQuadraticQuad *biquad = vtkBiQuadraticQuad::New();
102   vtkBiQuadraticQuad *biquad2 = biquad->NewInstance();
103 
104   vtkQuadraticLinearWedge *wedgelin = vtkQuadraticLinearWedge::New();
105   vtkQuadraticLinearWedge *wedgelin2 = wedgelin->NewInstance();
106 
107   vtkBiQuadraticQuadraticWedge *biwedge = vtkBiQuadraticQuadraticWedge::New();
108   vtkBiQuadraticQuadraticWedge *biwedge2 = biwedge->NewInstance();
109 
110 
111   vtkTriQuadraticHexahedron *trihex = vtkTriQuadraticHexahedron::New();
112   vtkTriQuadraticHexahedron *trihex2 = trihex->NewInstance();
113 
114 
115   vtkBiQuadraticQuadraticHexahedron *bihex = vtkBiQuadraticQuadraticHexahedron::New();
116   vtkBiQuadraticQuadraticHexahedron *bihex2 = bihex->NewInstance();
117 
118   vtkBiQuadraticTriangle *bitri = vtkBiQuadraticTriangle::New();
119   vtkBiQuadraticTriangle *bitri2 = bitri->NewInstance();
120 
121   vtkCubicLine *culine = vtkCubicLine::New();
122   vtkCubicLine *culine2 = culine->NewInstance();
123 
124 
125   edge2->Delete();
126   tri2->Delete();
127   quad2->Delete();
128   quadlin2->Delete();
129   biquad2->Delete();
130   tetra2->Delete();
131   hex2->Delete();
132   trihex2->Delete();
133   bihex2->Delete();
134   wedge2->Delete();
135   wedgelin2->Delete();
136   biwedge2->Delete();
137   pyra2->Delete();
138   bitri2->Delete();
139   culine2->Delete();
140 
141   strm << "Test instantiation New() and NewInstance() End" << endl;
142 
143 
144   //-------------------------------------------------------------
145   strm << "Test vtkCell::EvaluatePosition Start" << endl;
146 
147   // vtkQuadraticEdge
148   double edgePCoords[3], edgeWeights[3], edgePosition[3];
149   double edgePoint[1][3] = {{0.25, 0.125, 0.0}};
150   double edgeClosest[3];
151 
152   edge->GetPointIds()->SetId(0,0);
153   edge->GetPointIds()->SetId(1,1);
154   edge->GetPointIds()->SetId(2,2);
155 
156   edge->GetPoints()->SetPoint(0, 0, 0, 0);
157   edge->GetPoints()->SetPoint(1, 1, 0, .5);
158   edge->GetPoints()->SetPoint(2, 0.5, 0.25, .2);
159 
160   edge->EvaluatePosition(edgePoint[0], edgeClosest, subId, edgePCoords,
161                          dist2, edgeWeights);
162 
163   // vtkQuadraticTriangle
164   double triPCoords[3], triWeights[6], triPosition[3];
165   double triPoint[1][3] = {{0.5, 0.266667, 0.0}};
166   double triClosest[3];
167 
168   tri->GetPointIds()->SetId(0,0);
169   tri->GetPointIds()->SetId(1,1);
170   tri->GetPointIds()->SetId(2,2);
171   tri->GetPointIds()->SetId(3,3);
172   tri->GetPointIds()->SetId(4,4);
173   tri->GetPointIds()->SetId(5,5);
174 
175   tri->GetPoints()->SetPoint(0, 0, 0, 0);
176   tri->GetPoints()->SetPoint(1, 1, 0, 0);
177   tri->GetPoints()->SetPoint(2, 0.5, 0.8, 0);
178   tri->GetPoints()->SetPoint(3, 0.5, 0.0, 0);
179   tri->GetPoints()->SetPoint(4, 0.75, 0.4, 0);
180   tri->GetPoints()->SetPoint(5, 0.25, 0.4, 0);
181 
182   tri->EvaluatePosition(triPoint[0], triClosest, subId, triPCoords,
183                         dist2, triWeights);
184 
185 
186   // vtkQuadraticQuad
187   double quadPCoords[3], quadWeights[8], quadPosition[3];
188   double quadPoint[1][3] = {{0.25, 0.33, 0.0}};
189   double quadClosest[3];
190 
191   quad->GetPointIds()->SetId(0,0);
192   quad->GetPointIds()->SetId(1,1);
193   quad->GetPointIds()->SetId(2,2);
194   quad->GetPointIds()->SetId(3,3);
195   quad->GetPointIds()->SetId(4,4);
196   quad->GetPointIds()->SetId(5,5);
197   quad->GetPointIds()->SetId(6,6);
198   quad->GetPointIds()->SetId(7,7);
199 
200   quad->GetPoints()->SetPoint(0, 0.0, 0.0, 0.0);
201   quad->GetPoints()->SetPoint(1, 1.0, 0.0, 0.0);
202   quad->GetPoints()->SetPoint(2, 1.0, 1.0, 0.0);
203   quad->GetPoints()->SetPoint(3, 0.0, 1.0, 0.0);
204   quad->GetPoints()->SetPoint(4, 0.5, 0.0, 0.0);
205   quad->GetPoints()->SetPoint(5, 1.0, 0.5, 0.0);
206   quad->GetPoints()->SetPoint(6, 0.5, 1.0, 0.0);
207   quad->GetPoints()->SetPoint(7, 0.0, 0.5, 0.0);
208 
209   quad->EvaluatePosition(quadPoint[0], quadClosest, subId, quadPCoords,
210                          dist2, quadWeights);
211 
212   // vtkQuadraticTetra
213   double tetraPCoords[3], tetraWeights[10], tetraPosition[3];
214   double tetraPoint[1][3] = {{0.5, 0.266667, 0.333333}};
215   double tetraClosest[3];
216 
217   tetra->GetPointIds()->SetId(0,0);
218   tetra->GetPointIds()->SetId(1,1);
219   tetra->GetPointIds()->SetId(2,2);
220   tetra->GetPointIds()->SetId(3,3);
221   tetra->GetPointIds()->SetId(4,4);
222   tetra->GetPointIds()->SetId(5,5);
223   tetra->GetPointIds()->SetId(6,6);
224   tetra->GetPointIds()->SetId(7,7);
225   tetra->GetPointIds()->SetId(8,8);
226   tetra->GetPointIds()->SetId(9,9);
227 
228   tetra->GetPoints()->SetPoint(0, 0.0, 0.0, 0.0);
229   tetra->GetPoints()->SetPoint(1, 1.0, 0.0, 0.0);
230   tetra->GetPoints()->SetPoint(2, 0.5, 0.8, 0.0);
231   tetra->GetPoints()->SetPoint(3, 0.5, 0.4, 1.0);
232   tetra->GetPoints()->SetPoint(4, 0.5, 0.0,  0.0);
233   tetra->GetPoints()->SetPoint(5, 0.75, 0.4, 0.0);
234   tetra->GetPoints()->SetPoint(6, 0.25, 0.4, 0.0);
235   tetra->GetPoints()->SetPoint(7, 0.25, 0.2, 0.5);
236   tetra->GetPoints()->SetPoint(8, 0.75, 0.2, 0.5);
237   tetra->GetPoints()->SetPoint(9, 0.50, 0.6, 0.5);
238 
239   tetra->EvaluatePosition(tetraPoint[0], tetraClosest, subId, tetraPCoords,
240                          dist2, tetraWeights);
241 
242 
243   // vtkQuadraticHexahedron
244   double hexPCoords[3], hexWeights[20], hexPosition[3];
245   double hexPoint[1][3] = {{0.25, 0.33333, 0.666667}};
246   double hexClosest[3];
247 
248   hex->GetPointIds()->SetId(0,0);
249   hex->GetPointIds()->SetId(1,1);
250   hex->GetPointIds()->SetId(2,2);
251   hex->GetPointIds()->SetId(3,3);
252   hex->GetPointIds()->SetId(4,4);
253   hex->GetPointIds()->SetId(5,5);
254   hex->GetPointIds()->SetId(6,6);
255   hex->GetPointIds()->SetId(7,7);
256   hex->GetPointIds()->SetId(8,8);
257   hex->GetPointIds()->SetId(9,9);
258   hex->GetPointIds()->SetId(10,10);
259   hex->GetPointIds()->SetId(11,11);
260   hex->GetPointIds()->SetId(12,12);
261   hex->GetPointIds()->SetId(13,13);
262   hex->GetPointIds()->SetId(14,14);
263   hex->GetPointIds()->SetId(15,15);
264   hex->GetPointIds()->SetId(16,16);
265   hex->GetPointIds()->SetId(17,17);
266   hex->GetPointIds()->SetId(18,18);
267   hex->GetPointIds()->SetId(19,19);
268 
269   hex->GetPoints()->SetPoint( 0, 0, 0, 0  );
270   hex->GetPoints()->SetPoint( 1, 1, 0, 0  );
271   hex->GetPoints()->SetPoint( 2, 1, 1, 0  );
272   hex->GetPoints()->SetPoint( 3, 0, 1, 0  );
273   hex->GetPoints()->SetPoint( 4, 0, 0, 1  );
274   hex->GetPoints()->SetPoint( 5, 1, 0, 1  );
275   hex->GetPoints()->SetPoint( 6, 1, 1, 1  );
276   hex->GetPoints()->SetPoint( 7, 0, 1, 1  );
277   hex->GetPoints()->SetPoint( 8, 0.5, 0, 0);
278   hex->GetPoints()->SetPoint( 9, 1, 0.5, 0);
279   hex->GetPoints()->SetPoint(10, 0.5, 1, 0);
280   hex->GetPoints()->SetPoint(11, 0, 0.5, 0);
281   hex->GetPoints()->SetPoint(12, 0.5, 0, 1);
282   hex->GetPoints()->SetPoint(13, 1, 0.5, 1);
283   hex->GetPoints()->SetPoint(14, 0.5, 1, 1);
284   hex->GetPoints()->SetPoint(15, 0, 0.5, 1);
285   hex->GetPoints()->SetPoint(16, 0, 0, 0.5);
286   hex->GetPoints()->SetPoint(17, 1, 0, 0.5);
287   hex->GetPoints()->SetPoint(18, 1, 1, 0.5);
288   hex->GetPoints()->SetPoint(19, 0, 1, 0.5);
289 
290   hex->EvaluatePosition(hexPoint[0], hexClosest, subId, hexPCoords,
291                          dist2, hexWeights);
292 
293   // vtkQuadraticWedge
294   double wedgePCoords[3], wedgeWeights[20], wedgePosition[3];
295   double wedgePoint[1][3] = {{0.25, 0.33333, 0.666667}};
296   double wedgeClosest[3];
297 
298   wedge->GetPointIds()->SetId(0,0);
299   wedge->GetPointIds()->SetId(1,1);
300   wedge->GetPointIds()->SetId(2,2);
301   wedge->GetPointIds()->SetId(3,3);
302   wedge->GetPointIds()->SetId(4,4);
303   wedge->GetPointIds()->SetId(5,5);
304   wedge->GetPointIds()->SetId(6,6);
305   wedge->GetPointIds()->SetId(7,7);
306   wedge->GetPointIds()->SetId(8,8);
307   wedge->GetPointIds()->SetId(9,9);
308   wedge->GetPointIds()->SetId(10,10);
309   wedge->GetPointIds()->SetId(11,11);
310   wedge->GetPointIds()->SetId(12,12);
311   wedge->GetPointIds()->SetId(13,13);
312   wedge->GetPointIds()->SetId(14,14);
313 
314   wedge->GetPoints()->SetPoint( 0, 0, 0, 0  );
315   wedge->GetPoints()->SetPoint( 1, 1, 0, 0  );
316   wedge->GetPoints()->SetPoint( 2, 0, 1, 0  );
317   wedge->GetPoints()->SetPoint( 3, 0, 0, 1  );
318   wedge->GetPoints()->SetPoint( 4, 1, 0, 1  );
319   wedge->GetPoints()->SetPoint( 5, 0, 1, 1  );
320   wedge->GetPoints()->SetPoint( 6, 0.5, 0, 0  );
321   wedge->GetPoints()->SetPoint( 7, 0.5, 0.5, 0  );
322   wedge->GetPoints()->SetPoint( 8, 0, 0.5, 0);
323   wedge->GetPoints()->SetPoint( 9, 0.5, 0, 1);
324   wedge->GetPoints()->SetPoint(10, 0.5, 0.5, 1);
325   wedge->GetPoints()->SetPoint(11, 0, 0.5, 1);
326   wedge->GetPoints()->SetPoint(12, 0, 0, 0.5);
327   wedge->GetPoints()->SetPoint(13, 1, 0, 0.5);
328   wedge->GetPoints()->SetPoint(14, 0, 1, 0.5);
329 
330   wedge->EvaluatePosition(wedgePoint[0], wedgeClosest, subId, wedgePCoords,
331                          dist2, wedgeWeights);
332 
333   // vtkQuadraticPyramid
334   double pyraPCoords[3], pyraWeights[20], pyraPosition[3];
335   double pyraPoint[1][3] = {{0.25, 0.33333, 0.666667}};
336   double pyraClosest[3];
337 
338   pyra->GetPointIds()->SetId(0,0);
339   pyra->GetPointIds()->SetId(1,1);
340   pyra->GetPointIds()->SetId(2,2);
341   pyra->GetPointIds()->SetId(3,3);
342   pyra->GetPointIds()->SetId(4,4);
343   pyra->GetPointIds()->SetId(5,5);
344   pyra->GetPointIds()->SetId(6,6);
345   pyra->GetPointIds()->SetId(7,7);
346   pyra->GetPointIds()->SetId(8,8);
347   pyra->GetPointIds()->SetId(9,9);
348   pyra->GetPointIds()->SetId(10,10);
349   pyra->GetPointIds()->SetId(11,11);
350   pyra->GetPointIds()->SetId(12,12);
351 
352   pyra->GetPoints()->SetPoint( 0, 0, 0, 0  );
353   pyra->GetPoints()->SetPoint( 1, 1, 0, 0  );
354   pyra->GetPoints()->SetPoint( 2, 1, 1, 0  );
355   pyra->GetPoints()->SetPoint( 3, 0, 1, 0  );
356   pyra->GetPoints()->SetPoint( 4, 0, 0, 1  );
357   pyra->GetPoints()->SetPoint( 5, 0.5, 0, 0  );
358   pyra->GetPoints()->SetPoint( 6, 1, 0.5, 0  );
359   pyra->GetPoints()->SetPoint( 7, 0.5, 1, 0  );
360   pyra->GetPoints()->SetPoint( 8, 0, 0.5, 0  );
361   pyra->GetPoints()->SetPoint( 9, 0, 0, 0.5  );
362   pyra->GetPoints()->SetPoint(10, 0.5, 0, 0.5  );
363   pyra->GetPoints()->SetPoint(11, 0.5, 0.5, 0.5  );
364   pyra->GetPoints()->SetPoint(12, 0, 0.5, 0.5  );
365 
366   pyra->EvaluatePosition(pyraPoint[0], pyraClosest, subId, pyraPCoords,
367                          dist2, pyraWeights);
368 
369   // New quadratic cells
370 
371   // vtkQuadraticLinearQuad
372   double quadlinPCoords[3], quadlinWeights[6], quadlinPosition[3];
373   double quadlinPoint[1][3] = {{0.25, 0.33, 0.0}};
374   double quadlinClosest[3];
375   paramcoor = quadlin->GetParametricCoords();
376 
377   for(i = 0; i < quadlin->GetNumberOfPoints(); i++)
378     quadlin->GetPointIds()->SetId(i,i);
379 
380   for(i = 0; i < quadlin->GetNumberOfPoints(); i++)
381     quadlin->GetPoints()->SetPoint(i, paramcoor[i*3], paramcoor[i*3 + 1], paramcoor[i*3 + 2]);
382 
383   quadlin->EvaluatePosition(quadlinPoint[0], quadlinClosest, subId, quadlinPCoords,
384                          dist2, quadlinWeights);
385 
386   // vtkBiQuadraticQuad
387   double biquadPCoords[3], biquadWeights[9], biquadPosition[3];
388   double biquadPoint[1][3] = {{0.25, 0.33, 0.0}};
389   double biquadClosest[3];
390   paramcoor = biquad->GetParametricCoords();
391 
392   for(i = 0; i < biquad->GetNumberOfPoints(); i++)
393     biquad->GetPointIds()->SetId(i,i);
394 
395   for(i = 0; i < biquad->GetNumberOfPoints(); i++)
396     biquad->GetPoints()->SetPoint(i, paramcoor[i*3], paramcoor[i*3 + 1], paramcoor[i*3 + 2]);
397 
398   biquad->EvaluatePosition(biquadPoint[0], biquadClosest, subId, biquadPCoords,
399                          dist2, biquadWeights);
400 
401   // vtkQuadraticLinearWedge
402   double wedgelinPCoords[3], wedgelinWeights[12], wedgelinPosition[3];
403   double wedgelinPoint[1][3] = {{0.25, 0.33333, 0.666667}};
404   double wedgelinClosest[3];
405   paramcoor = wedgelin->GetParametricCoords();
406 
407   for(i = 0; i < wedgelin->GetNumberOfPoints(); i++)
408     wedgelin->GetPointIds()->SetId(i,i);
409 
410   for(i = 0; i < wedgelin->GetNumberOfPoints(); i++)
411     wedgelin->GetPoints()->SetPoint(i, paramcoor[i*3], paramcoor[i*3 + 1], paramcoor[i*3 + 2]);
412 
413   wedgelin->EvaluatePosition(wedgelinPoint[0], wedgelinClosest, subId, wedgelinPCoords,
414                          dist2, wedgelinWeights);
415 
416   // vtkBiQuadraticQuadraticWedge
417   double biwedgePCoords[3], biwedgeWeights[18], biwedgePosition[3];
418   double biwedgePoint[1][3] = {{0.25, 0.33333, 0.666667}};
419   double biwedgeClosest[3];
420   paramcoor = biwedge->GetParametricCoords();
421 
422   for(i = 0; i < biwedge->GetNumberOfPoints(); i++)
423     biwedge->GetPointIds()->SetId(i,i);
424 
425   for(i = 0; i < biwedge->GetNumberOfPoints(); i++)
426     biwedge->GetPoints()->SetPoint(i, paramcoor[i*3], paramcoor[i*3 + 1], paramcoor[i*3 + 2]);
427 
428   biwedge->EvaluatePosition(biwedgePoint[0], biwedgeClosest, subId, biwedgePCoords,
429                          dist2, biwedgeWeights);
430 
431   // vtkBiQuadraticQuadraticHexahedron
432   double bihexPCoords[3], bihexWeights[24], bihexPosition[3];
433   double bihexPoint[1][3] = {{0.25, 0.33333, 0.666667}};
434   double bihexClosest[3];
435   paramcoor = bihex->GetParametricCoords();
436 
437   for(i = 0; i < bihex->GetNumberOfPoints(); i++)
438     bihex->GetPointIds()->SetId(i,i);
439 
440   for(i = 0; i < bihex->GetNumberOfPoints(); i++)
441     bihex->GetPoints()->SetPoint(i, paramcoor[i*3], paramcoor[i*3 + 1], paramcoor[i*3 + 2]);
442 
443   bihex->EvaluatePosition(bihexPoint[0], bihexClosest, subId, bihexPCoords,
444                          dist2, bihexWeights);
445 
446   // vtkTriQuadraticHexahedron
447   double trihexPCoords[3], trihexWeights[27], trihexPosition[3];
448   double trihexPoint[1][3] = {{0.25, 0.33333, 0.666667}};
449   double trihexClosest[3];
450   paramcoor = trihex->GetParametricCoords();
451 
452   for(i = 0; i < trihex->GetNumberOfPoints(); i++)
453     trihex->GetPointIds()->SetId(i,i);
454 
455   for(i = 0; i < trihex->GetNumberOfPoints(); i++)
456     trihex->GetPoints()->SetPoint(i, paramcoor[i*3], paramcoor[i*3 + 1], paramcoor[i*3 + 2]);
457 
458   trihex->EvaluatePosition(trihexPoint[0], trihexClosest, subId, trihexPCoords,
459                          dist2, trihexWeights);
460 
461 
462 
463   // vtkBiQuadraticTriangle
464   double bitriPCoords[3], bitriWeights[14], bitriPosition[3];
465   double bitriPoint[1][3] = {{0.5, 0.266667, 0.0}};
466   double bitriClosest[3];
467 
468   bitri->GetPointIds()->SetId(0,0);
469   bitri->GetPointIds()->SetId(1,1);
470   bitri->GetPointIds()->SetId(2,2);
471   bitri->GetPointIds()->SetId(3,3);
472   bitri->GetPointIds()->SetId(4,4);
473   bitri->GetPointIds()->SetId(5,5);
474 
475   bitri->GetPoints()->SetPoint(0, 0, 0, 0);
476   bitri->GetPoints()->SetPoint(1, 1, 0, 0);
477   bitri->GetPoints()->SetPoint(2, 0.5, 0.8, 0);
478   bitri->GetPoints()->SetPoint(3, 0.5, 0.0, 0);
479   bitri->GetPoints()->SetPoint(4, 0.75, 0.4, 0);
480   bitri->GetPoints()->SetPoint(5, 0.25, 0.4, 0);
481   bitri->GetPoints()->SetPoint(6, 0.45, 0.24, 0);
482 
483   bitri->EvaluatePosition(bitriPoint[0], bitriClosest, subId, bitriPCoords,
484                         dist2, bitriWeights);
485 
486 
487   // vtkCubicLine
488 
489   double culinePCoords[3], culineWeights[4];
490   double culinePoint[1][3] = {{0.25, 0.125, 0.0}};
491   double culineClosest[3];
492 
493   culine->GetPointIds()->SetId(0,0);
494   culine->GetPointIds()->SetId(1,1);
495   culine->GetPointIds()->SetId(2,2);
496   culine->GetPointIds()->SetId(3,3);
497 
498 
499   culine->GetPoints()->SetPoint(0, 0, 0, 0);
500   culine->GetPoints()->SetPoint(1, 1, 0, 0);
501   culine->GetPoints()->SetPoint(2, (1.0/3.0), -0.1, 0);
502   culine->GetPoints()->SetPoint(3, (1.0/3.0), 0.1, 0);
503 
504 
505   culine->EvaluatePosition(culinePoint[0], culineClosest, subId, culinePCoords,
506                         dist2, culineWeights);
507 
508 
509   strm << "Test vtkCell::EvaluatePosition End" << endl;
510 
511   //-------------------------------------------------------------
512   strm << "Test vtkCell::EvaluateLocation Start" << endl;
513   // vtkQuadraticEdge
514   edge->EvaluateLocation(subId, edgePCoords, edgePosition, edgeWeights);
515 
516   // vtkQuadraticTriangle
517   tri->EvaluateLocation(subId, triPCoords, triPosition, triWeights);
518 
519   // vtkQuadraticQuad
520   quad->EvaluateLocation(subId, quadPCoords, quadPosition, quadWeights);
521 
522   // vtkQuadraticTetra
523   tetra->EvaluateLocation(subId, tetraPCoords, tetraPosition, tetraWeights);
524 
525   // vtkQuadraticHexahedron
526   hex->EvaluateLocation(subId, hexPCoords, hexPosition, hexWeights);
527 
528   // vtkQuadraticWedge
529   wedge->EvaluateLocation(subId, wedgePCoords, wedgePosition, wedgeWeights);
530 
531   // vtkQuadraticPyramid
532   pyra->EvaluateLocation(subId, pyraPCoords, pyraPosition, pyraWeights);
533 
534   // New quadratic cells
535 
536   // vtkQuadraticLinearQuad
537   quadlin->EvaluateLocation(subId, quadlinPCoords, quadlinPosition, quadlinWeights);
538 
539   // vtkBiQuadraticQuad
540   biquad->EvaluateLocation(subId, biquadPCoords, biquadPosition, biquadWeights);
541 
542 
543   // vtkQuadraticLinearWedge
544   wedgelin->EvaluateLocation(subId, wedgelinPCoords, wedgelinPosition, wedgelinWeights);
545 
546   // vtkBiQuadraticQuadraticWedge
547   biwedge->EvaluateLocation(subId, biwedgePCoords, biwedgePosition, biwedgeWeights);
548 
549   // vtkQuadraticLinearQuad
550   bihex->EvaluateLocation(subId, bihexPCoords, bihexPosition, bihexWeights);
551 
552   // vtkTriQuadraticHexahedron
553   trihex->EvaluateLocation(subId, trihexPCoords, trihexPosition, trihexWeights);
554 
555   // vtkBiQuadraticTriangle
556   bitri->EvaluateLocation(subId, bitriPCoords, bitriPosition, bitriWeights);
557 
558   strm << "Test vtkCell::EvaluateLocation End" << endl;
559 
560   //-------------------------------------------------------------
561   strm << "Test vtkCell::CellDerivs Start" << endl;
562 
563   // vtkQuadraticEdge - temporarily commented out
564   //double edgeValues[3], edgeDerivs[3];
565   //ComputeDataValues(edge->Points,edgeValues);
566   //edge->Derivatives(subId, edgePCoords, edgeValues, 1, edgeDerivs);
567 
568   // vtkQuadraticTriangle
569   double triValues[6], triDerivs[3];
570   ComputeDataValues(tri->Points,triValues);
571   tri->Derivatives(subId, triPCoords, triValues, 1, triDerivs);
572 
573   // vtkQuadraticQuad
574   double quadValues[8], quadDerivs[3];
575   ComputeDataValues(quad->Points,quadValues);
576   quad->Derivatives(subId, quadPCoords, quadValues, 1, quadDerivs);
577 
578   // vtkQuadraticTetra
579   double tetraValues[10], tetraDerivs[3];
580   ComputeDataValues(tetra->Points,tetraValues);
581   tetra->Derivatives(subId, tetraPCoords, tetraValues, 1, tetraDerivs);
582 
583   // vtkQuadraticHexahedron
584   double hexValues[20], hexDerivs[3];
585   ComputeDataValues(hex->Points,hexValues);
586   hex->Derivatives(subId, hexPCoords, hexValues, 1, hexDerivs);
587 
588   // vtkQuadraticWedge
589   double wedgeValues[15], wedgeDerivs[3];
590   ComputeDataValues(wedge->Points,wedgeValues);
591   wedge->Derivatives(subId, wedgePCoords, wedgeValues, 1, wedgeDerivs);
592 
593   // vtkQuadraticPyramid
594   double pyraValues[13], pyraDerivs[3];
595   ComputeDataValues(pyra->Points,pyraValues);
596   pyra->Derivatives(subId, pyraPCoords, pyraValues, 1, pyraDerivs);
597 
598   // New quadratic cells
599 
600   // vtkQuadraticLinearQuad
601   double quadlinValues[6], quadlinDerivs[3];
602   ComputeDataValues(quadlin->Points,quadlinValues);
603   quadlin->Derivatives(subId, quadlinPCoords, quadlinValues, 1, quadlinDerivs);
604 
605   // vtkBiQuadraticQuad
606   double biquadValues[9], biquadDerivs[3];
607   ComputeDataValues(biquad->Points,biquadValues);
608   biquad->Derivatives(subId, biquadPCoords, biquadValues, 1, biquadDerivs);
609 
610   // vtkQuadraticLinearWedge
611   double wedgelinValues[12], wedgelinDerivs[3];
612   ComputeDataValues(wedgelin->Points, wedgelinValues);
613   wedgelin->Derivatives(subId, wedgelinPCoords, wedgelinValues, 1, wedgelinDerivs);
614 
615   // vtkBiQuadraticQuadraticWedge
616   double biwedgeValues[18], biwedgeDerivs[3];
617   ComputeDataValues(biwedge->Points, biwedgeValues);
618   biwedge->Derivatives(subId, biwedgePCoords, biwedgeValues, 1, biwedgeDerivs);
619 
620   // vtkBiQuadraticQuadraticHexahedron
621   double bihexValues[24], bihexDerivs[3];
622   ComputeDataValues(bihex->Points, bihexValues);
623   bihex->Derivatives(subId, bihexPCoords, bihexValues, 1, bihexDerivs);
624 
625   // vtkTriQuadraticHexahedron
626   double trihexValues[27], trihexDerivs[3];
627   ComputeDataValues(trihex->Points, trihexValues);
628   trihex->Derivatives(subId, trihexPCoords, trihexValues, 1, trihexDerivs);
629 
630   // vtkBiQuadraticTriangle
631   double bitriValues[7], bitriDerivs[3];
632   ComputeDataValues(bitri->Points,bitriValues);
633   bitri->Derivatives(subId, bitriPCoords, bitriValues, 1, bitriDerivs);
634 
635 
636   strm << "Test vtkCell::CellDerivs End" << endl;
637 
638   edge->Delete();
639   tri->Delete();
640   tetra->Delete();
641   wedge->Delete();
642   wedgelin->Delete();
643   biwedge->Delete();
644   pyra->Delete();
645   quad->Delete();
646   quadlin->Delete();
647   biquad->Delete();
648   hex->Delete();
649   bihex->Delete();
650   trihex->Delete();
651   bitri->Delete();
652   culine->Delete();
653 
654   return 0;
655 }
656 
quadraticEvaluation(int,char * [])657 int quadraticEvaluation(int,char *[])
658 {
659   vtksys_ios::ostringstream vtkmsg_with_warning_C4701;
660   return TestQE(vtkmsg_with_warning_C4701);
661 }
662