From 016508c40aa0e1f6598a88240cd21ad62abfe583 Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Wed, 29 Jul 2026 09:23:03 +0200 Subject: [PATCH] Fix compilation issue after VTK deprecation removals --- plugin/MEDLoaderForPV/MEDFileFieldRepresentationTree.cxx | 2 +- plugin/MEDReaderIO/vtkExtractCellType.cxx | 6 +++--- plugin/MEDReaderIO/vtkUgSelectCellIds.cxx | 9 +++------ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/plugin/MEDLoaderForPV/MEDFileFieldRepresentationTree.cxx b/plugin/MEDLoaderForPV/MEDFileFieldRepresentationTree.cxx index 8afcb14b..4f70b44d 100644 --- a/plugin/MEDLoaderForPV/MEDFileFieldRepresentationTree.cxx +++ b/plugin/MEDLoaderForPV/MEDFileFieldRepresentationTree.cxx @@ -745,7 +745,7 @@ vtkUnstructuredGrid *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInt vtkNew cells; vtkNew cells2; AssignDataPointerOther(cells2,cellsSafe,cellsSafe->getNbOfElems()); - cells->SetCells(nbOfCells,cells2); + cells->ImportLegacyFormat(cells2); if(faceLocationsOffsetSafe.isNotNull()) { vtkNew faceLocationsOffset; diff --git a/plugin/MEDReaderIO/vtkExtractCellType.cxx b/plugin/MEDReaderIO/vtkExtractCellType.cxx index 29308087..950a6066 100644 --- a/plugin/MEDReaderIO/vtkExtractCellType.cxx +++ b/plugin/MEDReaderIO/vtkExtractCellType.cxx @@ -1,7 +1,7 @@ #include "vtkExtractCellType.h" #include "vtkCell.h" -#include "vtkCellTypes.h" +#include "vtkCellTypeUtilities.h" #include "vtkCompositeDataSet.h" #include "vtkCompositeDataIterator.h" #include "vtkDataArraySelection.h" @@ -29,7 +29,7 @@ void vtkExtractCellType::AppendToGeoTypes(vtkDataSet* dataset) vtkCell* cell = dataset->GetCell(i); // TODO use MEDCoupling CellType API - const char* cellType = vtkCellTypes::GetClassNameFromTypeId(cell->GetCellType()); + const char* cellType = vtkCellTypeUtilities::GetClassNameFromTypeId(cell->GetCellType()); if (!this->FieldSelection->ArrayExists(cellType)) { this->FieldSelection->AddArray(cellType, false); @@ -45,7 +45,7 @@ void vtkExtractCellType::SelectIds(vtkDataSet* dataset, vtkIdTypeArray* selArr) vtkCell* cell = dataset->GetCell(i); // TODO use MEDCoupling CellType API - const char* cellType = vtkCellTypes::GetClassNameFromTypeId(cell->GetCellType()); + const char* cellType = vtkCellTypeUtilities::GetClassNameFromTypeId(cell->GetCellType()); // Needed as append to geotypes may not have been done in request information // when loading state diff --git a/plugin/MEDReaderIO/vtkUgSelectCellIds.cxx b/plugin/MEDReaderIO/vtkUgSelectCellIds.cxx index b2ee0404..8fc662e9 100644 --- a/plugin/MEDReaderIO/vtkUgSelectCellIds.cxx +++ b/plugin/MEDReaderIO/vtkUgSelectCellIds.cxx @@ -64,8 +64,6 @@ int vtkUgSelectCellIds::RequestData(vtkInformation *vtkNotUsed(request), vtkInfo vtkNew outNodalConn; vtkNew outCellTypes; outCellTypes->SetNumberOfComponents(1); outCellTypes->SetNumberOfTuples(outputNbCells); - vtkNew outCellLocations; - outCellLocations->SetNumberOfComponents(1); outCellLocations->SetNumberOfTuples(outputNbCells); vtkIdType outConnLgth(0); for( const vtkIdType *cellId = _ids->GetPointer(0) ; cellId != _ids->GetPointer(outputNbCells) ; ++cellId ) { @@ -83,12 +81,11 @@ int vtkUgSelectCellIds::RequestData(vtkInformation *vtkNotUsed(request), vtkInfo } } outNodalConn->SetNumberOfComponents(1); outNodalConn->SetNumberOfTuples(outConnLgth); - vtkIdType *outConnPt(outNodalConn->GetPointer(0)),*outCellLocPt(outCellLocations->GetPointer(0)); + vtkIdType *outConnPt(outNodalConn->GetPointer(0)); vtkIdType outCurCellLoc = 0; unsigned char *outCellTypePt(outCellTypes->GetPointer(0)); for( const vtkIdType *cellId = _ids->GetPointer(0) ; cellId != _ids->GetPointer(outputNbCells) ; ++cellId ) { - outCellLocPt[0] = outCurCellLoc; vtkIdType npts; const vtkIdType *pts; ds->GetCellPoints(*cellId, npts, pts); @@ -120,8 +117,8 @@ int vtkUgSelectCellIds::RequestData(vtkInformation *vtkNotUsed(request), vtkInfo outPointData->AddArray(outArray); } // - outCellArray->SetCells(outputNbCells,outNodalConn); - output->SetCells(outCellTypes,outCellLocations,outCellArray); + outCellArray->ImportLegacyFormat(outNodalConn); + output->SetCells(outCellTypes,outCellArray); // return 1; }