Skip to content

Commit

Permalink
Add directive to use new vtkIdType depending on VTK version.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbolt committed Jan 23, 2024
1 parent 8becc1e commit 5fc15d4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Code/FlowSolvers/ThreeDSolver/svPre/cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <vtkVersion.h>

#ifdef VTK_VERSION_NUMBER
#if VTK_VERSION_NUMBER >= 90020210809ULL
#define VTK_USE_NEW_ID_TYPE
#endif
#endif

#ifdef WIN32
#define CALLTYPE __cdecl
#else
Expand Down
5 changes: 5 additions & 0 deletions Code/FlowSolvers/ThreeDSolver/svPre/helpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 7 additions & 1 deletion Code/FlowSolvers/ThreeDSolver/svPre/presolver-vtk-cmds.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 5fc15d4

Please sign in to comment.