From 5fc15d435538367d395f6c691500d4cd9492f0df Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Tue, 23 Jan 2024 13:16:33 -0800 Subject: [PATCH] Add directive to use new vtkIdType depending on VTK version. --- Code/FlowSolvers/ThreeDSolver/svPre/cmd.h | 11 +++++++++++ Code/FlowSolvers/ThreeDSolver/svPre/helpers.cxx | 5 +++++ .../ThreeDSolver/svPre/presolver-vtk-cmds.cxx | 8 +++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Code/FlowSolvers/ThreeDSolver/svPre/cmd.h b/Code/FlowSolvers/ThreeDSolver/svPre/cmd.h index f38f67e2..a5b5da23 100644 --- a/Code/FlowSolvers/ThreeDSolver/svPre/cmd.h +++ b/Code/FlowSolvers/ThreeDSolver/svPre/cmd.h @@ -57,6 +57,17 @@ #include "vtkPolyData.h" #include "vtkDoubleArray.h" +// Set directive to use vtkIdType const *pts if +// VTK version is 9 or large. +// +#include + +#ifdef VTK_VERSION_NUMBER +#if VTK_VERSION_NUMBER >= 90020210809ULL +#define VTK_USE_NEW_ID_TYPE +#endif +#endif + #ifdef WIN32 #define CALLTYPE __cdecl #else diff --git a/Code/FlowSolvers/ThreeDSolver/svPre/helpers.cxx b/Code/FlowSolvers/ThreeDSolver/svPre/helpers.cxx index cd70be79..820a3af8 100644 --- a/Code/FlowSolvers/ThreeDSolver/svPre/helpers.cxx +++ b/Code/FlowSolvers/ThreeDSolver/svPre/helpers.cxx @@ -1916,7 +1916,12 @@ int VtkUtils_GetAllPolys( vtkPolyData *pd, int *numPgns, vtkIdType **pgns ) vtkCellArray *pdPgns; int size, i; vtkIdType npts; + + #ifdef VTK_USE_NEW_ID_TYPE vtkIdType const *pts; + #else + vtkIdType *pts; + #endif int pos = 0; (*numPgns) = pd->GetNumberOfPolys(); diff --git a/Code/FlowSolvers/ThreeDSolver/svPre/presolver-vtk-cmds.cxx b/Code/FlowSolvers/ThreeDSolver/svPre/presolver-vtk-cmds.cxx index d45cb090..dc19ba65 100644 --- a/Code/FlowSolvers/ThreeDSolver/svPre/presolver-vtk-cmds.cxx +++ b/Code/FlowSolvers/ThreeDSolver/svPre/presolver-vtk-cmds.cxx @@ -680,8 +680,14 @@ int cmd_mesh_and_adjncy_vtu(char *cmd) { vtkIdType cellId; vtkIdType meshCellId; vtkIdType p1, p2, p3; - vtkIdType npts = 0; + + #ifdef VTK_USE_NEW_ID_TYPE vtkIdType const *pts; + #else + vtkIdType *pts; + #endif + + vtkIdType npts = 0; vtkSmartPointer < vtkIdList > ptIds = vtkSmartPointer < vtkIdList > ::New(); vtkSmartPointer < vtkIdList > cellIds = vtkSmartPointer < vtkIdList > ::New();