Salome HOME
bos #20256: [CEA 18523] Porting SMESH to int 64 bits
[modules/smesh.git] / src / SMDS / SMDS_UnstructuredGrid.hxx
index e5ce97512a007a6604f5ac0422760a606eda6f99..89ba29445ea1019e25515112d05eb29e4bdd8ca8 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2010-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -28,6 +28,7 @@
 
 #include <vtkUnstructuredGrid.h>
 #include <vtkCellLinks.h>
+#include <smIdType.hxx>
 
 #include <vector>
 #include <set>
 // allow very huge polyhedrons in tests
 #define NBMAXNODESINCELL 5000
 
+// Keep compatibility with paraview 5.0.1 on Linux
+#ifndef WIN32
+  #ifndef VTK_HAS_MTIME_TYPE
+  #define VTK_HAS_MTIME_TYPE
+  typedef unsigned long int vtkMTimeType;
+  #endif
+#endif
+
 class SMDS_Downward;
 class SMDS_Mesh;
 class SMDS_MeshCell;
@@ -54,6 +63,7 @@ class SMDS_EXPORT SMDS_CellLinks: public vtkCellLinks
 {
 public:
   void ResizeForPoint(vtkIdType vtkID);
+  void BuildLinks(vtkDataSet *data, vtkCellArray *Connectivity, vtkUnsignedCharArray* types);
   static SMDS_CellLinks* New();
 protected:
   SMDS_CellLinks();
@@ -64,22 +74,17 @@ class SMDS_EXPORT SMDS_UnstructuredGrid: public vtkUnstructuredGrid
 {
 public:
   void setSMDS_mesh(SMDS_Mesh *mesh);
-  void compactGrid(std::vector<int>& idNodesOldToNew,
-                   int               newNodeSize,
-                   std::vector<int>& idCellsOldToNew,
-                   int               newCellSize);
-  virtual unsigned long GetMTime();
-  // OUV_PORTING_VTK6: seems to be useless
-  //virtual void Update();
-  //virtual void UpdateInformation();
+  void compactGrid(std::vector<smIdType>& idNodesOldToNew,
+                   smIdType               newNodeSize,
+                   std::vector<smIdType>& idCellsOldToNew,
+                   smIdType               newCellSize);
+  virtual vtkMTimeType GetMTime();
   virtual vtkPoints *GetPoints();
 
-  //#ifdef VTK_HAVE_POLYHEDRON
-  int InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
-  //#endif
+  vtkIdType InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
 
-  int CellIdToDownId(int vtkCellId);
-  void setCellIdToDownId(int vtkCellId, int downId);
+  int CellIdToDownId(vtkIdType vtkCellId);
+  void setCellIdToDownId(vtkIdType vtkCellId, int downId);
   void CleanDownwardConnectivity();
   void BuildDownwardConnectivity(bool withEdges);
   int GetNeighbors(int* neighborsVtkIds, int* downIds, unsigned char* downTypes, int vtkId, bool getSkin=false);
@@ -88,15 +93,15 @@ public:
   void GetNodeIds(std::set<int>& nodeSet, int downId, unsigned char downType);
   void ModifyCellNodes(int vtkVolId, std::map<int, int> localClonedNodeIds);
   int getOrderedNodesOfFace(int vtkVolId, int& dim, std::vector<vtkIdType>& orderedNodes);
-  void BuildLinks();
   SMDS_MeshCell* extrudeVolumeFromFace(int vtkVolId, int domain1, int domain2,
                                        std::set<int>&                      originalNodes,
                                        std::map<int, std::map<int, int> >& nodeDomains,
                                        std::map<int, std::map<long,int> >& nodeQuadDomains);
-  vtkCellLinks* GetLinks()
-  {
-    return Links;
-  }
+  void BuildLinks();
+  void DeleteLinks();
+  SMDS_CellLinks* GetLinks();
+  bool HasLinks() const { return this->Links; }
+
   SMDS_Downward* getDownArray(unsigned char vtkType)
   {
     return _downArray[vtkType];
@@ -111,10 +116,13 @@ public:
 protected:
   SMDS_UnstructuredGrid();
   ~SMDS_UnstructuredGrid();
-  void copyNodes(vtkPoints *newPoints, std::vector<int>& idNodesOldToNew, int& alreadyCopied, int start, int end);
-  void copyBloc(vtkUnsignedCharArray *newTypes, std::vector<int>& idCellsOldToNew, std::vector<int>& idNodesOldToNew,
-                vtkCellArray* newConnectivity, vtkIdTypeArray* newLocations, vtkIdType* pointsCell, int& alreadyCopied,
-                int start, int end);
+  void copyNodes(vtkPoints *newPoints, std::vector<smIdType>& idNodesOldToNew, vtkIdType& alreadyCopied, vtkIdType start, vtkIdType end);
+  void copyBloc(vtkUnsignedCharArray *newTypes,
+                const std::vector<smIdType>& idCellsOldToNew,
+                const std::vector<smIdType>& idNodesOldToNew,
+                vtkCellArray* newConnectivity,
+                vtkIdTypeArray* newLocations,
+                std::vector<vtkIdType>& pointsCell);
 
   std::vector<int> _cellIdToDownId; //!< convert vtk Id to downward[vtkType] id, initialized with -1
   std::vector<unsigned char> _downTypes;