Skip to content

Commit 5fc15d4

Browse files
committed
Add directive to use new vtkIdType depending on VTK version.
1 parent 8becc1e commit 5fc15d4

3 files changed

Lines changed: 23 additions & 1 deletion

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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,7 +1916,12 @@ int VtkUtils_GetAllPolys( vtkPolyData *pd, int *numPgns, vtkIdType **pgns )
19161916
vtkCellArray *pdPgns;
19171917
int size, i;
19181918
vtkIdType npts;
1919+
1920+
#ifdef VTK_USE_NEW_ID_TYPE
19191921
vtkIdType const *pts;
1922+
#else
1923+
vtkIdType *pts;
1924+
#endif
19201925
int pos = 0;
19211926

19221927
(*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-
vtkIdType npts = 0;
683+
684+
#ifdef VTK_USE_NEW_ID_TYPE
684685
vtkIdType const *pts;
686+
#else
687+
vtkIdType *pts;
688+
#endif
689+
690+
vtkIdType npts = 0;
685691
vtkSmartPointer < vtkIdList > ptIds = vtkSmartPointer < vtkIdList > ::New();
686692
vtkSmartPointer < vtkIdList > cellIds = vtkSmartPointer < vtkIdList
687693
> ::New();

0 commit comments

Comments
 (0)