Skip to content

Commit cf1e3b3

Browse files
authored
Merge pull request #126 from ktbolt/vtk-9-changes_118
Fix VTK 9 API changes that were causing compilation errors
2 parents aa91387 + 5fc15d4 commit cf1e3b3

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

Code/FlowSolvers/ThreeDSolver/svPre/cmd.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@
5757
#include "vtkPolyData.h"
5858
#include "vtkDoubleArray.h"
5959

60+
// Set directive to use vtkIdType const *pts if
61+
// VTK version is 9 or large.
62+
//
63+
#include <vtkVersion.h>
64+
65+
#ifdef VTK_VERSION_NUMBER
66+
#if VTK_VERSION_NUMBER >= 90020210809ULL
67+
#define VTK_USE_NEW_ID_TYPE
68+
#endif
69+
#endif
70+
6071
#ifdef WIN32
6172
#define CALLTYPE __cdecl
6273
#else

Code/FlowSolvers/ThreeDSolver/svPre/helpers.cxx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1915,7 +1915,13 @@ int VtkUtils_GetAllPolys( vtkPolyData *pd, int *numPgns, vtkIdType **pgns )
19151915
{
19161916
vtkCellArray *pdPgns;
19171917
int size, i;
1918-
vtkIdType npts, *pts;
1918+
vtkIdType npts;
1919+
1920+
#ifdef VTK_USE_NEW_ID_TYPE
1921+
vtkIdType const *pts;
1922+
#else
1923+
vtkIdType *pts;
1924+
#endif
19191925
int pos = 0;
19201926

19211927
(*numPgns) = pd->GetNumberOfPolys();

Code/FlowSolvers/ThreeDSolver/svPre/presolver-vtk-cmds.cxx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,14 @@ int cmd_mesh_and_adjncy_vtu(char *cmd) {
680680
vtkIdType cellId;
681681
vtkIdType meshCellId;
682682
vtkIdType p1, p2, p3;
683+
684+
#ifdef VTK_USE_NEW_ID_TYPE
685+
vtkIdType const *pts;
686+
#else
687+
vtkIdType *pts;
688+
#endif
689+
683690
vtkIdType npts = 0;
684-
vtkIdType *pts = 0;
685691
vtkSmartPointer < vtkIdList > ptIds = vtkSmartPointer < vtkIdList > ::New();
686692
vtkSmartPointer < vtkIdList > cellIds = vtkSmartPointer < vtkIdList
687693
> ::New();

0 commit comments

Comments
 (0)