Skip to content

Fix Triangulate for Bezier and Lagrange cells

Florian Maurin requested to merge florian360/vtk:FixTriangulate into master

In this issue paraview/paraview#18395 (closed), it is reported that the volume CellSize function is not working for hex, wedge and tetrahedral Lagrange cells. This MR fix the cases of hex and wedges. The nature of the problem for tetrahedra are different and will be fixed by !6680 (merged).

Two bugs are solved in this MR:

For vtkHigherOrderHexahedron.cxx and vtkHigherOrderWedge.cxx, an offset was used but make no sense because the ids do not correspond to the points anymore. This was creating out of range indices. Note that for all the other Bezier/Lagrange cell types, this offset is not present. For this reasons, the offset has been removed.

For the second problem, the signature of the triangulate function is

Triangulate(int index, vtkIdList* ptIds, vtkPoints* pts)

where index is not used for most of the functions. But for fiew of them, the code is only executed if this index is an odd number (see code bellow). So to be sure that this code is executed, we force the index to one. This is already done in like this in multiple parts of the code.

int vtkHexahedron::Triangulate(int index, vtkIdList* ptIds, vtkPoints* pts)
{
  // Create five tetrahedron. Triangulation varies depending upon index. This
  // is necessary to insure compatible voxel triangulations.
  if ((index % 2))
{
function code
}
return ..

Backport: release

Edited by Florian Maurin

Merge request reports