Standardize VTK version check pre-processing directives

Check for the build date of the exact introduction of the feature instead of the next tagged version
This commit is contained in:
Louis Gombert
2025-11-27 20:46:57 +01:00
committed by Max Wilfinger
parent bd90728f88
commit c9acda2a65
7 changed files with 17 additions and 13 deletions

View File

@@ -28,6 +28,7 @@
#include <vtkUnstructuredGrid.h>
#include <vtkCellLinks.h>
#include <vtkVersion.h>
#include <vector>
#include <set>
@@ -95,7 +96,7 @@ public:
std::map<int, std::map<long,int> >& nodeQuadDomains);
vtkCellLinks* GetLinks()
{
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
#if VTK_VERSION_NUMBER >= VTK_VERSION_CHECK(9, 2, 20221112)
return static_cast<vtkCellLinks*>(vtkUnstructuredGrid::GetLinks());
#else
return static_cast<vtkCellLinks*>(GetCellLinks());

View File

@@ -53,6 +53,7 @@
#include <vtkCell.h>
#include <vtkCellLinks.h>
#include <vtkIdList.h>
#include <vtkVersion.h>
#include <algorithm>
#include <map>
@@ -4712,7 +4713,7 @@ void SMDS_Mesh::dumpGrid(string ficdump)
ficcon << endl;
}
ficcon << "-------------------------------- connectivity " << nbPoints << endl;
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
#if VTK_VERSION_NUMBER >= VTK_VERSION_CHECK(9, 2, 20221112)
vtkCellLinks *links = static_cast<vtkCellLinks*>(myGrid->GetLinks());
#else
vtkCellLinks *links = static_cast<vtkCellLinks*>(myGrid->GetCellLinks());

View File

@@ -31,6 +31,7 @@
#include "SMDS_IteratorOfElements.hxx"
#include "SMDS_Mesh.hxx"
#include <vtkUnstructuredGrid.h>
#include <vtkVersion.h>
#include "utilities.h"
#include "Utils_SALOME_Exception.hxx"
@@ -69,7 +70,7 @@ void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, do
SMDS_UnstructuredGrid * grid = mesh->getGrid();
vtkPoints *points = grid->GetPoints();
points->InsertPoint(myVtkID, x, y, z);
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
#if VTK_VERSION_NUMBER >= VTK_VERSION_CHECK(9, 2, 20221112)
SMDS_CellLinks *cellLinks = dynamic_cast<SMDS_CellLinks*>(grid->GetLinks());
#else
SMDS_CellLinks *cellLinks = dynamic_cast<SMDS_CellLinks*>(grid->GetCellLinks());
@@ -195,7 +196,7 @@ public:
SMDS_ElemIteratorPtr SMDS_MeshNode::
GetInverseElementIterator(SMDSAbs_ElementType type) const
{
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
#if VTK_VERSION_NUMBER >= VTK_VERSION_CHECK(9, 2, 20221112)
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks())->GetLink(myVtkID);
#else
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
@@ -259,7 +260,7 @@ elementsIterator(SMDSAbs_ElementType type) const
return SMDS_MeshElement::elementsIterator(SMDSAbs_Node);
else
{
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
#if VTK_VERSION_NUMBER >= VTK_VERSION_CHECK(9, 2, 20221112)
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks())->GetLink(myVtkID);
#else
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
@@ -362,7 +363,7 @@ void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME)
const SMDS_MeshCell *cell = dynamic_cast<const SMDS_MeshCell*> (ME);
assert(cell);
SMDS_UnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
#if VTK_VERSION_NUMBER >= VTK_VERSION_CHECK(9, 2, 20221112)
vtkCellLinks *Links = static_cast<vtkCellLinks*>(grid->GetLinks());
#else
vtkCellLinks *Links = static_cast<vtkCellLinks*>(grid->GetCellLinks());
@@ -382,7 +383,7 @@ void SMDS_MeshNode::ClearInverseElements()
bool SMDS_MeshNode::emptyInverseElements()
{
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
#if VTK_VERSION_NUMBER >= VTK_VERSION_CHECK(9, 2, 20221112)
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks())->GetLink(myVtkID);
#else
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
@@ -398,7 +399,7 @@ bool SMDS_MeshNode::emptyInverseElements()
int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const
{
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
#if VTK_VERSION_NUMBER >= VTK_VERSION_CHECK(9, 2, 20221112)
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks())->GetLink(myVtkID);
#else
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);

View File

@@ -1006,7 +1006,7 @@ void SMDS_UnstructuredGrid::BuildLinks()
this->Links = SMDS_CellLinks::New();
GetLinks()->Allocate(this->GetNumberOfPoints());
GetLinks()->Register(this);
#if VTK_VERSION_NUMBER < VTK_VERSION_CHECK(9,3,0)
#if VTK_VERSION_NUMBER < VTK_VERSION_CHECK(9, 2, 20221112)
GetLinks()->BuildLinks(this);
#else
GetLinks()->SetDataSet(this);

View File

@@ -57,6 +57,7 @@
#include "utilities.h"
#include "chrono.hxx"
#include <vtkVersion.h>
#include <BRepAdaptor_Surface.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
@@ -11348,7 +11349,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
{
int oldId = *itn;
//MESSAGE(" node " << oldId);
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
#if VTK_VERSION_NUMBER >= VTK_VERSION_CHECK(9, 2, 20221112)
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(grid->GetLinks())->GetLink(oldId);
#else
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(grid->GetCellLinks())->GetLink(oldId);
@@ -11712,7 +11713,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
{
int oldId = itnod->first;
//MESSAGE(" node " << oldId);
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
#if VTK_VERSION_NUMBER >= VTK_VERSION_CHECK(9, 2, 20221112)
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(grid->GetLinks())->GetLink(oldId);
#else
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(grid->GetCellLinks())->GetLink(oldId);

View File

@@ -32,7 +32,7 @@
#include "FemResultObject.h"
#include "VTKExtensions/vtkFemFrameSourceAlgorithm.h"
#if VTK_VERSION_NUMBER < VTK_VERSION_CHECK(9, 3, 0)
#if VTK_VERSION_NUMBER < VTK_VERSION_CHECK(9, 2, 20230125)
# include "VTKExtensions/vtkCleanUnstructuredGrid.h"
#else
# include <vtkCleanUnstructuredGrid.h>

View File

@@ -151,7 +151,7 @@
#include <vtkAppendFilter.h>
#include <vtkArrayCalculator.h>
#include <vtkCellArray.h>
#if VTK_VERSION_NUMBER >= VTK_VERSION_CHECK(9, 3, 0)
#if VTK_VERSION_NUMBER >= VTK_VERSION_CHECK(9, 2, 20230125)
# include <vtkCleanUnstructuredGrid.h>
#endif
#include <vtkCompositeDataSet.h>