FreeCAD/smesh-Fix-build-failure-with-vtk-9_4.patch
Stefan Brüns a89cd7a152 - Update smesh-Fix-build-failure-with-vtk-9_4.patch to final
version, fix OBS reject due to source mismatch.
- Fix spurious failures of ReaderTest, add
  * Add-property-read-write-test.patch
  * Fix-test-failure-temporary-file-race.patch

OBS-URL: https://build.opensuse.org/package/show/science/FreeCAD?expand=0&rev=184
2025-01-19 04:32:44 +00:00

72 lines
3.0 KiB
Diff

From 3b502359353e2a74dee8a8bcfed5750b69f32cdc Mon Sep 17 00:00:00 2001
From: wmayer <wmayer@freecad.org>
Date: Mon, 16 Dec 2024 10:56:43 +0100
Subject: [PATCH] smesh: Fix build failure with vtk 9.4
Fixes #18423
---
.../src/SMDS/SMDS_UnstructuredGrid.cpp | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
index e9895d615717..4e9d6dc05764 100644
--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
+++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
@@ -32,6 +32,7 @@
#include <vtkDoubleArray.h>
#include <vtkIdTypeArray.h>
#include <vtkUnsignedCharArray.h>
+#include <vtkVersionMacros.h>
#include <list>
#include <climits>
@@ -249,14 +250,16 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
}
}
- if (this->FaceLocations)
+ vtkIdTypeArray* thisFaceLocations = GetFaceLocations();
+ vtkIdTypeArray* thisFaces = GetFaces();
+ if (thisFaceLocations)
{
vtkIdTypeArray *newFaceLocations = vtkIdTypeArray::New();
newFaceLocations->Initialize();
newFaceLocations->Allocate(newTypes->GetSize());
vtkIdTypeArray *newFaces = vtkIdTypeArray::New();
newFaces->Initialize();
- newFaces->Allocate(this->Faces->GetSize());
+ newFaces->Allocate(thisFaces->GetSize());
for (int i = 0; i < oldCellSize; i++)
{
if (this->Types->GetValue(i) == VTK_EMPTY_CELL)
@@ -265,16 +268,16 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
if (newTypes->GetValue(newCellId) == VTK_POLYHEDRON)
{
newFaceLocations->InsertNextValue(newFaces->GetMaxId()+1);
- int oldFaceLoc = this->FaceLocations->GetValue(i);
- int nCellFaces = this->Faces->GetValue(oldFaceLoc++);
+ int oldFaceLoc = thisFaceLocations->GetValue(i);
+ int nCellFaces = thisFaces->GetValue(oldFaceLoc++);
newFaces->InsertNextValue(nCellFaces);
for (int n=0; n<nCellFaces; n++)
{
- int nptsInFace = this->Faces->GetValue(oldFaceLoc++);
+ int nptsInFace = thisFaces->GetValue(oldFaceLoc++);
newFaces->InsertNextValue(nptsInFace);
for (int k=0; k<nptsInFace; k++)
{
- int oldpt = this->Faces->GetValue(oldFaceLoc++);
+ int oldpt = thisFaces->GetValue(oldFaceLoc++);
newFaces->InsertNextValue(idNodesOldToNew[oldpt]);
}
}
@@ -292,7 +295,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
}
else
{
- this->SetCells(newTypes, newLocations, newConnectivity, FaceLocations, Faces);
+ this->SetCells(newTypes, newLocations, newConnectivity, thisFaceLocations, thisFaces);
}
newPoints->Delete();