summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/freecad-vtk9.patch
blob: 74568f4318e22715963f0a031f5d3f74b3f3e5a4 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
From bb9bcbd51df7c3cb76c5823038e4ea0f7e25a9ff Mon Sep 17 00:00:00 2001
From: wmayer <wmayer@users.sourceforge.net>
Date: Mon, 12 Oct 2020 17:56:03 +0200
Subject: [PATCH] Make smesh compile with vtk9

---
 .../salomesmesh/inc/SMDS_MeshElement.hxx      |  9 +++-
 .../salomesmesh/inc/SMDS_UnstructuredGrid.hxx |  4 ++
 .../salomesmesh/src/SMDS/SMDS_BallElement.cpp |  9 +++-
 .../salomesmesh/src/SMDS/SMDS_Downward.cpp    | 44 +++++++++----------
 .../salomesmesh/src/SMDS/SMDS_Mesh.cpp        |  6 ++-
 .../src/SMDS/SMDS_Mesh0DElement.cpp           | 12 +++++
 .../salomesmesh/src/SMDS/SMDS_MeshNode.cpp    | 10 ++---
 .../src/SMDS/SMDS_UnstructuredGrid.cpp        | 35 +++++++++++++--
 .../src/SMDS/SMDS_VtkCellIterator.cpp         |  7 +--
 .../salomesmesh/src/SMDS/SMDS_VtkEdge.cpp     | 19 +++++++-
 .../salomesmesh/src/SMDS/SMDS_VtkFace.cpp     | 29 ++++++++++--
 .../salomesmesh/src/SMDS/SMDS_VtkVolume.cpp   | 38 +++++++++++-----
 .../src/SMESH/SMESH_MeshEditor.cpp            |  8 ++--
 src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp |  7 ++-
 14 files changed, 179 insertions(+), 58 deletions(-)

Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx
===================================================================
--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx
+++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx
@@ -40,11 +40,16 @@
 
 #include <vtkType.h>
 #include <vtkCellType.h>
+#include <vtkCellArray.h>
 
 //typedef unsigned short UShortType;
 typedef short ShortType;
 typedef int   LongType;
-
+#ifdef VTK_CELL_ARRAY_V2
+typedef const vtkIdType* vtkIdTypePtr;
+#else
+typedef vtkIdType* vtkIdTypePtr;
+#endif
 class SMDS_MeshNode;
 class SMDS_MeshEdge;
 class SMDS_MeshFace;
@@ -192,7 +197,7 @@ protected:
   //! Element index in vector SMDS_Mesh::myNodes or SMDS_Mesh::myCells
   int myID;
   //! index in vtkUnstructuredGrid
-  int myVtkID;
+  vtkIdType myVtkID;
   //! SMDS_Mesh identification in SMESH
   ShortType myMeshId;
   //! SubShape and SubMesh identification in SMESHDS
Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/inc/SMDS_UnstructuredGrid.hxx
===================================================================
--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/inc/SMDS_UnstructuredGrid.hxx
+++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/inc/SMDS_UnstructuredGrid.hxx
@@ -95,7 +95,11 @@ public:
                                        std::map<int, std::map<long,int> >& nodeQuadDomains);
   vtkCellLinks* GetLinks()
   {
+#ifdef VTK_CELL_ARRAY_V2
+    return static_cast<vtkCellLinks*>(GetCellLinks());
+#else
     return Links;
+#endif
   }
   SMDS_Downward* getDownArray(unsigned char vtkType)
   {
Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_BallElement.cpp
===================================================================
--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_BallElement.cpp
+++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_BallElement.cpp
@@ -67,10 +67,16 @@ void SMDS_BallElement::SetDiameter(doubl
 bool SMDS_BallElement::ChangeNode (const SMDS_MeshNode * node)
 {
   vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+#ifdef VTK_CELL_ARRAY_V2
+  vtkNew<vtkIdList> cellPoints;
+  grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
+  cellPoints->SetId(0, node->getVtkId());
+#else
   vtkIdType npts = 0;
   vtkIdType* pts = 0;
   grid->GetCellPoints(myVtkID, npts, pts);
   pts[0] = node->getVtkId();
+#endif
   SMDS_Mesh::_meshList[myMeshId]->setMyModified();
   return true;
 }
@@ -83,7 +89,8 @@ void SMDS_BallElement::Print (std::ostre
 const SMDS_MeshNode* SMDS_BallElement::GetNode (const int ind) const
 {
   vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
-  vtkIdType npts, *pts;
+  vtkIdType npts;
+  vtkIdTypePtr pts;
   grid->GetCellPoints( myVtkID, npts, pts );
   return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ 0 ]);
 }
Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_Downward.cpp
===================================================================
--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_Downward.cpp
+++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_Downward.cpp
@@ -303,7 +303,7 @@ int SMDS_Down1D::getNodeSet(int cellId,
 void SMDS_Down1D::setNodes(int cellId, int vtkId)
 {
   vtkIdType npts = 0;
-  vtkIdType *pts; // will refer to the point id's of the face
+  vtkIdTypePtr pts; // will refer to the point id's of the face
   _grid->GetCellPoints(vtkId, npts, pts);
   // MESSAGE(vtkId << " " << npts << "  " << _nbDownCells);
   //ASSERT(npts == _nbDownCells);
@@ -357,7 +357,7 @@ int SMDS_Down1D::computeVtkCells(int *pt
     {
       vtkIdType point = pts[i];
       int numCells = _grid->GetLinks()->GetNcells(point);
-      vtkIdType *cells = _grid->GetLinks()->GetCells(point);
+      vtkIdTypePtr cells = _grid->GetLinks()->GetCells(point);
       for (int j = 0; j < numCells; j++)
         {
           int vtkCellId = cells[j];
@@ -532,7 +532,7 @@ int SMDS_Down2D::computeVolumeIds(int ce
   // --- find point id's of the face
 
   vtkIdType npts = 0;
-  vtkIdType *pts; // will refer to the point id's of the face
+  vtkIdTypePtr pts; // will refer to the point id's of the face
   _grid->GetCellPoints(cellId, npts, pts);
   vector<int> nodes;
   for (int i = 0; i < npts; i++)
@@ -577,7 +577,7 @@ int SMDS_Down2D::computeVolumeIdsFromNod
       vtkIdType point = pts[i];
       int numCells = _grid->GetLinks()->GetNcells(point);
       //MESSAGE("cells pour " << i << " " << numCells);
-      vtkIdType *cells = _grid->GetLinks()->GetCells(point);
+      vtkIdTypePtr cells = _grid->GetLinks()->GetCells(point);
       for (int j = 0; j < numCells; j++)
         {
           int vtkCellId = cells[j];
@@ -627,7 +627,7 @@ int SMDS_Down2D::computeVolumeIdsFromNod
 void SMDS_Down2D::setTempNodes(int cellId, int vtkId)
 {
   vtkIdType npts = 0;
-  vtkIdType *pts; // will refer to the point id's of the face
+  vtkIdTypePtr pts; // will refer to the point id's of the face
   _grid->GetCellPoints(vtkId, npts, pts);
   // MESSAGE(vtkId << " " << npts << "  " << _nbNodes);
   //ASSERT(npts == _nbNodes);
@@ -795,7 +795,7 @@ void SMDS_Down3D::getNodeIds(int cellId,
 {
   int vtkId = this->_vtkCellIds[cellId];
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(vtkId, npts, nodes);
   for (int i = 0; i < npts; i++)
     nodeSet.insert(nodes[i]);
@@ -1126,7 +1126,7 @@ void SMDS_DownTetra::getOrderedNodesOfFa
   //MESSAGE("cellId = " << cellId);
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
 
   set<int> tofind;
@@ -1178,7 +1178,7 @@ void SMDS_DownTetra::computeFacesWithNod
   // --- find point id's of the volume
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(cellId, npts, nodes);
 
   // --- create all the ordered list of node id's for each face
@@ -1234,7 +1234,7 @@ void SMDS_DownQuadTetra::getOrderedNodes
   //MESSAGE("cellId = " << cellId);
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
 
   set<int> tofind;
@@ -1288,7 +1288,7 @@ void SMDS_DownQuadTetra::computeFacesWit
   // --- find point id's of the volume
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(cellId, npts, nodes);
 
   // --- create all the ordered list of node id's for each face
@@ -1357,7 +1357,7 @@ void SMDS_DownPyramid::getOrderedNodesOf
   //MESSAGE("cellId = " << cellId);
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
 
   set<int> tofind;
@@ -1435,7 +1435,7 @@ void SMDS_DownPyramid::computeFacesWithN
   // --- find point id's of the volume
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(cellId, npts, nodes);
 
   // --- create all the ordered list of node id's for each face
@@ -1500,7 +1500,7 @@ void SMDS_DownQuadPyramid::getOrderedNod
   //MESSAGE("cellId = " << cellId);
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
 
   set<int> tofind;
@@ -1580,7 +1580,7 @@ void SMDS_DownQuadPyramid::computeFacesW
   // --- find point id's of the volume
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(cellId, npts, nodes);
 
   // --- create all the ordered list of node id's for each face
@@ -1660,7 +1660,7 @@ void SMDS_DownPenta::getOrderedNodesOfFa
   //MESSAGE("cellId = " << cellId);
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
 
   set<int> tofind;
@@ -1744,7 +1744,7 @@ void SMDS_DownPenta::computeFacesWithNod
   // --- find point id's of the volume
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(cellId, npts, nodes);
 
   // --- create all the ordered list of node id's for each face
@@ -1810,7 +1810,7 @@ void SMDS_DownQuadPenta::getOrderedNodes
   //MESSAGE("cellId = " << cellId);
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
 
   set<int> tofind;
@@ -1896,7 +1896,7 @@ void SMDS_DownQuadPenta::computeFacesWit
   // --- find point id's of the volume
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(cellId, npts, nodes);
 
   // --- create all the ordered list of node id's for each face
@@ -1981,7 +1981,7 @@ void SMDS_DownHexa::getOrderedNodesOfFac
   //MESSAGE("cellId = " << cellId);
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
 
   set<int> tofind;
@@ -2036,7 +2036,7 @@ void SMDS_DownHexa::computeFacesWithNode
   // --- find point id's of the volume
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(cellId, npts, nodes);
 
   // --- create all the ordered list of node id's for each face
@@ -2112,7 +2112,7 @@ void SMDS_DownQuadHexa::getOrderedNodesO
   //MESSAGE("cellId = " << cellId);
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
 
   set<int> tofind;
@@ -2167,7 +2167,7 @@ void SMDS_DownQuadHexa::computeFacesWith
   // --- find point id's of the volume
 
   vtkIdType npts = 0;
-  vtkIdType *nodes; // will refer to the point id's of the volume
+  vtkIdTypePtr nodes; // will refer to the point id's of the volume
   _grid->GetCellPoints(cellId, npts, nodes);
 
   // --- create all the ordered list of node id's for each face
Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh.cpp
===================================================================
--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh.cpp
+++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh.cpp
@@ -4768,7 +4768,11 @@ void SMDS_Mesh::dumpGrid(string ficdump)
         ficcon << endl;
   }
   ficcon << "-------------------------------- connectivity " <<  nbPoints << endl;
-        vtkCellLinks *links = myGrid->GetCellLinks();
+#ifdef VTK_CELL_ARRAY_V2
+  vtkCellLinks *links = static_cast<vtkCellLinks*>(myGrid->GetCellLinks());
+#else
+  vtkCellLinks *links = myGrid->GetCellLinks();
+#endif
   for (int i=0; i<nbPoints; i++)
   {
         int ncells = links->GetNcells(i);
Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp
===================================================================
--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp
+++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp
@@ -146,6 +146,17 @@ bool SMDS_Mesh0DElement::ChangeNodes(con
   if ( nbNodes == 1 )
   {
     vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+#ifdef VTK_CELL_ARRAY_V2
+    vtkNew<vtkIdList> cellPoints;
+    grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
+    if (nbNodes != cellPoints->GetNumberOfIds())
+    {
+      MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes);
+      return false;
+    }
+    myNode = nodes[0];
+    cellPoints->SetId(0, myNode->getVtkId());
+#else
     vtkIdType npts = 0;
     vtkIdType* pts = 0;
     grid->GetCellPoints(myVtkID, npts, pts);
@@ -156,6 +167,7 @@ bool SMDS_Mesh0DElement::ChangeNodes(con
     }
     myNode = nodes[0];
     pts[0] = myNode->getVtkId();
+#endif
 
     SMDS_Mesh::_meshList[myMeshId]->setMyModified();
     return true;
Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshNode.cpp
===================================================================
--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshNode.cpp
+++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshNode.cpp
@@ -191,7 +191,7 @@ public:
 SMDS_ElemIteratorPtr SMDS_MeshNode::
 GetInverseElementIterator(SMDSAbs_ElementType type) const
 {
-  vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
+  vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
   //MESSAGE("myID " << myID << " ncells " << l.ncells);
   return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
 }
@@ -251,7 +251,7 @@ elementsIterator(SMDSAbs_ElementType typ
     return SMDS_MeshElement::elementsIterator(SMDSAbs_Node);
   else
   {
-    vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
+    vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
     return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
   }
 }
@@ -350,7 +350,7 @@ void SMDS_MeshNode::AddInverseElement(co
   const SMDS_MeshCell *cell = dynamic_cast<const SMDS_MeshCell*> (ME);
   assert(cell);
   SMDS_UnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
-  vtkCellLinks *Links = grid->GetCellLinks();
+  vtkCellLinks *Links = static_cast<vtkCellLinks*>(grid->GetCellLinks());
   Links->ResizeCellList(myVtkID, 1);
   Links->AddCellReference(cell->getVtkId(), myVtkID);
 }
@@ -366,7 +366,7 @@ void SMDS_MeshNode::ClearInverseElements
 
 bool SMDS_MeshNode::emptyInverseElements()
 {
-  vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
+  vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
   return (l.ncells == 0);
 }
 
@@ -378,7 +378,7 @@ bool SMDS_MeshNode::emptyInverseElements
 
 int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const
 {
-  vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
+  vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
 
   if ( type == SMDSAbs_All )
     return l.ncells;
Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
===================================================================
--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
+++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
@@ -139,8 +139,8 @@ int SMDS_UnstructuredGrid::InsertNextLin
   for (; it != setOfNodes.end(); ++it)
     {
       //MESSAGE("reverse link for node " << *it << " cell " << cellid);
-      this->Links->ResizeCellList(*it, 1);
-      this->Links->AddCellReference(cellid, *it);
+      this->GetLinks()->ResizeCellList(*it, 1);
+      this->GetLinks()->AddCellReference(cellid, *it);
     }
 
   return cellid;
@@ -332,9 +332,13 @@ void SMDS_UnstructuredGrid::copyBloc(vtk
     {
       newTypes->SetValue(alreadyCopied, this->Types->GetValue(j));
       idCellsOldToNew[j] = alreadyCopied; // old vtkId --> new vtkId
+#ifdef VTK_CELL_ARRAY_V2
+      vtkIdType oldLoc = this->GetCellLocationsArray()->GetValue(j);
+#else
       vtkIdType oldLoc = this->Locations->GetValue(j);
+#endif
       vtkIdType nbpts;
-      vtkIdType *oldPtsCell = 0;
+      vtkIdTypePtr oldPtsCell = 0;
       this->Connectivity->GetCell(oldLoc, nbpts, oldPtsCell);
       assert(nbpts < NBMAXNODESINCELL);
       //MESSAGE(j << " " << alreadyCopied << " " << (int)this->Types->GetValue(j) << " " << oldLoc << " " << nbpts );
@@ -952,6 +956,21 @@ void SMDS_UnstructuredGrid::GetNodeIds(s
  */
 void SMDS_UnstructuredGrid::ModifyCellNodes(int vtkVolId, std::map<int, int> localClonedNodeIds)
 {
+#ifdef VTK_CELL_ARRAY_V2
+  vtkNew<vtkIdList> cellPoints;
+  this->GetCellPoints(vtkVolId, cellPoints.GetPointer());
+  for (vtkIdType i = 0; i < cellPoints->GetNumberOfIds(); i++)
+    {
+      if (localClonedNodeIds.count(cellPoints->GetId(i)))
+        {
+          vtkIdType oldpt = cellPoints->GetId(i);
+          cellPoints->SetId(i, localClonedNodeIds[oldpt]);
+          //MESSAGE(oldpt << " --> " << pts[i]);
+          //this->RemoveReferenceToCell(oldpt, vtkVolId);
+          //this->AddReferenceToCell(pts[i], vtkVolId);
+        }
+    }
+#else
   vtkIdType npts = 0;
   vtkIdType *pts; // will refer to the point id's of the face
   this->GetCellPoints(vtkVolId, npts, pts);
@@ -966,6 +985,7 @@ void SMDS_UnstructuredGrid::ModifyCellNo
           //this->AddReferenceToCell(pts[i], vtkVolId);
         }
     }
+#endif
 }
 
 /*! reorder the nodes of a face
@@ -995,11 +1015,20 @@ void SMDS_UnstructuredGrid::BuildLinks()
     this->Links->UnRegister(this);
     }
 
+#ifdef VTK_CELL_ARRAY_V2
+  this->Links = SMDS_CellLinks::New();
+  GetLinks()->Allocate(this->GetNumberOfPoints());
+  GetLinks()->Register(this);
+//FIXME: vtk9
+  GetLinks()->BuildLinks(this);
+  GetLinks()->Delete();
+#else
   this->Links = SMDS_CellLinks::New();
   this->Links->Allocate(this->GetNumberOfPoints());
   this->Links->Register(this);
   this->Links->BuildLinks(this, this->Connectivity);
   this->Links->Delete();
+#endif
 }
 
 /*! Create a volume (prism or hexahedron) by duplication of a face.
Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkCellIterator.cpp
===================================================================
--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkCellIterator.cpp
+++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkCellIterator.cpp
@@ -33,7 +33,8 @@ SMDS_VtkCellIterator::SMDS_VtkCellIterat
   }
   else
   {
-    vtkIdType npts, *pts;
+    vtkIdType npts;
+    vtkIdTypePtr pts;
     grid->GetCellPoints( _cellId, npts, pts );
     _vtkIdList->SetNumberOfIds( _nbNodes = npts );
     for (int i = 0; i < _nbNodes; i++)
@@ -67,7 +68,7 @@ SMDS_VtkCellIteratorToUNV::SMDS_VtkCellI
   //MESSAGE("SMDS_VtkCellInterlacedIterator (UNV)" << _type);
 
   _vtkIdList = vtkIdList::New();
-  vtkIdType* pts;
+  vtkIdTypePtr pts;
   vtkIdType npts;
   vtkUnstructuredGrid* grid = _mesh->getGrid();
   grid->GetCellPoints((vtkIdType)_cellId, npts, pts);
@@ -182,7 +183,7 @@ SMDS_VtkCellIteratorPolyH::SMDS_VtkCellI
   {
     //MESSAGE("SMDS_VtkCellIterator Polyhedra");
     vtkIdType nFaces = 0;
-    vtkIdType* ptIds = 0;
+    vtkIdTypePtr ptIds = 0;
     grid->GetFaceStream(_cellId, nFaces, ptIds);
     int id = 0;
     _nbNodesInFaces = 0;
Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkEdge.cpp
===================================================================
--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkEdge.cpp
+++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkEdge.cpp
@@ -67,6 +67,19 @@ bool SMDS_VtkEdge::ChangeNodes(const SMD
 bool SMDS_VtkEdge::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
 {
   vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+#ifdef VTK_CELL_ARRAY_V2
+  vtkNew<vtkIdList> cellPoints;
+  grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
+  if (nbNodes != cellPoints->GetNumberOfIds())
+    {
+      MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes);
+      return false;
+    }
+  for (int i = 0; i < nbNodes; i++)
+    {
+      cellPoints->SetId(i, nodes[i]->getVtkId());
+    }
+#else
   vtkIdType npts = 0;
   vtkIdType* pts = 0;
   grid->GetCellPoints(myVtkID, npts, pts);
@@ -79,6 +92,7 @@ bool SMDS_VtkEdge::ChangeNodes(const SMD
     {
       pts[i] = nodes[i]->getVtkId();
     }
+#endif
   SMDS_Mesh::_meshList[myMeshId]->setMyModified();
   return true;
 }
@@ -87,7 +101,7 @@ bool SMDS_VtkEdge::IsMediumNode(const SM
 {
   vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
   vtkIdType npts = 0;
-  vtkIdType* pts = 0;
+  vtkIdTypePtr pts = 0;
   grid->GetCellPoints(myVtkID, npts, pts);
   //MESSAGE("IsMediumNode " << npts  << " " << (node->getVtkId() == pts[npts-1]));
   return ((npts == 3) && (node->getVtkId() == pts[2]));
@@ -137,7 +151,8 @@ const SMDS_MeshNode*
 SMDS_VtkEdge::GetNode(const int ind) const
 {
   vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
-  vtkIdType npts, *pts;
+  vtkIdType npts;
+  vtkIdTypePtr pts;
   grid->GetCellPoints( this->myVtkID, npts, pts );
   return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ ind ]);
 }
Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkFace.cpp
===================================================================
--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkFace.cpp
+++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkFace.cpp
@@ -101,6 +101,19 @@ void SMDS_VtkFace::initQuadPoly(const st
 bool SMDS_VtkFace::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
 {
   vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+#ifdef VTK_CELL_ARRAY_V2
+  vtkNew<vtkIdList> cellPoints;
+  grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
+  if (nbNodes != cellPoints->GetNumberOfIds())
+    {
+      MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes);
+      return false;
+    }
+  for (int i = 0; i < nbNodes; i++)
+    {
+      cellPoints->SetId(i, nodes[i]->getVtkId());
+    }
+#else
   vtkIdType npts = 0;
   vtkIdType* pts = 0;
   grid->GetCellPoints(myVtkID, npts, pts);
@@ -113,6 +126,7 @@ bool SMDS_VtkFace::ChangeNodes(const SMD
     {
       pts[i] = nodes[i]->getVtkId();
     }
+#endif
   SMDS_Mesh::_meshList[myMeshId]->setMyModified();
   return true;
 }
@@ -173,7 +187,8 @@ const SMDS_MeshNode*
 SMDS_VtkFace::GetNode(const int ind) const
 {
   vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
-  vtkIdType npts, *pts;
+  vtkIdType npts;
+  vtkIdTypePtr pts;
   grid->GetCellPoints( this->myVtkID, npts, pts );
   return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ ind ]);
 }
@@ -186,7 +201,8 @@ SMDS_VtkFace::GetNode(const int ind) con
 int SMDS_VtkFace::GetNodeIndex( const SMDS_MeshNode* node ) const
 {
   vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
-  vtkIdType npts, *pts;
+  vtkIdType npts;
+  vtkIdTypePtr pts;
   grid->GetCellPoints( this->myVtkID, npts, pts );
   for ( vtkIdType i = 0; i < npts; ++i )
     if ( pts[i] == node->getVtkId() )
@@ -251,7 +267,7 @@ bool SMDS_VtkFace::IsMediumNode(const SM
     return false;
   }
   vtkIdType npts = 0;
-  vtkIdType* pts = 0;
+  vtkIdTypePtr pts = 0;
   grid->GetCellPoints(myVtkID, npts, pts);
   vtkIdType nodeId = node->getVtkId();
   for (int rank = 0; rank < npts; rank++)
@@ -356,11 +372,18 @@ SMDS_NodeIteratorPtr SMDS_VtkFace::inter
 void SMDS_VtkFace::ChangeApex(SMDS_MeshNode* node)
 {
   vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+#ifdef VTK_CELL_ARRAY_V2
+  vtkNew<vtkIdList> cellPoints;
+  grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
+  grid->RemoveReferenceToCell(cellPoints->GetId(0), myVtkID);
+  cellPoints->SetId(0, node->getVtkId());
+#else
   vtkIdType npts = 0;
   vtkIdType* pts = 0;
   grid->GetCellPoints(myVtkID, npts, pts);
   grid->RemoveReferenceToCell(pts[0], myVtkID);
   pts[0] = node->getVtkId();
+#endif
   node->AddInverseElement(this),
   SMDS_Mesh::_meshList[myMeshId]->setMyModified();
 }
Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkVolume.cpp
===================================================================
--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkVolume.cpp
+++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkVolume.cpp
@@ -133,6 +133,19 @@ void SMDS_VtkVolume::initPoly(const std:
 bool SMDS_VtkVolume::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
 {
   vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+#ifdef VTK_CELL_ARRAY_V2
+  vtkNew<vtkIdList> cellPoints;
+  grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
+  if (nbNodes != cellPoints->GetNumberOfIds())
+    {
+      MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes);
+      return false;
+    }
+  for (int i = 0; i < nbNodes; i++)
+    {
+      cellPoints->SetId(i, nodes[i]->getVtkId());
+    }
+#else
   vtkIdType npts = 0;
   vtkIdType* pts = 0;
   grid->GetCellPoints(myVtkID, npts, pts);
@@ -145,6 +158,7 @@ bool SMDS_VtkVolume::ChangeNodes(const S
     {
       pts[i] = nodes[i]->getVtkId();
     }
+#endif
   SMDS_Mesh::_meshList[myMeshId]->setMyModified();
   return true;
 }
@@ -207,7 +221,7 @@ int SMDS_VtkVolume::NbFaces() const
     case VTK_POLYHEDRON:
       {
         vtkIdType nFaces = 0;
-        vtkIdType* ptIds = 0;
+        vtkIdTypePtr ptIds = 0;
         grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
         nbFaces = nFaces;
         break;
@@ -236,7 +250,7 @@ int SMDS_VtkVolume::NbNodes() const
   else
     {
       vtkIdType nFaces = 0;
-      vtkIdType* ptIds = 0;
+      vtkIdTypePtr ptIds = 0;
       grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
       int id = 0;
       for (int i = 0; i < nFaces; i++)
@@ -276,7 +290,7 @@ int SMDS_VtkVolume::NbEdges() const
     case VTK_POLYHEDRON:
       {
         vtkIdType nFaces = 0;
-        vtkIdType* ptIds = 0;
+        vtkIdTypePtr ptIds = 0;
         grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
         nbEdges = 0;
         int id = 0;
@@ -312,7 +326,7 @@ int SMDS_VtkVolume::NbFaceNodes(const in
   if (aVtkType == VTK_POLYHEDRON)
     {
       vtkIdType nFaces = 0;
-      vtkIdType* ptIds = 0;
+      vtkIdTypePtr ptIds = 0;
       grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
       int id = 0;
       for (int i = 0; i < nFaces; i++)
@@ -342,7 +356,7 @@ const SMDS_MeshNode* SMDS_VtkVolume::Get
   if (aVtkType == VTK_POLYHEDRON)
     {
       vtkIdType nFaces = 0;
-      vtkIdType* ptIds = 0;
+      vtkIdTypePtr ptIds = 0;
       grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
       int id = 0;
       for (int i = 0; i < nFaces; i++)
@@ -372,7 +386,7 @@ std::vector<int> SMDS_VtkVolume::GetQuan
   if (aVtkType == VTK_POLYHEDRON)
     {
       vtkIdType nFaces = 0;
-      vtkIdType* ptIds = 0;
+      vtkIdTypePtr ptIds = 0;
       grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
       int id = 0;
       for (int i = 0; i < nFaces; i++)
@@ -430,7 +444,7 @@ const SMDS_MeshNode* SMDS_VtkVolume::Get
   if ( aVtkType == VTK_POLYHEDRON)
   {
     vtkIdType nFaces = 0;
-    vtkIdType* ptIds = 0;
+    vtkIdTypePtr ptIds = 0;
     grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
     int id = 0, nbPoints = 0;
     for (int i = 0; i < nFaces; i++)
@@ -443,7 +457,8 @@ const SMDS_MeshNode* SMDS_VtkVolume::Get
     }
     return 0;
   }
-  vtkIdType npts, *pts;
+  vtkIdType npts;
+  vtkIdTypePtr pts;
   grid->GetCellPoints( this->myVtkID, npts, pts );
   const std::vector<int>& interlace = SMDS_MeshCell::fromVtkOrder( VTKCellType( aVtkType ));
   return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ interlace.empty() ? ind : interlace[ind]] );
@@ -460,7 +475,7 @@ int SMDS_VtkVolume::GetNodeIndex( const
   if ( aVtkType == VTK_POLYHEDRON)
   {
     vtkIdType nFaces = 0;
-    vtkIdType* ptIds = 0;
+    vtkIdTypePtr ptIds = 0;
     grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
     int id = 0;
     for (int iF = 0; iF < nFaces; iF++)
@@ -473,7 +488,8 @@ int SMDS_VtkVolume::GetNodeIndex( const
     }
     return -1;
   }
-  vtkIdType npts, *pts;
+  vtkIdType npts;
+  vtkIdTypePtr pts;
   grid->GetCellPoints( this->myVtkID, npts, pts );
   for ( vtkIdType i = 0; i < npts; ++i )
     if ( pts[i] == node->getVtkId() )
@@ -534,7 +550,7 @@ bool SMDS_VtkVolume::IsMediumNode(const
       return false;
   }
   vtkIdType npts = 0;
-  vtkIdType* pts = 0;
+  vtkIdTypePtr pts = 0;
   grid->GetCellPoints(myVtkID, npts, pts);
   vtkIdType nodeId = node->getVtkId();
   for (int rank = 0; rank < npts; rank++)
Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp
===================================================================
--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp
+++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp
@@ -11348,7 +11348,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGrou
             {
               int oldId = *itn;
               //MESSAGE("     node " << oldId);
-              vtkCellLinks::Link l = grid->GetCellLinks()->GetLink(oldId);
+              vtkCellLinks::Link l = static_cast<vtkCellLinks*>(grid->GetCellLinks())->GetLink(oldId);
               for (int i=0; i<l.ncells; i++)
                 {
                   int vtkId = l.cells[i];
@@ -11527,7 +11527,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGrou
                                           //MESSAGE("  domain " << idom << " volume " << elem->GetID());
                                           double values[3];
                                           vtkIdType npts = 0;
-                                          vtkIdType* pts = 0;
+                                          vtkIdTypePtr pts = 0;
                                           grid->GetCellPoints(vtkVolIds[ivol], npts, pts);
                                           SMDS_VtkVolume::gravityCenter(grid, pts, npts, values);
                                           if (id ==0)
@@ -11708,7 +11708,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGrou
         {
           int oldId = itnod->first;
           //MESSAGE("     node " << oldId);
-          vtkCellLinks::Link l = grid->GetCellLinks()->GetLink(oldId);
+          vtkCellLinks::Link l = static_cast<vtkCellLinks*>(grid->GetCellLinks())->GetLink(oldId);
           for (int i = 0; i < l.ncells; i++)
             {
               int vtkId = l.cells[i];
@@ -12165,7 +12165,7 @@ void SMESH_MeshEditor::CreateHoleSkin(do
           MESSAGE("volume to check,  vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
           bool volInside = false;
           vtkIdType npts = 0;
-          vtkIdType* pts = 0;
+          vtkIdTypePtr pts = 0;
           grid->GetCellPoints(vtkId, npts, pts);
           for (int i=0; i<npts; i++)
             {
Index: FreeCAD-0.19.2/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp
===================================================================
--- FreeCAD-0.19.2.orig/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp
+++ FreeCAD-0.19.2/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp
@@ -20,7 +20,6 @@
  *                                                                         *
  ***************************************************************************/
 
-
 #include "PreCompiled.h"
 
 #ifndef _PreComp_